Metadata-Version: 2.4
Name: py-autowired
Version: 0.2.1
Summary: Runtime dependency injection through self.x_instance = None
Author: Ayhan Öztemel
License-Expression: MIT
Project-URL: Homepage, https://github.com/AyhanOztemel/py-autowired
Project-URL: Repository, https://github.com/AyhanOztemel/py-autowired
Project-URL: Documentation, https://github.com/AyhanOztemel/py-autowired#readme
Project-URL: Issues, https://github.com/AyhanOztemel/py-autowired/issues
Keywords: dependency-injection,autowiring,fastapi,flask,django
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: twine>=6; extra == "dev"
Provides-Extra: examples
Requires-Dist: django>=5.1; extra == "examples"
Requires-Dist: fastapi>=0.115; extra == "examples"
Requires-Dist: flask>=3.1; extra == "examples"
Requires-Dist: httpx2>=2.0; extra == "examples"
Requires-Dist: uvicorn>=0.30; extra == "examples"
Dynamic: license-file

# py-autowired

py-autowired injects runtime dependencies into fields declared with one rule:

```python
class UserService:
    def __init__(self):
        self.user_repository_instance = None
```

Application code contains no manual dependency-resolution calls. Register
the services once and call `auto_inject()` once during startup.

```python
from py_autowired.autowired import auto_inject
from py_autowired.container import Container

container = Container()
container.register_scoped(IUserRepository, SqliteUserRepository)
container.register_transient(UserService)
auto_inject(container, root_dir="/absolute/path/to/project")

with container.create_scope():
    service = UserService()
    print(service.user_repository_instance)
```

## Runtime package

The installed runtime contains only:

```text
py_autowired/
  autowired.py
  container.py
```

Python namespace packages make `__init__.py` unnecessary.

## Frameworks

The same core works with Console, FastAPI/ASGI, Flask/WSGI and Django. Framework
examples are under `examples/`; each uses domain, application, infrastructure,
composition and presentation layers without manual dependency resolution.

See [KULLANIM_KILAVUZU_TR.md](KULLANIM_KILAVUZU_TR.md) and
[USAGE_GUIDE_EN.md](USAGE_GUIDE_EN.md).
