OOZE - Brain-dead simple dependency injection
Ooze is an attempt to do depdency injection in Python in the simplest way possible. It embraces Python decorators to leverage what classes, functions, and even static values are included in the dependency injection graph. You can get started in three easy steps:
- decorate your functions, classes and/or variable items
- assign a startup function
- call ooze's
run()function
That's it! Here's a quick example:
import ooze
@ooze.provide # Inject as 'upper_case' since a name wasn't specified
def upper_case(string):
return string.upper()
ooze.provide_static('address', { # Inject a static dictionary, naming it 'address'
"name": "Steve",
"gender": "male"
})
@ooze.provide('greeter') # Inject as 'greeter'
class WelcomeWagon:
def __init__(self, upper_case, address):
self.address = address
self.upper = upper_case
def greet(self):
return self.upper(f"Hello {self.address['name']}")
@ooze.startup # Define where ooze should start running your program
def main(greeter):
print(greeter.greet())
if __name__ == '__main__':
ooze.run()
Installing Ooze
Installing Ooze is as simple as using pip:
$ pip install ooze
Usage Notes
Ooze has many features beyond what is demonstrated in the above sample code including:
- factories
- automatic environment variable injection
- automatic configuration file parsing and settings injection
- automatic (magic) integration with manually passed arguments
- seamless integration with bottlepy
- injectable object pools (i.e. Database connection pools)
Be sure to check out the documentation or examples for more information.
Metadata
Release files for ooze 1.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 | Actions |
|---|---|---|---|---|
| ooze-1.0.1.tar.gz | 42.9 kB | Without provenance | Details for ooze-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ooze-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for ooze-1.0.1-py3-none-any.whl |
Total release size: 72.1 kB
Release files / ooze-1.0.1.tar.gz
| Download URL | ooze-1.0.1.tar.gz |
|---|---|
| Size | 42.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8b5844cfbe05d8db20e53fddd7943f7e193e29ecdf77721d5290dbd2c54269ce
|
|
BLAKE2b-256 checksum How to use checksums |
2dcb3f1d49c38524c09a9244047d706c96249871c8306d996b738605663bf1ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.16
|
Release files / ooze-1.0.1-py3-none-any.whl
| Download URL | ooze-1.0.1-py3-none-any.whl |
|---|---|
| Size | 29.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b37bbef1f8e9855402608fa19516315fe1e06a8b06fe579a14aefe534e5571f2
|
|
BLAKE2b-256 checksum How to use checksums |
623c09f71a56f7b688a6b9e37b9f419a39d3f992ee09b919cfe92728bfa1e59c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.16
|
Security for ooze 1.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.