Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.1%) to scientific vocabulary
Keywords from Contributors
asyncio
coroutines
greenlet
closember
rabbitmq
spec-0
repl
notebook
ipython
workers
Last synced: 10 months ago
·
JSON representation
Repository
zerorpc for python
Basic Info
- Host: GitHub
- Owner: 0rpc
- License: other
- Language: Python
- Default Branch: master
- Homepage: http://www.zerorpc.io
- Size: 380 KB
Statistics
- Stars: 3,205
- Watchers: 123
- Forks: 386
- Open Issues: 54
- Releases: 0
Created over 14 years ago
· Last pushed over 1 year ago
Metadata Files
Readme
License
README.rst
zerorpc
=======
.. image:: https://travis-ci.org/0rpc/zerorpc-python.svg?branch=master
:target: https://travis-ci.org/0rpc/zerorpc-python
Mailing list: zerorpc@googlegroups.com (https://groups.google.com/d/forum/zerorpc)
zerorpc is a flexible RPC implementation based on zeromq and messagepack.
Service APIs exposed with zerorpc are called "zeroservices".
zerorpc can be used programmatically or from the command-line. It comes
with a convenient script, "zerorpc", allowing to:
* expose Python modules without modifying a single line of code,
* call those modules remotely through the command line.
Installation
------------
On most systems, its a matter of::
$ pip install zerorpc
Depending of the support from Gevent and PyZMQ on your system, you might need to install `libev` (for gevent) and `libzmq` (for pyzmq) with the development files.
Create a server with a one-liner
--------------------------------
Let's see zerorpc in action with a simple example. In a first terminal,
we will expose the Python "time" module::
$ zerorpc --server --bind tcp://*:1234 time
.. note::
The bind address uses the zeromq address format. You are not limited
to TCP transport: you could as well specify ipc:///tmp/time to use
host-local sockets, for instance. "tcp://\*:1234" is a short-hand to
"tcp://0.0.0.0:1234" and means "listen on TCP port 1234, accepting
connections on all IP addresses".
Call the server from the command-line
-------------------------------------
Now, in another terminal, call the exposed module::
$ zerorpc --client --connect tcp://127.0.0.1:1234 strftime %Y/%m/%d
Connecting to "tcp://127.0.0.1:1234"
"2011/03/07"
Since the client usecase is the most common one, "--client" is the default
parameter, and you can remove it safely::
$ zerorpc --connect tcp://127.0.0.1:1234 strftime %Y/%m/%d
Connecting to "tcp://127.0.0.1:1234"
"2011/03/07"
Moreover, since the most common usecase is to *connect* (as opposed to *bind*)
you can also omit "--connect"::
$ zerorpc tcp://127.0.0.1:1234 strftime %Y/%m/%d
Connecting to "tcp://127.0.0.1:1234"
"2011/03/07"
See remote service documentation
--------------------------------
You can introspect the remote service; it happens automatically if you don't
specify the name of the function you want to call::
$ zerorpc tcp://127.0.0.1:1234
Connecting to "tcp://127.0.0.1:1234"
tzset tzset(zone)
ctime ctime(seconds) -> string
clock clock() -> floating point number
struct_time
time time() -> floating point number
strptime strptime(string, format) -> struct_time
gmtime gmtime([seconds]) -> (tm_year, tm_mon, tm_mday, tm_hour, tm_min,
mktime mktime(tuple) -> floating point number
sleep sleep(seconds)
asctime asctime([tuple]) -> string
strftime strftime(format[, tuple]) -> string
localtime localtime([seconds]) -> (tm_year,tm_mon,tm_mday,tm_hour,tm_min,
Specifying non-string arguments
-------------------------------
Now, see what happens if we try to call a function expecting a non-string
argument::
$ zerorpc tcp://127.0.0.1:1234 sleep 3
Connecting to "tcp://127.0.0.1:1234"
Traceback (most recent call last):
[...]
TypeError: a float is required
That's because all command-line arguments are handled as strings. Don't worry,
we can specify any kind of argument using JSON encoding::
$ zerorpc --json tcp://127.0.0.1:1234 sleep 3
Connecting to "tcp://127.0.0.1:1234"
[wait for 3 seconds...]
null
zeroworkers: reversing bind and connect
---------------------------------------
Sometimes, you don't want your client to connect to the server; you want
your server to act as a kind of worker, and connect to a hub or queue which
will dispatch requests. You can achieve this by swapping "--bind" and
"--connect"::
$ zerorpc --bind tcp://*:1234 strftime %Y/%m/%d
We now have "something" wanting to call the "strftime" function, and waiting
for a worker to connect to it. Let's start the worker::
$ zerorpc --server tcp://127.0.0.1:1234 time
The worker will connect to the listening client and ask him "what should I
do?"; the client will send the "strftime" function call; the worker will
execute it and return the result. The first program will display the
local time and exit. The worker will remain running.
Listening on multiple addresses
-------------------------------
What if you want to run the same server on multiple addresses? Just repeat
the "--bind" option::
$ zerorpc --server --bind tcp://*:1234 --bind ipc:///tmp/time time
You can then connect to it using either "zerorpc tcp://\*:1234" or
"zerorpc ipc:///tmp/time".
Wait, there is more! You can even mix "--bind" and "--connect". That means
that your server will wait for requests on a given address, *and* connect
as a worker on another. Likewise, you can specify "--connect" multiple times,
so your worker will connect to multiple queues. If a queue is not running,
it won't affect the worker (that's the magic of zeromq).
.. warning:: A client should probably not connect to multiple addresses!
Almost all other scenarios will work; but if you ask a client to connect
to multiple addresses, and at least one of them has no server at the end,
the client will ultimately block. A client can, however, bind multiple
addresses, and will dispatch requests to available workers. If you want
to connect to multiple remote servers for high availability purposes,
you insert something like HAProxy in the middle.
Exposing a zeroservice programmatically
---------------------------------------
Of course, the command-line is simply a convenience wrapper for the zerorpc
python API. Below are a few examples.
Here's how to expose an object of your choice as a zeroservice::
class Cooler(object):
""" Various convenience methods to make things cooler. """
def add_man(self, sentence):
""" End a sentence with ", man!" to make it sound cooler, and
return the result. """
return sentence + ", man!"
def add_42(self, n):
""" Add 42 to an integer argument to make it cooler, and return the
result. """
return n + 42
def boat(self, sentence):
""" Replace a sentence with "I'm on a boat!", and return that,
because it's cooler. """
return "I'm on a boat!"
import zerorpc
s = zerorpc.Server(Cooler())
s.bind("tcp://0.0.0.0:4242")
s.run()
Let's save this code to *cooler.py* and run it::
$ python cooler.py
Now, in another terminal, let's try connecting to our awesome zeroservice::
$ zerorpc -j tcp://localhost:4242 add_42 1
43
$ zerorpc tcp://localhost:4242 add_man 'I own a mint-condition Volkswagen Golf'
"I own a mint-condition Volkswagen Golf, man!"
$ zerorpc tcp://localhost:4242 boat 'I own a mint-condition Volkswagen Golf, man!'
"I'm on a boat!"
Congratulations! You have just made the World a little cooler with your first
zeroservice, man!
Owner
- Name: zerorpc
- Login: 0rpc
- Kind: organization
- Website: http://www.zerorpc.io
- Repositories: 5
- Profile: https://github.com/0rpc
A set of RPC libraries, intuitive to use, decently fast, and cross-language.
GitHub Events
Total
- Issues event: 3
- Watch event: 56
- Issue comment event: 12
- Push event: 2
- Pull request event: 2
- Pull request review event: 1
- Fork event: 9
Last Year
- Issues event: 3
- Watch event: 56
- Issue comment event: 12
- Push event: 2
- Pull request event: 2
- Pull request review event: 1
- Fork event: 9
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| François-Xavier Bourlet | b****a@g****m | 123 |
| Andrea Luzzardi | a****i@g****m | 11 |
| Jérôme Petazzoni | jp@e****g | 10 |
| Louis Opter | l****s@d****m | 5 |
| Louis Opter | k****n@k****r | 5 |
| Bernhard Liebl | B****l@g****g | 4 |
| Wang Yanqing | y****g@e****e | 3 |
| Solomon Hykes | s****s@d****m | 3 |
| Paulo SantAnna | p****n@l****m | 3 |
| Arnon Yaari | a****y@i****m | 3 |
| Shiplu Mokaddim | s****t@g****m | 3 |
| Cedric Hombourger | c****r@s****m | 3 |
| Marc Abramowitz | m****c@m****m | 3 |
| Omer Katz | o****w@g****m | 3 |
| Tim Gates | t****s@i****m | 2 |
| Guy Rozendorn | g****y@r****l | 2 |
| Solomon Hykes | s****n@d****m | 2 |
| Max Persson | m****x@m****m | 2 |
| Alex Long | s****k@g****m | 1 |
| Alexander Else | a****e@e****u | 1 |
| Bartosz | e****s@g****m | 1 |
| Calen Pennington | c****n@g****m | 1 |
| Dan Rowles | d****s@w****m | 1 |
| Samuel Killin | s****m@c****m | 1 |
| Nick Allen | n****n@f****m | 1 |
| David Antliff | d****f@a****m | 1 |
| JJ Geewax | jj@g****g | 1 |
| John Costa | j****a@g****m | 1 |
| Jędrzej Nowak | m****l@j****l | 1 |
| Lorenzo Villani | l****o@v****e | 1 |
| and 7 more... | ||
Committer Domains (Top 20 + Academic)
dotcloud.com: 3
enix.org: 1
kalessin.fr: 1
gmx.org: 1
ele.me: 1
linkedin.com: 1
infinidat.com: 1
siemens.com: 1
marc-abramowitz.com: 1
iress.com: 1
rzn.co.il: 1
maxpersson.com: 1
else.id.au: 1
webfilings.com: 1
canva.com: 1
foregroundsecurity.com: 1
aviatnet.com: 1
geewax.org: 1
jedrzejnowak.pl: 1
villani.me: 1
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 89
- Total pull requests: 23
- Average time to close issues: about 1 year
- Average time to close pull requests: 12 months
- Total issue authors: 77
- Total pull request authors: 14
- Average comments per issue: 2.31
- Average comments per pull request: 2.04
- Merged pull requests: 13
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 6
- Pull requests: 0
- Average time to close issues: 4 minutes
- Average time to close pull requests: N/A
- Issue authors: 5
- Pull request authors: 0
- Average comments per issue: 1.5
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- pinkynrg (3)
- kloczek (2)
- ghost (2)
- zhangjustin (2)
- tirkarthi (2)
- zyi1992 (2)
- leecodedog (2)
- ddhq (2)
- inventionlabsSydney (2)
- cupen (2)
- devzzzero (2)
- kimi0421 (1)
- matthewbalvanz-wf (1)
- axfelix (1)
- ligangbin117 (1)
Pull Request Authors
- chombourger (6)
- timgates42 (3)
- shiplu (3)
- kloczek (1)
- chu8129 (1)
- eruvanos (1)
- withtwoemms (1)
- xelagnol (1)
- DavidAntliff (1)
- nom3ad (1)
- JNevrly (1)
- himanshu4code (1)
- postpop (1)
- scorpioWalker (1)
Top Labels
Issue Labels
faq (12)
bug (4)
asyncblocked (4)
question (3)
enhancement (2)
appreciation (1)
Pull Request Labels
enhancement (1)
Packages
- Total packages: 2
-
Total downloads:
- pypi 12,650 last-month
- Total docker downloads: 619
-
Total dependent packages: 11
(may contain duplicates) -
Total dependent repositories: 243
(may contain duplicates) - Total versions: 18
- Total maintainers: 1
pypi.org: zerorpc
zerorpc is a flexible RPC based on zeromq.
- Homepage: https://github.com/0rpc/zerorpc-python
- Documentation: https://zerorpc.readthedocs.io/
- License: MIT
-
Latest release: 0.6.3
published about 7 years ago
Rankings
Dependent packages count: 0.8%
Dependent repos count: 1.0%
Stargazers count: 1.3%
Average: 1.7%
Docker downloads count: 2.1%
Downloads: 2.5%
Forks count: 2.6%
Maintainers (1)
Last synced:
10 months ago
conda-forge.org: zerorpc-python
zerorpc is a flexible RPC implementation based on zeromq and messagepack. Service APIs exposed with zerorpc are called "zeroservices".
- Homepage: https://github.com/0rpc/zerorpc-python
- License: MIT
-
Latest release: 0.6.3
published about 4 years ago
Rankings
Stargazers count: 6.7%
Forks count: 7.8%
Average: 17.0%
Dependent packages count: 19.5%
Dependent repos count: 34.0%
Last synced:
11 months ago