aChain
Library used for chaining together synchronous and asynchronous functions for data transformation
What does this do?
The achain.Chain class allows for the construction of chained synchronous and asynchronous functions
Example:
import typing
import json
from datetime import datetime, timedelta
from achain import Chain
SERVICE_URL = "https://www.service.com/api"
"""The address of some service containing data of interest"""
async def get_data(url, **kwargs) -> str:
"""
Gets raw text from the given URL with the given query parameters
"""
...
def normalize_data(
data: typing.Dict[str, typing.Any]
) -> typing.Dict[str, typing.Dict[str, typing.Any]]:
"""
Transforms the passed data into one that is easier to deserialize
"""
...
class ExampleClass:
"""
An example of a class that may be constructed from the generated data
"""
def __init__(self, **kwargs):
"""Constructor"""
...
async def main():
"""
Create lists of remote data
"""
# Declare your chain
chain: Chain[typing.List[ExampleClass]] = Chain(
get_data,
url=SERVICE_URL
).then(
json.loads
).then(
normalize_data
).then(
lambda data: [ExampleClass(**values) for values in data.values()]
)
# Call Asynchronously
yesterdays_data: typing.List[ExampleClass] = await chain(
start=datetime.now() - timedelta(hours=48),
end=datetime.now() - timedelta(hours=24)
)
# Call Synchronously
todays_data: typing.List[ExampleClass] = chain.execute_synchronously(
start=datetime.now() - timedelta(hours=24),
end=datetime.now
)
Metadata
Release files for achain 0.1.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 | |
|---|---|---|---|---|
| achain-0.1.1.tar.gz | 15.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| achain-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.7 kB
Release files / achain-0.1.1.tar.gz
| Download URL | achain-0.1.1.tar.gz |
|---|---|
| Size | 15.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2f545d3f50c8326e6f4a2b4c855cd0718971afe0afc0a537e0b13af0994d50a4
|
|
BLAKE2b-256 checksum How to use checksums |
841684d67411f2f514d3ae45233e444d272ff8edc0be9ff561a2040b8f141ecf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|
Release files / achain-0.1.1-py3-none-any.whl
| Download URL | achain-0.1.1-py3-none-any.whl |
|---|---|
| Size | 15.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
982138a512cc1fd02f665c719e629da3c2f19019a385eb6da6e876b79482630e
|
|
BLAKE2b-256 checksum How to use checksums |
fad151e772fc81043aea94070a639ff6a401cd86c1fa90b05f61985eaae8e2bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|
Security for achain 0.1.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.