Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 46 additions & 1 deletion docs/scenarios/admin.rst
Original file line numberDiff line numberDiff line change
Expand Up@@ -84,4 +84,49 @@ Blueprint
Buildout
--------

.. todo:: Write about Buildout
.. todo:: Write about Buildout

pbs
---
`pbs <https://github.com/amoffat/pbs>`_ is a tool that take
python a bit closer to bash. In a pythonic more "Human" way
(not like the standard library subprocess].

you can utilize it like that:

.. code-block:: python

from pbs import ifconfig
print ifconfig("eth0")

or for the lazy ones:

.. code-block:: python

from pbs import *
print ifconfig("eth0")
print du()

RPyC
----
`RPyC <http://rpyc.sourceforge.net/>`_ is a module that can give you control on a remote interpeter, in a convientent way.
when you need two python interpeters talk with each other, make sure you try this one.

starting the server:
.. code-block:: bash

$ ./rpyc_classic.py -m threaded

connect from client:
.. code-block:: python

conn = rpyc.classic.connect("hostname")

# using modules for anthoer interpeter/host
proc = conn.modules.subprocess.Popen("ls", stdout = -1, stderr = -1)
stdout, stderr = proc.communicate()
print stdout.split()

remote_list = conn.builtin.range(7)

conn.execute("print 'foo'")
33 changes: 32 additions & 1 deletion docs/scenarios/cli.rst
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,4 +6,35 @@ Command Line Applications
Clint
-----

.. todo:: Write about Clint
.. todo:: Write about Clint

commando
--------
`commando <https://github.com/lakshmivyas/commando>`_ - argparse in style

A simple wrapper for argparse that allows commands and arguments to be
defined declaratively using decorators. Note that this does not support
all the features of argparse yet.

With commando:

.. code-block:: python

class Engine(Application):

@command(description='hyde - a python static website generator',
epilog='Use %(prog)s{command} -h to get help on individual commands')
@param('-v', '--version', action='version', version='%(prog)s ' + __version__)
@param('-s', '--sitepath', action='store', default='.', help="Location of the hyde site")
def main(self, params): pass

@subcommand('init', help='Create a new hyde site')
@param('-t', '--template', action='store', default='basic', dest='template',
help='Overwrite the current site if it exists')
@param('-f', '--force', action='store_true', default=False, dest='overwrite',
help='Overwrite the current site if it exists')
def init(self, params):
print params.sitepath
print params.template
print params.overwrite