Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring #8

Merged
merged 12 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,31 @@

Simple Dependency Injection for Python


## Features

- Add yours!

Experimental dependency injection library for Python. Use it at your own risk.

## Installation

```bash
pip install nanodi
```


## Example

Showcase how your project can be used:

```python
from nanodi.example import some_function
from nanodi import inject, Provide


def get_redis() -> str:
yield "redis"
print("closing redis")


@inject
def get_storage_service(redis: str = Provide(get_redis)) -> str:
return f"storage_service({redis})"


print(some_function(3, 4))
# => 7
assert get_storage_service() == "storage_service(redis)"
```

## License
Expand Down
4 changes: 2 additions & 2 deletions nanodi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from nanodi.nanodi import Depends, inject, resource, shutdown_resources
from nanodi.nanodi import Provide, init_resources, inject, resource, shutdown_resources

__all__ = ["Depends", "inject", "shutdown_resources", "resource"]
__all__ = ["Provide", "inject", "init_resources", "shutdown_resources", "resource"]
Loading
Loading