Aether Python Library
This is the official Python Library with Aether functions.
Table of contents
Requirements
This library requires Python 3.6 and above.
Python libraries:
- eha-jsonpath Provides new Extensions to the jsonpath_ng python library to provide commonly requested functions.
- jsonschema An implementation of JSON Schema validation for Python.
- redis Python client for Redis key-value store.
- requests HTTP for Humans.
- spavro An Avro library, Spavro is a (sp)eedier avro implementation using Cython.
Extra dependencies (based on settings):
- test
- birdisle A modified version of redis that runs as a library inside another process.
- coverage A tool for measuring code coverage of Python programs.
- flake8 Tool For Style Guide Enforcement.
- flake8-quotes Flake8 extension for checking quotes in python.
- tblib Traceback serialization library.
Installation
# standalone
pip3 install aether.python
Distribution
How to create the package distribution
Execute the following command:
python3 setup.py bdist_wheel
or
./scripts/build.sh
Tests
Depending on your preference you can either use virtualenv or pipenv to test the library locally.
Virtual Env
First install dependencies (execute it only once):
./scripts/install.sh
After that execute the following command:
source ./venv/bin/activate
./scripts/test.sh
Pipenv
In the root folder run:
pipenv install .
Then to test run:
pipenv run scripts/test.sh
The file scripts/test.ini contains the environment variables used in the tests.
Usage
Redis Tools
This provides an interface to a Redis server via supplied redis parameters.
It makes available a number of CRUD redis operation which include but not limited to:
- Formats document keys into _{type}:{tenant}:{id} before being cached on redis.
- Retrieves documents based on preformated keys.
- Removes documents based on preformated keys.
- Subscribes to key based channels with a callback function.
Usage
from aether.python.redis.task import TaskHelper
REDIS_TASK = TaskHelper(settings, redis_instance)
# Settings must have the following properties:
# REDIS_HOST str - Redis server host,
# REDIS_PORT int - Redis server port,
# REDIS_PASSWORD str - Redis server password,
# REDIS_DB str - Redis database name
# redis_instance (Optional) - Pass an existing redis connection
# (If provided, ignores all settings and uses redis_instance)
document = {
'id': 'document_id',
'name': 'document name'
}
document_type = 'test_document'
aether_tenant = 'prod'
# add document to redis
REDIS_TASK.add(task=document, type=document_type, tenant=aether_tenant)
# retrieve document from redis
REDIS_TASK.get(_id=document['id'], type=document_type, tenant=aether_tenant)
# subcribe to a key based channel
CHANNEL = '_test_document*' # listens for messages published to all channels starting with '_test_document'
def handle_callback(msg):
print(msg) # handle returned message
REDIS_TASK.subscribe(callback=handle_callback, pattern=CHANNEL, keep_alive=True)
# publish document
REDIS_TASK.publish(task=document, type=document_type, tenant=aether_tenant) # this will trigger the 'handle_callback' function with the published document to all subscribed clients
Metadata
Release files for aether.python 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aether.python-1.3.0-py3-none-any.whl | Python 3 | none | any | Details for aether.python-1.3.0-py3-none-any.whl |
Release files / aether.python-1.3.0-py3-none-any.whl
| Download URL | aether.python-1.3.0-py3-none-any.whl |
|---|---|
| Size | 38.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1163e1728d4267b3ae656ee6c386477ec24e9896759ce69b829e739e78969d6f
|
|
BLAKE2b-256 checksum How to use checksums |
d75244d118f94f3cf61d5d580bf18f5b675dc4b38bd489296f5771474827e2a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0.post20201221 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.1
|
Security for aether.python 1.3.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.