Supplier: Python library for passing values deeply, easily!
Have you ever had a piece of configuration that you want access to deeply in a function, but you don't want to always have to pass it, and you don't want to have a singleton?
This is for you!
Example
from supplier import Supplier, supply
config_supplier = Supplier('config')
def outer_function():
inner_function()
@supply(config_supplier)
def inner_function(config):
do_something_based_on(config)
with config_supplier.use(Config()):
outer_function()
This is essentially python contextvars + contextlib in one convenient package
@supply allows multiple function arguments
Supplier prepends the function's arguments with the supplied value.
@supply(foo_supplier)
def func_with_args(foo, arg1, arg2):
print(foo, arg1, arg2)
with foo_supplier.use("foo"):
func_with_args("arg1", "arg2")
@supply works with multiple suppliers
You can supply multiple variables simultaneously.
@supply(foo_supplier, bar_supplier)
def doubly_provided_func(foo, bar, arg):
print(foo, bar, arg)
with foo_supplier.use("foo"), bar_supplier.use("bar"):
doubly_provided_func("arg")
Metadata
Release files for supplier 0.0.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 | |
|---|---|---|---|---|
| supplier-0.0.1.tar.gz | 2.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| supplier-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.9 kB
Release files / supplier-0.0.1.tar.gz
| Download URL | supplier-0.0.1.tar.gz |
|---|---|
| Size | 2.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
868a89b125d1cec9f0585d345bd81441a0a51ebc266304185c052d7c23b7791e
|
|
BLAKE2b-256 checksum How to use checksums |
340475a94f9bc7e3feb594b94ab9bbe3ea43f68843cd1a61521d260c4f3f9427
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.3
|
Release files / supplier-0.0.1-py3-none-any.whl
| Download URL | supplier-0.0.1-py3-none-any.whl |
|---|---|
| Size | 2.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
41dca093e58527f23052b38b35f835257382941554091f0bdd318c122d08d9a7
|
|
BLAKE2b-256 checksum How to use checksums |
95f0283274ff1a84ac39fdb100294f4ce5621ef5cf7d6b90199910e1da7f8119
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.3
|
Security for supplier 0.0.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.