Skip to content

Commit 9ad1d5d

Browse files
committed
adding rpyc, pbs,commando
1 parent 28e30f4 commit 9ad1d5d

File tree

2 files changed

+78
-2
lines changed

2 files changed

+78
-2
lines changed

‎docs/scenarios/admin.rst‎

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,49 @@ Blueprint
8484
Buildout
8585
--------
8686

87-
.. todo:: Write about Buildout
87+
.. todo:: Write about Buildout
88+
89+
pbs
90+
---
91+
`pbs <https://github.com/amoffat/pbs>`_ is a tool that take
92+
python a bit closer to bash. In a pythonic more "Human" way
93+
(not like the standard library subprocess].
94+
95+
you can utilize it like that:
96+
97+
.. code-block:: python
98+
99+
from pbs import ifconfig
100+
print ifconfig("eth0")
101+
102+
or for the lazy ones:
103+
104+
.. code-block:: python
105+
106+
from pbs import*
107+
print ifconfig("eth0")
108+
print du()
109+
110+
RPyC
111+
----
112+
`RPyC <http://rpyc.sourceforge.net/>`_ is a module that can give you control on a remote interpeter, in a convientent way.
113+
when you need two python interpeters talk with each other, make sure you try this one.
114+
115+
starting the server:
116+
.. code-block:: bash
117+
118+
$ ./rpyc_classic.py -m threaded
119+
120+
connect from client:
121+
.. code-block:: python
122+
123+
conn = rpyc.classic.connect("hostname")
124+
125+
# using modules for anthoer interpeter/host
126+
proc = conn.modules.subprocess.Popen("ls", stdout=-1, stderr=-1)
127+
stdout, stderr = proc.communicate()
128+
print stdout.split()
129+
130+
remote_list = conn.builtin.range(7)
131+
132+
conn.execute("print 'foo'")

‎docs/scenarios/cli.rst‎

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,35 @@ Command Line Applications
66
Clint
77
-----
88

9-
.. todo:: Write about Clint
9+
.. todo:: Write about Clint
10+
11+
commando
12+
--------
13+
`commando <https://github.com/lakshmivyas/commando>`_ - argparse in style
14+
15+
A simple wrapper for argparse that allows commands and arguments to be
16+
defined declaratively using decorators. Note that this does not support
17+
all the features of argparse yet.
18+
19+
With commando:
20+
21+
.. code-block:: python
22+
23+
classEngine(Application):
24+
25+
@command(description='hyde - a python static website generator',
26+
epilog='Use %(prog)s{command} -h to get help on individual commands')
27+
@param('-v', '--version', action='version', version='%(prog)s'+__version__)
28+
@param('-s', '--sitepath', action='store', default='.', help="Location of the hyde site")
29+
defmain(self, params): pass
30+
31+
@subcommand('init', help='Create a new hyde site')
32+
@param('-t', '--template', action='store', default='basic', dest='template',
33+
help='Overwrite the current site if it exists')
34+
@param('-f', '--force', action='store_true', default=False, dest='overwrite',
35+
help='Overwrite the current site if it exists')
36+
definit(self, params):
37+
print params.sitepath
38+
print params.template
39+
print params.overwrite
40+

0 commit comments

Comments
(0)