Ever since i first worked with threads in Java 15 years ago, I have been
struggeling with the concept. Before that I was used to C and a homegrown "OS"
called Daros. It had Task "preemtive processes", Messages and Queues. For me
it was much easier to comprehend the one Task == one thread concept.
No synchronized keyword, only place you had to take a little care was if you
used shared memory (which was rare)
In 2004 we therefore inplemented Coworks in Java, a concurrent object model
for Java. Also known as the Task pattern. Since then we have implemented many
larger projects all over the world. The concept is easy for developers to
understand and generally performs very well.
The other evening I decided to try to implement my version of Coworks in
Python. Inspired by Donovan Preston's (@donovanpreston) talk at Pycon 2010
about his implementation of Task's in Python I decided to try my self.
Pyworks implements two types of concurrent classes: Actor and Task. Actor
is a simple concurrent class and Task is a specialized form of Actor. Actor
has a few simple methods: actor, timeout, notify and observe. Task is more
complex supporting State pattern and methods for controlled startup sequence,
configuration etc.
It is a simple as it gets. Subclasses of Task run in their own thread.
Task's can access each other by calling self.actor("SomeActor") to get
a Proxy for that Task. You can call all methods on the other Task. The Method
is sent on a Queue and executed in the other Task's thread.
If you need a return value you can use the Future patten.
Every Task can listen on other Task's via the self.observe("SomeActor")
method. A listener must implement all Output methods of the Task being
listened on.
Every Task has a State (default is it self), which handle all incoming
Methods. This means that States in Task are very easy to implement.
No thought or time whatsoever has been put into performance, this is a study
only.
run test test program by simply doing:
$ python pywork.py --run
Works on python3
Rene Nejsum
rene@pylots.com
Copyright (C) 2012-
Metadata
Release files for pyworks 0.9.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyworks-0.9.1.tar.gz | 12.6 kB | Without provenance | Details for pyworks-0.9.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyworks-0.9.1-py3-none-any.whl | Python 3 | none | any | Details for pyworks-0.9.1-py3-none-any.whl |
Total release size: 26.7 kB
Release files / pyworks-0.9.1.tar.gz
| Download URL | pyworks-0.9.1.tar.gz |
|---|---|
| Size | 12.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b7fb059fd200e2c848e19ade9c10f73e2f447247257f4ee3318736a533ce6eb4
|
|
BLAKE2b-256 checksum How to use checksums |
aae748f6e0c50795e09c8f90bb415134669e73dd44b0d1340e5f2b7d5b091c57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pyworks-0.9.1-py3-none-any.whl
| Download URL | pyworks-0.9.1-py3-none-any.whl |
|---|---|
| Size | 14.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
988c2948068cff592a51317002c3330ec0eab04c88abe54f5767e9f504f28f3e
|
|
BLAKE2b-256 checksum How to use checksums |
9593789d6eb688ef5b2349191fc94c8bb6327e4ee5bd59a454f0fefc78023aec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pyworks 0.9.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.