The PyCSP project is an on-going project to bring CSP (Communicating Sequential Processes) to Python.
It was started in 2006 and is still under active development. Bug reports and suggestions for new features are most welcome.
( Updated 2013-02-14 ) Released PyCSP 0.9.0
( Updated 2013-02-13 ) Found a design flaw in AltSelect, which means that AltSelect does not guarantee priority when affected by network and scheduling latencies. A new PriSelect have been added which is slightly slower but does guarantee priority and thus should be used whenever the SkipGuard is needed.
( Updated 2013-01-21 ) Windows support has now been tested and should work, with a few differences when using @multiprocess. Getting closer to a release. Still a few minor tweaks and bugs left. Please use the latest version from svn. See below for instructions.
( Updated 2012-12-13 ) We are finally very close to releasing a new 0.9.0 version, which will provide a long list of new features. The project is considered stable on linux or MacOSX and we recommend that downloads are retrieved by fetching the latest trunk version using svn. Currently windows is not supported. We recommend using CPython 2.7.
The documentation on this website is updated to focus on the 0.9.0 PyCSP version.
wget http://pycsp.googlecode.com/files/pycsp-complete-0.9.0.tar.gz
tar -zxf pycsp-complete-0.9.0.tar.gz
cd pycsp-0.9.0
sudo python setup.py install
- A flexible CSP library for Python
- Synchronous communication
- Buffered channels
- Multiple process types such as, greenlets, threads, processes and remote processes
- Both input and output guards supported in external choice (Alts)
- A single any-to-any channel type
- Mobile channel-ends
- Retire and poison signals for shutting down networks nicely
- A channel which can communicate using inter-process communication as well as sockets.
- A PyCSP providing local and distributed communication using only standard python modules bundled with CPython
- NAT traversal
- Tracing PyCSP executions to a log file, for later visualisation
- Add visualisation of tracing information for hosts, when using distributed communication
- Add Python3 support
- Add ssh_process, qsub_process (PBS) and grid_process process types
The best way to get started on PyCSP is through the tutorials:
Documentation on all parts of PyCSP: Reference documentation
Example:
import sys
from pycsp.parallel import *
@process
def source(chan_out):
for i in range(10):
chan_out("Hello world (%d)\n" % (i))
retire(chan_out)
@process
def sink(chan_in):
while True:
sys.stdout.write(chan_in())
chan = Channel()
Parallel(
5 * source(-chan),
5 * sink(+chan)
)
shutdown()
- Friborg, Rune Møllegaard ; Vinter, Brian. Verification of a Dynamic Channel Model using the SPIN Model Checker. Communicating Process Architectures 2011 : WoTUG-33, Proceedings of the 33st WoTUG Technical Meeting (CPA-11). Limerick, Ireland.
- Friborg, Rune Møllegaard ; Vinter, Brian. Rapid development of scalable scientific software using a process oriented approach. Journal of Computational Science
- Friborg, Rune Møllegaard ; Vinter, Brian ; Bjørndalen, John Markus. PyCSP - controlled concurrency. International Journal of Information Processing and Management, Volume 1, Number 2, October 2010
- Vinter, Brian ; Bjørndalen, John Markus ; Friborg, Rune Møllegaard. PyCSP Revisited. Communicating Process Architectures 2009 : WoTUG-32, Proceedings of the 32st WoTUG Technical Meeting (CPA-09). Eindhoven, The Netherlands.
- Friborg, Rune Møllegaard ; Bjørndalen, John Markus ; Vinter, Brian. Three Unique Implementations of Processes for PyCSP. Communicating Process Architectures 2009 : WoTUG-32, Proceedings of the 32st WoTUG Technical Meeting (CPA-09). Eindhoven, The Netherlands.
- Friborg, Rune Møllegaard ; Vinter, Brian. CSPBuilder - CSP based Scientific Workflow Modelling. Communicating Process Architectures 2008 : WoTUG-31, Proceedings of the 31st WoTUG Technical Meeting (CPA-08). York, UK.
- Bjørndalen, John Markus ; Sampson, Adam T. Process-Oriented Collective Operations. Communicating Process Architectures 2008 : WoTUG-31, Proceedings of the 31st WoTUG Technical Meeting (CPA-08). York, UK.
- Bjørndalen, John Markus ; Vinter, Brian ; Anshus, Otto. PyCSP - Communicating Sequential Processes for Python. Communicating Process Architectures 2007 : WoTUG-30, Proceedings of the 30st WoTUG Technical Meeting (CPA-07). Surrey, UK.