NodNod
🧑🧑🧒🧒
about
nodnod is a dependency injection tool
nodnod strives to be effective and simple: it has many agents, but, for example, asyncio agent turns each dependency into a coroutine and yields decomposed dependency net to your loop to solve it the best way possible
nodnod is easy to integrate, be it a framework or a small project
interfaces
composing a set of dependencies is as simple as:
async def main():
agent = EventLoopAgent.build({Username})
async with Scope() as scope:
scope.inject(User, User(id=1, username=Some("arseni")))
await agent.run(scope, {})
print(scope[Username])
two objects that define compile-time and runtime are agent and Scope.
- agent precompiles the dependency graph
- scope contains dependency roots and defines dependency visibility within one scope. many scopes can be linked in the manner of parent-child or global-local relation. dependencies are made accessible within different scopes
nodnod provides many interfaces to build different kinds of dependencies:
-
polymorphic - node whose resolution may vary
@polymorphic[float] class Ratio: @case def from_video(cls, video: Video) -> float: frame = video.frames[0] return frame.width / frame.length @case def from_photo(cls, photo: Photo) -> float: return photo.width / photo.length
-
scalar node disguises as its result for type checkers
@scalar_node class Username: @classmethod def __compose__(cls, user: User) -> str: return user.username.map_error(lambda _: f"#{user.id}")
-
logical or
@classmethod def __compose__(cls, dep: One | Another) -> ...: ...
- can be concurrent: two nodes are racing to deliver their resolution
- or sequential: if first resolution fails, next one is triggered
-
kungfu funtional types are supported:
Exceptions can be intercepted:
@classmethod def __compose__(cls, weather: Result[Weather, ConnectionError)): ...
Dependencies can be optional:
@classmethod def __compose__(cls, ratio: Option[Ratio]): ...
your contributions are welcome!
🌺
Metadata
Release files for nodnod 1.2.0
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 |
|---|---|---|---|---|
| nodnod-1.2.0.tar.gz | 157.3 kB | Without provenance | Details for nodnod-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nodnod-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for nodnod-1.2.0-py3-none-any.whl |
Total release size: 199.0 kB
Release files / nodnod-1.2.0.tar.gz
| Download URL | nodnod-1.2.0.tar.gz |
|---|---|
| Size | 157.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f865fa3a4d8cb3ba2f9de95d85fefb3daecb3aee77b4c79668f64cfa50bb5e1c
|
|
BLAKE2b-256 checksum How to use checksums |
de86dec2b6af46f2964d45206a65924b117dd2e6071fb726fdacb271f7a332ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / nodnod-1.2.0-py3-none-any.whl
| Download URL | nodnod-1.2.0-py3-none-any.whl |
|---|---|
| Size | 41.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
846db4f7b171b3f0826bd28adf1be9e04b39fbee16fc33f1217839621eee9561
|
|
BLAKE2b-256 checksum How to use checksums |
a47889c7a4aa494ef2c899d76877e08ee94075f4898c9b5dbd1ff1919e9fe050
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for nodnod 1.2.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.