Service-it
Turn any Python function into a service that receives JSON payloads on some port.
Here’s a trivial example:
import serviceit
def receiver(payload):
print(payload)
server = serviceit.server(1533, receiver)
# Now it will receive JSON on 1533. For convenience:
server.client().send(dict(message="hi"))
print(server.bytes_processed)
More complex example: isolate code
You can use this to isolate a component of you code. For example, rdkit can be installed through Conda but not Pip (or Poetry). So, create a service and import it in an Anaconda environment to create a server, and in your pip-installed client code.
In a Conda environment, create a service that listens on port 1533:
import serviceit
def _receiver(payload):
# noinspection PyUnresolvedReferences
from rdkit.Chem.inchi import InchiToInchiKey
inchikey = InchiToInchiKey(payload["inchi"])
print(inchikey)
server = serviceit.server(1533, _receiver)
On your pip-install client side:
import serviceit
client = serviceit.client(1533)
client.send(dict(inchi="InChI=1S/H2O/h1H2"))
New issues and pull requests are welcome.
Please refer to the contributing guide.
Generated with Tyrannosaurus.
Metadata
Release files for serviceit 0.2.0
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 | |
|---|---|---|---|---|
| serviceit-0.2.0.tar.gz | 11.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| serviceit-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.7 kB
Release files / serviceit-0.2.0.tar.gz
| Download URL | serviceit-0.2.0.tar.gz |
|---|---|
| Size | 11.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f7e257b5d0b9db07aad76750a5462a5bd49c119f35fe825462b831f0428539e0
|
|
BLAKE2b-256 checksum How to use checksums |
9a5b17435d0b3be0af5d92d3eab94b2315a1891323fe3bf93c0b38bea8de36ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.6 CPython/3.9.4 Linux/5.4.0-1043-azure
|
Release files / serviceit-0.2.0-py3-none-any.whl
| Download URL | serviceit-0.2.0-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fadb7050a9ff471a3ef69b462d3bbc0d71c52b976fc69af7041252e14a2986f3
|
|
BLAKE2b-256 checksum How to use checksums |
c7dd8dc9ef87706dfe4e19c2feb1f38bbb1ecf15073a58e806cb38ba48db37fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.6 CPython/3.9.4 Linux/5.4.0-1043-azure
|
Security for serviceit 0.2.0
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.