engin 0.0.1__tar.gz → 0.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {engin-0.0.1 → engin-0.0.2}/CHANGELOG.md +7 -0
- engin-0.0.2/PKG-INFO +56 -0
- engin-0.0.2/README.md +48 -0
- {engin-0.0.1 → engin-0.0.2}/examples/fastapi/app.py +2 -1
- {engin-0.0.1 → engin-0.0.2}/examples/fastapi/routes/cats/api.py +1 -1
- {engin-0.0.1 → engin-0.0.2}/pyproject.toml +1 -1
- {engin-0.0.1 → engin-0.0.2}/src/engin/__init__.py +2 -0
- {engin-0.0.1 → engin-0.0.2}/src/engin/_engin.py +0 -4
- engin-0.0.2/uv.lock +482 -0
- engin-0.0.1/PKG-INFO +0 -5
- engin-0.0.1/README.md +0 -0
- engin-0.0.1/uv.lock +0 -478
- {engin-0.0.1 → engin-0.0.2}/.github/workflows/check.yaml +0 -0
- {engin-0.0.1 → engin-0.0.2}/.github/workflows/publish.yaml +0 -0
- {engin-0.0.1 → engin-0.0.2}/.gitignore +0 -0
- {engin-0.0.1 → engin-0.0.2}/LICENSE +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/__init__.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/asgi/__init__.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/asgi/app.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/asgi/common/__init__.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/asgi/common/db/__init__.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/asgi/common/db/adapaters/__init__.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/asgi/common/db/adapaters/memory.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/asgi/common/db/block.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/asgi/common/db/ports.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/asgi/common/starlette/__init__.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/asgi/common/starlette/endpoint.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/asgi/features/__init__.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/asgi/features/cats/__init__.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/asgi/features/cats/api/__init__.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/asgi/features/cats/api/get.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/asgi/features/cats/api/post.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/asgi/features/cats/block.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/asgi/features/cats/domain.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/asgi/main.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/fastapi/__init__.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/fastapi/main.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/fastapi/routes/__init__.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/fastapi/routes/cats/__init__.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/fastapi/routes/cats/adapters/__init__.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/fastapi/routes/cats/adapters/repository.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/fastapi/routes/cats/block.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/fastapi/routes/cats/domain.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/fastapi/routes/cats/ports.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/simple/__init__.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/examples/simple/main.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/src/engin/_assembler.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/src/engin/_block.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/src/engin/_dependency.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/src/engin/_exceptions.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/src/engin/_lifecycle.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/src/engin/_type_utils.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/src/engin/ext/__init__.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/src/engin/ext/asgi.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/src/engin/ext/fastapi.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/src/engin/py.typed +0 -0
- {engin-0.0.1 → engin-0.0.2}/tests/__init__.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/tests/conftest.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/tests/deps.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/tests/test_assembler.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/tests/test_dependencies.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/tests/test_engin.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/tests/test_modules.py +0 -0
- {engin-0.0.1 → engin-0.0.2}/tests/test_utils.py +0 -0
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## [0.0.2] - 2025-01-10
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- The `ext` sub-package is now explicitly exported in the package `__init__.py`
|
13
|
+
|
14
|
+
|
8
15
|
## [0.0.1] - 2024-12-12
|
9
16
|
|
10
17
|
### Added
|
engin-0.0.2/PKG-INFO
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: engin
|
3
|
+
Version: 0.0.2
|
4
|
+
Summary: An async-first modular application framework
|
5
|
+
License-File: LICENSE
|
6
|
+
Requires-Python: >=3.10
|
7
|
+
Description-Content-Type: text/markdown
|
8
|
+
|
9
|
+
# Engin 🏎️
|
10
|
+
|
11
|
+
Engin is a zero-dependency application framework for modern Python.
|
12
|
+
|
13
|
+
## Features ✨
|
14
|
+
|
15
|
+
- **Lightweight**: Engin has no dependencies.
|
16
|
+
- **Async First**: Engin provides first-class support for applications.
|
17
|
+
- **Dependency Injection**: Engin promotes a modular decoupled architecture in your application.
|
18
|
+
- **Lifecycle Management**: Engin provides an simple, portable approach for implememting
|
19
|
+
startup and shutdown tasks.
|
20
|
+
- **Ecosystem Compatability**: seamlessly integrate with frameworks such as FastAPI without
|
21
|
+
having to migrate your dependencies.
|
22
|
+
- **Code Reuse**: Engin's modular components work great as packages and distributions. Allowing
|
23
|
+
low boiler-plate code reuse within your Organisation.
|
24
|
+
|
25
|
+
## Installation
|
26
|
+
|
27
|
+
Engin is available on PyPI, install using your favourite dependency manager:
|
28
|
+
|
29
|
+
- **pip**:`pip install engin`
|
30
|
+
- **poetry**: `poetry add engin`
|
31
|
+
- **uv**: `uv add engin`
|
32
|
+
|
33
|
+
## Getting Started
|
34
|
+
|
35
|
+
A minimal example:
|
36
|
+
|
37
|
+
```python
|
38
|
+
import asyncio
|
39
|
+
|
40
|
+
from httpx import AsyncClient
|
41
|
+
|
42
|
+
from engin import Engin, Invoke, Provide
|
43
|
+
|
44
|
+
|
45
|
+
def httpx_client() -> AsyncClient:
|
46
|
+
return AsyncClient()
|
47
|
+
|
48
|
+
|
49
|
+
async def main(http_client: AsyncClient) -> None:
|
50
|
+
print(await http_client.get("https://httpbin.org/get"))
|
51
|
+
|
52
|
+
engin = Engin(Provide(httpx_client), Invoke(main))
|
53
|
+
|
54
|
+
asyncio.run(engin.run())
|
55
|
+
```
|
56
|
+
|
engin-0.0.2/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# Engin 🏎️
|
2
|
+
|
3
|
+
Engin is a zero-dependency application framework for modern Python.
|
4
|
+
|
5
|
+
## Features ✨
|
6
|
+
|
7
|
+
- **Lightweight**: Engin has no dependencies.
|
8
|
+
- **Async First**: Engin provides first-class support for applications.
|
9
|
+
- **Dependency Injection**: Engin promotes a modular decoupled architecture in your application.
|
10
|
+
- **Lifecycle Management**: Engin provides an simple, portable approach for implememting
|
11
|
+
startup and shutdown tasks.
|
12
|
+
- **Ecosystem Compatability**: seamlessly integrate with frameworks such as FastAPI without
|
13
|
+
having to migrate your dependencies.
|
14
|
+
- **Code Reuse**: Engin's modular components work great as packages and distributions. Allowing
|
15
|
+
low boiler-plate code reuse within your Organisation.
|
16
|
+
|
17
|
+
## Installation
|
18
|
+
|
19
|
+
Engin is available on PyPI, install using your favourite dependency manager:
|
20
|
+
|
21
|
+
- **pip**:`pip install engin`
|
22
|
+
- **poetry**: `poetry add engin`
|
23
|
+
- **uv**: `uv add engin`
|
24
|
+
|
25
|
+
## Getting Started
|
26
|
+
|
27
|
+
A minimal example:
|
28
|
+
|
29
|
+
```python
|
30
|
+
import asyncio
|
31
|
+
|
32
|
+
from httpx import AsyncClient
|
33
|
+
|
34
|
+
from engin import Engin, Invoke, Provide
|
35
|
+
|
36
|
+
|
37
|
+
def httpx_client() -> AsyncClient:
|
38
|
+
return AsyncClient()
|
39
|
+
|
40
|
+
|
41
|
+
async def main(http_client: AsyncClient) -> None:
|
42
|
+
print(await http_client.get("https://httpbin.org/get"))
|
43
|
+
|
44
|
+
engin = Engin(Provide(httpx_client), Invoke(main))
|
45
|
+
|
46
|
+
asyncio.run(engin.run())
|
47
|
+
```
|
48
|
+
|
@@ -3,7 +3,7 @@ from typing import Annotated
|
|
3
3
|
from fastapi import APIRouter
|
4
4
|
from pydantic import BaseModel
|
5
5
|
|
6
|
-
from engin.
|
6
|
+
from engin.ext.fastapi import Inject
|
7
7
|
from examples.fastapi.routes.cats.domain import Cat, CatPersonality
|
8
8
|
from examples.fastapi.routes.cats.ports import CatRepository
|
9
9
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
from engin import ext
|
1
2
|
from engin._assembler import Assembler
|
2
3
|
from engin._block import Block, invoke, provide
|
3
4
|
from engin._dependency import Entrypoint, Invoke, Provide, Supply
|
@@ -16,6 +17,7 @@ __all__ = [
|
|
16
17
|
"Option",
|
17
18
|
"Provide",
|
18
19
|
"Supply",
|
20
|
+
"ext",
|
19
21
|
"invoke",
|
20
22
|
"provide",
|
21
23
|
]
|
@@ -35,13 +35,9 @@ class Engin:
|
|
35
35
|
async def run(self):
|
36
36
|
await self.start()
|
37
37
|
|
38
|
-
# lifecycle startup
|
39
|
-
|
40
38
|
# wait till stop signal recieved
|
41
39
|
await self._stop_event.wait()
|
42
40
|
|
43
|
-
# lifecycle shutdown
|
44
|
-
|
45
41
|
async def start(self) -> None:
|
46
42
|
LOG.info("starting engin")
|
47
43
|
assembled_invocations: list[AssembledDependency] = [
|