A Python library for writing (micro)services and their clients
Project description
PySOA is a general-purpose library for writing fast Python (micro)services and their clients, based on an RPC (remote procedure call) calling style. It provides both a client and a server, which can be used directly by themselves or, as we do, extended with extra functionality (our authentication, database routing, and other code is written as private middleware and runs on top of this library).
PySOA uses the concept of pluggable “transports” to define a layer for sending requests and responses (messages) between clients and servers. The default, production-ready included transport is a Redis pub-sub layer, which we use in combination with Redis Sentinel in clusters. A single Redis cluster is capable of handling tens of thousands of PySOA messages per second with extremely efficient and desirable load-balancing properties. There is also a local transport implementation primarily used for testing and demonstration but capable of being used in production where appropriate.
Basic Tenets
Services and actions both have simple names, and are called from the client by name. You can call actions individually, or bundle multiple action calls into a “job” to be run serially (either aborting or continuing on error).
Requests and responses are simply Python dictionaries, and PySOA uses our open source validation framework Conformity in order to verify their schema on the way in and out.
Message bodies are encoded using MessagePack by default (however, you can define your own serializer), with a few non-standard types encoded using MessagePack extensions, such as dates, times, date-times, and amounts of currency (using our open source currint library).
Requests have a context, which is sourced from the original client context (web request, API request, etc.) and automatically chained down into subsequent client calls made inside the service. This is used for contextual request information like correlation IDs, authentication tokens, locales, etc.
We include “SOA Switches” as a first-party implementation of feature flags/toggles. Part of the context, they are bundled along with every request and automatically chained, and are packed as integers to ensure they have minimal overhead.
This intro summarizes some of the key concepts of using PySOA. For more thorough documentation, see the PySOA Documentation.
License
PySOA is licensed under the Apache License, version 2.0.
Installation
PySOA is available in PyPi and can be installing directly via Pip or listed in setup.py, requirements.txt, or Pipfile:
pip install 'pysoa~=0.73'
install_requires=[
...
'pysoa~=0.73',
...
]
pysoa~=0.73
pysoa = {version="~=0.73"}
Documentation
The complete PySOA documentation is available on Read the Docs!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pysoa-1.1.5.tar.gz
.
File metadata
- Download URL: pysoa-1.1.5.tar.gz
- Upload date:
- Size: 156.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b68ea415c7301d13688e4fafb69ef95228d7c1aa4b79a7582740b2a96281295a |
|
MD5 | a2e2077b7fe1c018a5efc92b097fc051 |
|
BLAKE2b-256 | bf294498273de0f69a4e93948ed29f0ffbb8eb601a46098f03ada673fd4fd536 |
File details
Details for the file pysoa-1.1.5-py27.py35.py36.py37.py38-none-any.whl
.
File metadata
- Download URL: pysoa-1.1.5-py27.py35.py36.py37.py38-none-any.whl
- Upload date:
- Size: 192.9 kB
- Tags: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43cae4b81848eb29506dc5000fb37a3be6a601065f19ead9c2802d4a2e5b99ca |
|
MD5 | 299375416341733b6fdeda7344493bf0 |
|
BLAKE2b-256 | f9450a5ee55d92271a82737f375163a2fc5f4c1b92f0594e58626086a1026591 |