pico-ioc 2.1.1__tar.gz → 2.1.3__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.
- pico_ioc-2.1.3/.github/workflows/docs.yml +104 -0
- pico_ioc-2.1.3/CHANGELOG.md +284 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/PKG-INFO +128 -59
- pico_ioc-2.1.3/README.md +311 -0
- pico_ioc-2.1.3/docs/LEARN.md +103 -0
- pico_ioc-2.1.3/docs/README.md +154 -0
- pico_ioc-2.1.3/docs/adr/README.md +40 -0
- pico_ioc-2.1.3/docs/adr/adr-0001-async-native.md +91 -0
- pico_ioc-2.1.3/docs/adr/adr-0002-tree-based-configuration.md +63 -0
- pico_ioc-2.1.3/docs/adr/adr-0003-context-aware-scopes.md +107 -0
- pico_ioc-2.1.3/docs/adr/adr-0004-observability.md +35 -0
- pico_ioc-2.1.3/docs/adr/adr-0005-aop.md +44 -0
- pico_ioc-2.1.3/docs/adr/adr-0006-eager-validation.md +106 -0
- pico_ioc-2.1.3/docs/adr/adr-0007-event_bus.md +39 -0
- pico_ioc-2.1.3/docs/adr/adr-0008-circular-dependencies.md +53 -0
- pico_ioc-2.1.3/docs/adr/adr-0009-flexible-provides.md +163 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/docs/adr/adr-0010-unified-configuration.md +25 -26
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/docs/advanced-features/README.md +2 -0
- pico_ioc-2.1.3/docs/advanced-features/aop-interceptors.md +366 -0
- pico_ioc-2.1.3/docs/advanced-features/async-resolution.md +465 -0
- pico_ioc-2.1.3/docs/advanced-features/conditional-binding.md +230 -0
- pico_ioc-2.1.3/docs/advanced-features/event-bus.md +302 -0
- pico_ioc-2.1.3/docs/advanced-features/health-checks.md +172 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/docs/api-reference/README.md +0 -1
- pico_ioc-2.1.3/docs/api-reference/container.md +214 -0
- pico_ioc-2.1.3/docs/api-reference/decorators.md +141 -0
- pico_ioc-2.1.3/docs/api-reference/event_bus.md +140 -0
- pico_ioc-2.1.3/docs/api-reference/glossary.md +126 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/docs/api-reference/protocols.md +30 -31
- pico_ioc-2.1.3/docs/architecture/README.md +64 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/docs/architecture/comparison.md +5 -3
- pico_ioc-2.1.3/docs/architecture/design-principles.md +97 -0
- pico_ioc-2.1.3/docs/architecture/internals.md +204 -0
- pico_ioc-2.1.3/docs/cookbook/README.md +69 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/docs/cookbook/pattern-aop-feature-toggle.md +66 -82
- pico_ioc-2.1.3/docs/cookbook/pattern-aop-profiling.md +168 -0
- pico_ioc-2.1.3/docs/cookbook/pattern-aop-security.md +318 -0
- pico_ioc-2.1.3/docs/cookbook/pattern-aop-structured-logging.md +262 -0
- pico_ioc-2.1.3/docs/cookbook/pattern-cli-app.md +206 -0
- pico_ioc-2.1.3/docs/cookbook/pattern-config-overrides.md +149 -0
- pico_ioc-2.1.3/docs/cookbook/pattern-cqrs.md +245 -0
- pico_ioc-2.1.3/docs/cookbook/pattern-hot-reload.md +285 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/docs/cookbook/pattern-multi-tenant.md +50 -41
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/docs/getting-started.md +41 -31
- pico_ioc-2.1.3/docs/javascripts/extra.js +10 -0
- pico_ioc-2.1.3/docs/observability/README.md +61 -0
- pico_ioc-2.1.3/docs/observability/container-context.md +208 -0
- pico_ioc-2.1.3/docs/observability/exporting-graph.md +129 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/docs/observability/observers-metrics.md +39 -21
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/docs/overview.md +74 -123
- pico_ioc-2.1.3/docs/requirements.txt +6 -0
- pico_ioc-2.1.3/docs/stylesheets/extra.css +53 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/docs/user-guide/README.md +0 -1
- pico_ioc-2.1.3/docs/user-guide/configuration-basic.md +71 -0
- pico_ioc-2.1.3/docs/user-guide/configuration-binding.md +307 -0
- pico_ioc-2.1.3/docs/user-guide/core-concepts.md +344 -0
- pico_ioc-2.1.3/docs/user-guide/qualifiers-lists.md +216 -0
- pico_ioc-2.1.3/docs/user-guide/scopes-lifecycle.md +571 -0
- pico_ioc-2.1.3/docs/user-guide/testing.md +278 -0
- pico_ioc-2.1.3/mkdocs.yml +189 -0
- pico_ioc-2.1.3/src/pico_ioc/_version.py +1 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/src/pico_ioc/analysis.py +47 -5
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/src/pico_ioc/aop.py +52 -17
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/src/pico_ioc/config_runtime.py +5 -2
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/src/pico_ioc/container.py +65 -12
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/src/pico_ioc/event_bus.py +22 -19
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/src/pico_ioc/locator.py +9 -1
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/src/pico_ioc/registrar.py +2 -2
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/src/pico_ioc/scope.py +21 -14
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/src/pico_ioc.egg-info/PKG-INFO +128 -59
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/src/pico_ioc.egg-info/SOURCES.txt +8 -0
- pico_ioc-2.1.3/tests/test_aop.py +121 -0
- pico_ioc-2.1.3/tests/test_collection_injection.py +151 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/tests/test_pico_extends.py +7 -4
- pico_ioc-2.1.3/tests/test_protocol_resolution_and_graph.py +53 -0
- pico_ioc-2.1.3/tests/test_scope.py +128 -0
- pico_ioc-2.1.1/CHANGELOG.md +0 -220
- pico_ioc-2.1.1/README.md +0 -242
- pico_ioc-2.1.1/docs/LEARN.md +0 -1820
- pico_ioc-2.1.1/docs/README.md +0 -84
- pico_ioc-2.1.1/docs/adr/README.md +0 -18
- pico_ioc-2.1.1/docs/adr/adr-0001-async-native.md +0 -31
- pico_ioc-2.1.1/docs/adr/adr-0002-tree-based-configuration.md +0 -33
- pico_ioc-2.1.1/docs/adr/adr-0003-context-aware-scopes.md +0 -39
- pico_ioc-2.1.1/docs/adr/adr-0004-observability.md +0 -35
- pico_ioc-2.1.1/docs/adr/adr-0005-aop.md +0 -31
- pico_ioc-2.1.1/docs/adr/adr-0006-eager-validation.md +0 -32
- pico_ioc-2.1.1/docs/adr/adr-0007-event_bus.md +0 -31
- pico_ioc-2.1.1/docs/adr/adr-0008-circular-dependencies.md +0 -34
- pico_ioc-2.1.1/docs/adr/adr-0009-flexible-provides.md +0 -82
- pico_ioc-2.1.1/docs/advanced-features/aop-interceptors.md +0 -278
- pico_ioc-2.1.1/docs/advanced-features/async-resolution.md +0 -197
- pico_ioc-2.1.1/docs/advanced-features/conditional-binding.md +0 -198
- pico_ioc-2.1.1/docs/advanced-features/event-bus.md +0 -265
- pico_ioc-2.1.1/docs/advanced-features/health-checks.md +0 -137
- pico_ioc-2.1.1/docs/api-reference/container.md +0 -208
- pico_ioc-2.1.1/docs/api-reference/decorators.md +0 -114
- pico_ioc-2.1.1/docs/api-reference/event_bus.md +0 -117
- pico_ioc-2.1.1/docs/api-reference/glossary.md +0 -95
- pico_ioc-2.1.1/docs/architecture/README.md +0 -15
- pico_ioc-2.1.1/docs/architecture/design-principles.md +0 -97
- pico_ioc-2.1.1/docs/architecture/internals.md +0 -207
- pico_ioc-2.1.1/docs/cookbook/README.md +0 -19
- pico_ioc-2.1.1/docs/cookbook/pattern-aop-profiling.md +0 -82
- pico_ioc-2.1.1/docs/cookbook/pattern-aop-security.md +0 -369
- pico_ioc-2.1.1/docs/cookbook/pattern-aop-structured-logging.md +0 -289
- pico_ioc-2.1.1/docs/cookbook/pattern-cli-app.md +0 -207
- pico_ioc-2.1.1/docs/cookbook/pattern-config-overrides.md +0 -99
- pico_ioc-2.1.1/docs/cookbook/pattern-cqrs.md +0 -208
- pico_ioc-2.1.1/docs/cookbook/pattern-hot-reload.md +0 -234
- pico_ioc-2.1.1/docs/observability/README.md +0 -14
- pico_ioc-2.1.1/docs/observability/container-context.md +0 -143
- pico_ioc-2.1.1/docs/observability/exporting-graph.md +0 -99
- pico_ioc-2.1.1/docs/user-guide/configuration-basic.md +0 -71
- pico_ioc-2.1.1/docs/user-guide/configuration-binding.md +0 -211
- pico_ioc-2.1.1/docs/user-guide/core-concepts.md +0 -250
- pico_ioc-2.1.1/docs/user-guide/qualifiers-lists.md +0 -180
- pico_ioc-2.1.1/docs/user-guide/scopes-lifecycle.md +0 -281
- pico_ioc-2.1.1/docs/user-guide/testing.md +0 -216
- pico_ioc-2.1.1/src/pico_ioc/_version.py +0 -1
- pico_ioc-2.1.1/tests/test_scope.py +0 -310
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/.coveragerc +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/.github/workflows/ci.yml +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/.github/workflows/publish-to-pypi.yml +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/LICENSE +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/MANIFEST.in +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/pyproject.toml +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/setup.cfg +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/src/pico_ioc/__init__.py +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/src/pico_ioc/api.py +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/src/pico_ioc/component_scanner.py +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/src/pico_ioc/config_builder.py +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/src/pico_ioc/config_registrar.py +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/src/pico_ioc/constants.py +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/src/pico_ioc/decorators.py +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/src/pico_ioc/dependency_validator.py +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/src/pico_ioc/exceptions.py +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/src/pico_ioc/factory.py +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/src/pico_ioc/provider_selector.py +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/src/pico_ioc.egg-info/dependency_links.txt +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/src/pico_ioc.egg-info/requires.txt +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/src/pico_ioc.egg-info/top_level.txt +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/tests/test_config_value.py +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/tests/test_configured.py +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/tests/test_container_context.py +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/tests/test_container_runtime.py +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/tests/test_container_self_injection.py +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/tests/test_event_bus.py +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/tests/test_pico_integration.py +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/tests/test_provides_module_functions.py +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/tests/test_provides_static_methods.py +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/tests/test_proxy_unit.py +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/tests/test_resolution_graph.py +0 -0
- {pico_ioc-2.1.1 → pico_ioc-2.1.3}/tox.ini +0 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
name: Deploy Documentation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main, master ]
|
|
6
|
+
paths:
|
|
7
|
+
- 'docs/**'
|
|
8
|
+
- 'mkdocs.yml'
|
|
9
|
+
- '.github/workflows/docs.yml'
|
|
10
|
+
pull_request:
|
|
11
|
+
branches: [ main, master ]
|
|
12
|
+
paths:
|
|
13
|
+
- 'docs/**'
|
|
14
|
+
- 'mkdocs.yml'
|
|
15
|
+
workflow_dispatch:
|
|
16
|
+
|
|
17
|
+
permissions:
|
|
18
|
+
actions: read
|
|
19
|
+
contents: write
|
|
20
|
+
pages: write
|
|
21
|
+
id-token: write
|
|
22
|
+
|
|
23
|
+
concurrency:
|
|
24
|
+
group: "pages"
|
|
25
|
+
cancel-in-progress: false
|
|
26
|
+
|
|
27
|
+
jobs:
|
|
28
|
+
validate:
|
|
29
|
+
if: github.event_name == 'pull_request'
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
steps:
|
|
32
|
+
- uses: actions/checkout@v4
|
|
33
|
+
with:
|
|
34
|
+
fetch-depth: 0
|
|
35
|
+
|
|
36
|
+
- uses: actions/setup-python@v5
|
|
37
|
+
with:
|
|
38
|
+
python-version: '3.11'
|
|
39
|
+
cache: 'pip'
|
|
40
|
+
|
|
41
|
+
- name: Install dependencies
|
|
42
|
+
run: |
|
|
43
|
+
pip install --upgrade pip
|
|
44
|
+
pip install -r docs/requirements.txt
|
|
45
|
+
|
|
46
|
+
- name: Validate documentation build
|
|
47
|
+
run: mkdocs build --strict
|
|
48
|
+
|
|
49
|
+
- name: Check for broken links (best-effort)
|
|
50
|
+
run: |
|
|
51
|
+
pip install linkchecker
|
|
52
|
+
python -m http.server --directory site 8000 &
|
|
53
|
+
sleep 3
|
|
54
|
+
linkchecker http://127.0.0.1:8000 --check-extern || true
|
|
55
|
+
|
|
56
|
+
deploy:
|
|
57
|
+
if: github.event_name != 'pull_request'
|
|
58
|
+
runs-on: ubuntu-latest
|
|
59
|
+
environment:
|
|
60
|
+
name: github-pages
|
|
61
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
62
|
+
|
|
63
|
+
steps:
|
|
64
|
+
- uses: actions/checkout@v4
|
|
65
|
+
with:
|
|
66
|
+
fetch-depth: 0
|
|
67
|
+
|
|
68
|
+
- uses: actions/setup-python@v5
|
|
69
|
+
with:
|
|
70
|
+
python-version: '3.11'
|
|
71
|
+
cache: 'pip'
|
|
72
|
+
|
|
73
|
+
- name: Install dependencies
|
|
74
|
+
run: |
|
|
75
|
+
pip install --upgrade pip
|
|
76
|
+
pip install -r docs/requirements.txt
|
|
77
|
+
|
|
78
|
+
- name: Build documentation
|
|
79
|
+
run: |
|
|
80
|
+
mkdocs build --strict --verbose
|
|
81
|
+
echo "Built on $(date -u)" > site/build-info.txt
|
|
82
|
+
echo "Commit: ${{ github.sha }}" >> site/build-info.txt
|
|
83
|
+
|
|
84
|
+
- name: Upload artifact
|
|
85
|
+
uses: actions/upload-pages-artifact@v4
|
|
86
|
+
with:
|
|
87
|
+
path: './site'
|
|
88
|
+
|
|
89
|
+
- name: Deploy to GitHub Pages
|
|
90
|
+
id: deployment
|
|
91
|
+
uses: actions/deploy-pages@v4
|
|
92
|
+
|
|
93
|
+
- name: Comment on commit (optional)
|
|
94
|
+
if: success()
|
|
95
|
+
uses: actions/github-script@v7
|
|
96
|
+
with:
|
|
97
|
+
script: |
|
|
98
|
+
github.rest.repos.createCommitComment({
|
|
99
|
+
owner: context.repo.owner,
|
|
100
|
+
repo: context.repo.repo,
|
|
101
|
+
commit_sha: context.sha,
|
|
102
|
+
body: `✅ Documentation deployed successfully!\n\n📚 View at: ${'${{ steps.deployment.outputs.page_url }}'}`
|
|
103
|
+
})
|
|
104
|
+
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on Keep a Changelog (https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to Semantic Versioning (https://semver.org/spec/v2.0.html).
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## [2.1.3] - 2025-11-18
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- **Critical:** Removed unsafe LRU eviction in `ScopedCaches`. Previously, under high concurrency (e.g., >2048 requests/websockets), active scopes could be evicted, causing data loss and premature cleanup. Scopes now persist until explicitly cleaned up.
|
|
14
|
+
- **Critical:** Fixed a race condition in `UnifiedComponentProxy` (AOP) where the underlying object creation wasn't fully thread-safe.
|
|
15
|
+
- **Critical:** Fixed a race condition in `EventBus.post()` where the queue reference could be lost during shutdown.
|
|
16
|
+
- **Critical:** Fixed `ScopeManager` returning a bucket for `None` IDs, which could cause state leakage between threads/tasks outside of an active context. Now raises `ScopeError`.
|
|
17
|
+
- Fixed `AsyncResolutionError` when accessing `lazy=True` components that require asynchronous `@configure` methods. `aget()` now hydrates proxies immediately if needed.
|
|
18
|
+
- Fixed a swallowed exception in `analyze_callable_dependencies` that hid configuration errors. Now logs debug information.
|
|
19
|
+
- Fixed recursion error in `UnifiedComponentProxy.__setattr__` when setting internal attributes.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
- **Breaking Behavior:** Users using `pico-fastapi` or manual scope management **must** ensure `container.cleanup_scope(...)` is called at the end of the lifecycle to prevent memory leaks, as the automatic LRU safety net has been removed in favor of data integrity.
|
|
23
|
+
- Improved integer configuration parsing to support formats like `1_000` or scientific notation in `config_runtime.py`.
|
|
24
|
+
- `init()` now fails fast with an `AsyncResolutionError` if a component returns an awaitable from a synchronous `@configure` method, instead of just logging a warning.
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
- Architectural support for asynchronous hydration of lazy proxies via `_async_init_if_needed`.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## [2.1.2] - 2025-11-10
|
|
32
|
+
|
|
33
|
+
### Added ✨
|
|
34
|
+
|
|
35
|
+
* **Collection & Mapping Injection:** Constructors can now request collection-like dependencies and dictionaries:
|
|
36
|
+
|
|
37
|
+
* Supported collection origins: `List`, `Set`, `Iterable`, `Sequence`, `Collection`, `Deque` (resolved as concrete **lists** at injection time).
|
|
38
|
+
* Supported mappings: `Dict[K, V]` / `Mapping[K, V]` where `K ∈ {str, type, Any}` and `V` is a component/protocol.
|
|
39
|
+
* `Annotated[..., Qualifier("q")]` on the element type is honored for both collections and dict values.
|
|
40
|
+
* **Element-type analysis for dicts:** Dependency analysis records the dict key type and value element type for correct resolution.
|
|
41
|
+
|
|
42
|
+
### Changed
|
|
43
|
+
|
|
44
|
+
* **Analyzer:** `analyze_callable_dependencies` now recognizes a broader set of `collections.abc` origins for collections and supports dict/mapping shapes, including qualifier propagation from `Annotated` element types.
|
|
45
|
+
* **Container:** Dictionary injection computes keys from component metadata:
|
|
46
|
+
|
|
47
|
+
* `Dict[str, V]` → uses `pico_name` (or string key/fallback to class `__name__`).
|
|
48
|
+
* `Dict[type, V]` → uses the concrete class (or provided type).
|
|
49
|
+
* `Dict[Any, V]` → chooses sensible defaults (`pico_name` → string key → class name).
|
|
50
|
+
* **Type imports & internals:** Expanded typing/runtime imports to support the new analysis and resolution paths.
|
|
51
|
+
|
|
52
|
+
### Fixed 🧩
|
|
53
|
+
|
|
54
|
+
* **Protocol matching:** `ComponentLocator` now checks attribute presence (including annotated attributes), reducing false positives when matching `Protocol` types.
|
|
55
|
+
* **Resolution guard:** `_resolve_args` safely no-ops when the locator is unavailable, avoiding edge-case errors during early initialization.
|
|
56
|
+
|
|
57
|
+
### Docs 📚
|
|
58
|
+
|
|
59
|
+
* **README:** Removed the deprecated *Integrations* entry from the docs index.
|
|
60
|
+
* **Architecture:** Corrected ADR links to `../adr/README.md` and references to the ADR workflow.
|
|
61
|
+
|
|
62
|
+
### Tests 🧪
|
|
63
|
+
|
|
64
|
+
* **New:** `tests/test_collection_injection.py` covering:
|
|
65
|
+
|
|
66
|
+
* Analyzer plans for collections/dicts (including qualifiers).
|
|
67
|
+
* Container resolution of lists/sets/iterables/sequences/deques as lists.
|
|
68
|
+
* Dictionary injection for `Dict[str, V]` and `Dict[type, V]`.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## [2.1.1] - 2025-11-02
|
|
73
|
+
|
|
74
|
+
### Added
|
|
75
|
+
|
|
76
|
+
* ✨ Inline Field Overrides: Added support for overriding configuration fields directly in `@configured` classes using `Annotated[..., Value(...)]` (documented in ADR-0010).
|
|
77
|
+
* Container Self-Injection: `PicoContainer` is now registered as a singleton and can be injected into other components.
|
|
78
|
+
* Flexible `@provides`: `@provides` now supports module-level functions, `@staticmethod`, and `@classmethod` (ADR-0009), allowing for stateless providers without requiring a `@factory` instance.
|
|
79
|
+
* New `websocket` Scope: Added a new default scope named `websocket` to the `ScopeManager`, based on `contextvars`.
|
|
80
|
+
|
|
81
|
+
### Changed
|
|
82
|
+
|
|
83
|
+
* Simplified `custom_scopes` API: `init(custom_scopes=...)` now accepts an `Iterable[str]` of scope names (instead of a dict), automatically registering them as `ContextVarScope`.
|
|
84
|
+
* Strict Async Validation (Singletons): `init()` will now raise a `ConfigurationError` if a non-lazy (eager) singleton requires an async `@configure` method. This forces the developer to either use `aget()` or mark the component as `lazy=True`.
|
|
85
|
+
* Async Validation (Other Scopes): Components with other scopes (e.g., `request`) that have an async `@configure` will now raise an `AsyncResolutionError` if retrieved with `get()` (sync) but will resolve correctly with `aget()` (async).
|
|
86
|
+
|
|
87
|
+
### Fixed
|
|
88
|
+
|
|
89
|
+
* EventBus Thread-Safety: Fixed a bug to ensure `EventBus.post()` is fully thread-safe and correctly handles the worker's event loop context.
|
|
90
|
+
* Lazy Proxy and Async: The `UnifiedComponentProxy` (used for `lazy=True`) now correctly detects async `@configure` methods and raises an `AsyncResolutionError` if resolved synchronously.
|
|
91
|
+
* Python Version: Updated `requires-python` to `>=3.10` to reflect actual dependencies (like `contextvars` and `typing.Annotated`) and prevent installation errors.
|
|
92
|
+
* Internal Wiring: Cleaned up the import flow and internal logic in `api.init()` and `registrar.finalize()`.
|
|
93
|
+
|
|
94
|
+
### Docs
|
|
95
|
+
|
|
96
|
+
* User Guide & ADRs: Updated all documentation (User Guide, Glossary, ADRs) to reflect the unified configuration API (ADR-0010), removing all references to the old `@configuration` decorator.
|
|
97
|
+
* API Reference: Updated the `init()` signature in `container.md` to show the change to `custom_scopes` and document the `validate_only` and `observers` parameters.
|
|
98
|
+
* Simplified `architecture/comparison.md` and corrected minor errors.
|
|
99
|
+
|
|
100
|
+
### Tests
|
|
101
|
+
|
|
102
|
+
* Added `test_container_self_injection.py` to verify container self-injection.
|
|
103
|
+
* Updated assertions in log and stats tests to reflect new eager initialization and scope semantics.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## [2.1.0] - 2025-10-28
|
|
108
|
+
|
|
109
|
+
### Added ✨
|
|
110
|
+
|
|
111
|
+
* Unified Configuration Builder (`configuration(...)`): Introduced a new top-level function `configuration(...)` that accepts various sources (`EnvSource`, `DictSource`, `JsonTreeSource`, `YamlTreeSource`, `FlatDictSource`, etc.) and `overrides` to produce an immutable `ContextConfig` object. This centralizes configuration definition and precedence rules (ADR-0010).
|
|
112
|
+
* `ContextConfig` Object: A new object encapsulating the fully processed configuration state, passed to `init(config=...)`.
|
|
113
|
+
* Enhanced `@configured` Decorator:
|
|
114
|
+
* Added `mapping: Literal["auto", "flat", "tree"]` parameter to explicitly control binding strategy.
|
|
115
|
+
* Implemented `"auto"` detection: uses `"tree"` if any field is complex (dataclass, list, dict, Union), otherwise uses `"flat"`.
|
|
116
|
+
* Supports unified normalization rules for keys (e.g., `ENV_VAR_NAME` <-> `field_name`, `ENV_VAR__NESTED` <-> `parent.nested`).
|
|
117
|
+
* Integrates seamlessly with both flat and tree sources managed by `ContextConfig`.
|
|
118
|
+
|
|
119
|
+
### Changed ⚠️
|
|
120
|
+
|
|
121
|
+
* `init()` Signature: The `config` and `tree_config` parameters have been removed. Configuration is now passed solely through the new `config: Optional[ContextConfig]` parameter (ADR-0010).
|
|
122
|
+
* Configuration Precedence: Configuration loading and precedence are now strictly defined by the order of sources passed to the `configuration(...)` builder, followed by its `overrides` parameter, and finally `Annotated[..., Value(...)]` (ADR-0010).
|
|
123
|
+
|
|
124
|
+
### Removed ❌
|
|
125
|
+
|
|
126
|
+
* `@configuration` Decorator: This decorator, previously used for flat key-value binding, has been completely removed in favor of the unified `@configured` decorator (ADR-0010).
|
|
127
|
+
* Separate `config` (flat) and `tree_config` arguments in `init()`.
|
|
128
|
+
|
|
129
|
+
### Documentation 📚
|
|
130
|
+
|
|
131
|
+
* Updated all documentation (User Guide, API Reference, Examples, ADRs) to reflect the unified configuration system based on `@configured`, `configuration(...)`, and `ContextConfig`.
|
|
132
|
+
* Added `docs/specs/spec-configuration.md` detailing the unified configuration rules.
|
|
133
|
+
* Added migration notes related to removing `@configuration`.
|
|
134
|
+
|
|
135
|
+
### Breaking Changes ⚠️
|
|
136
|
+
|
|
137
|
+
* This release introduces significant breaking changes related to configuration management, requiring migration from the old `@configuration` decorator and `init()` arguments to the new `@configured` modes and `configuration(...)` builder (ADR-0010).
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## [2.0.3] - 2025-10-26
|
|
142
|
+
|
|
143
|
+
### Fixed
|
|
144
|
+
|
|
145
|
+
- Injection now falls back from an annotated key to the parameter name when the annotated key is unbound, enabling resolution against string-key providers registered via `@provides("name")`.
|
|
146
|
+
- `ProviderNotFoundError` includes the requesting origin (component or key) to aid debugging and test assertions.
|
|
147
|
+
- Unified sync/async resolution path in `PicoContainer`:
|
|
148
|
+
- `get()` raises `AsyncResolutionError` if a provider returns an awaitable, guiding users to `aget()`.
|
|
149
|
+
- `aget()` awaits awaitables and applies aspects and caching consistently.
|
|
150
|
+
- Observers receive accurate resolve timings in both paths.
|
|
151
|
+
|
|
152
|
+
### Added
|
|
153
|
+
|
|
154
|
+
- `AsyncResolutionError` to signal misuse of `get()` when a provider is async.
|
|
155
|
+
- More informative tracer notes for parameter binding.
|
|
156
|
+
|
|
157
|
+
### Internal
|
|
158
|
+
|
|
159
|
+
- `ComponentFactory.get()` now accepts an `origin` to enrich `ProviderNotFoundError` messages.
|
|
160
|
+
- Lazy proxy creation calls `factory.get(key, origin="lazy")` to attribute provenance.
|
|
161
|
+
- Public API exports updated to include `AsyncResolutionError`.
|
|
162
|
+
|
|
163
|
+
### Compatibility
|
|
164
|
+
|
|
165
|
+
- No public API breaking changes. Internal factory signature changed but remains encapsulated within the container/registrar.
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## [2.0.2] - 2025-10-26
|
|
170
|
+
|
|
171
|
+
### Fixed 🧩
|
|
172
|
+
|
|
173
|
+
* `@provides` Decorator Execution
|
|
174
|
+
Corrected an issue where the `@provides` decorator executed its wrapped function prematurely during module import, leading to runtime errors like `TypeError: Service() takes no arguments`.
|
|
175
|
+
The decorator now properly registers provider metadata without invoking the function until dependency resolution time.
|
|
176
|
+
|
|
177
|
+
### Added ✨
|
|
178
|
+
|
|
179
|
+
* `FlatDictSource` Configuration Provider
|
|
180
|
+
Introduced a lightweight configuration source for flat in-memory dictionaries.
|
|
181
|
+
Supports optional key prefixing and case sensitivity control for simple, programmatic configuration injection.
|
|
182
|
+
|
|
183
|
+
### Internal 🔧
|
|
184
|
+
|
|
185
|
+
* Updated type imports and registration logic in `api.py` to support `Mapping` for the new configuration source.
|
|
186
|
+
* Added `FlatDictSource` to the public API (`__all__` and import namespace).
|
|
187
|
+
|
|
188
|
+
### Notes 📝
|
|
189
|
+
|
|
190
|
+
* Fully backward compatible.
|
|
191
|
+
* This patch release focuses on decorator correctness and configuration flexibility improvements.
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## [2.0.1] - 2025-10-25
|
|
196
|
+
|
|
197
|
+
### Added ✨
|
|
198
|
+
|
|
199
|
+
- ADR-0009: Flexible `@provides` Support
|
|
200
|
+
Implemented support for using `@provides` in additional contexts:
|
|
201
|
+
- `@staticmethod` methods within `@factory` classes
|
|
202
|
+
- `@classmethod` methods within `@factory` classes
|
|
203
|
+
- Module-level functions
|
|
204
|
+
These new provider types are discovered automatically during module scanning and participate fully in dependency resolution, validation, and graph generation.
|
|
205
|
+
|
|
206
|
+
- Dependency Graph and Validation Enhancements
|
|
207
|
+
- `_build_resolution_graph` now includes edges for all `@provides` functions, regardless of where they are defined.
|
|
208
|
+
- Fail-fast validation checks now cover static/class/module-level providers, reporting missing bindings consistently.
|
|
209
|
+
- Scope inference and promotion logic apply equally to these new provider types.
|
|
210
|
+
|
|
211
|
+
### Documentation 📚
|
|
212
|
+
|
|
213
|
+
- Expanded `docs/overview.md` to document the new flexible provider options (`@staticmethod`, `@classmethod`, module-level functions).
|
|
214
|
+
- Updated `docs/guide.md` with practical examples showing when to use each style of provider.
|
|
215
|
+
- Linked ADR-0009 for design rationale and migration guidance.
|
|
216
|
+
|
|
217
|
+
### Notes 📝
|
|
218
|
+
|
|
219
|
+
- This is a minor feature release introducing a major ergonomics improvement (ADR-0009).
|
|
220
|
+
- Fully backward compatible with existing factories, components, and configuration mechanisms.
|
|
221
|
+
- Encourages a lighter, more Pythonic style for simple provider declarations.
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## [2.0.0] - 2025-10-23
|
|
227
|
+
|
|
228
|
+
This version marks a significant redesign and the first major public release, establishing the core architecture and feature set based on the principles outlined in the Architecture Decision Records (ADRs).
|
|
229
|
+
|
|
230
|
+
### 🚀 Highlights
|
|
231
|
+
|
|
232
|
+
* Async-Native Core: Introduced first-class `async`/`await` support across component resolution (`container.aget`), initialization (`__ainit__`), lifecycle hooks (`@configure`, `@cleanup`), AOP interceptors, and the event bus (ADR-0001).
|
|
233
|
+
* Tree-Based Configuration: Added `@configured` decorator and `TreeSource` protocol for binding complex, nested configuration (YAML/JSON) to dataclass graphs, including interpolation and type coercion (ADR-0002).
|
|
234
|
+
* Context-Aware Scopes: Implemented `contextvars`-based scopes (e.g., `"request"`, `"session"`) for managing component lifecycles tied to specific contexts (ADR-0003).
|
|
235
|
+
* Observability Features: Integrated container context (`container_id`, `as_current`), basic stats (`container.stats()`), observer protocol (`ContainerObserver`), and dependency graph export (`container.export_graph()`) (ADR-0004).
|
|
236
|
+
* Aspect-Oriented Programming (AOP): Implemented method interception via `MethodInterceptor` protocol and `@intercepted_by` decorator, using a dynamic proxy (`UnifiedComponentProxy`) (ADR-0005).
|
|
237
|
+
* Eager Startup Validation: Added fail-fast validation during `init()` to detect missing dependencies and configuration errors before runtime (ADR-0006).
|
|
238
|
+
* Built-in Event Bus: Included an asynchronous, in-process event bus (`EventBus`, `@subscribe`, `AutoSubscriberMixin`) for decoupled communication (ADR-0007).
|
|
239
|
+
* Explicit Circular Dependency Handling: Implemented detection and fail-fast for circular dependencies, requiring explicit resolution patterns (ADR-0008).
|
|
240
|
+
* Unified Decorator API: Consolidated component metadata into parameterized decorators (`@component`, `@factory`, `@provides`), removing older stacked decorators (ADR-0009).
|
|
241
|
+
|
|
242
|
+
### ✨ Added
|
|
243
|
+
|
|
244
|
+
* Core registration decorators: `@component`, `@factory`, `@provides`.
|
|
245
|
+
* Configuration decorators: `@configuration` (flat key-value) and `@configured` (tree-based).
|
|
246
|
+
* Lifecycle decorators: `@configure`, `@cleanup`.
|
|
247
|
+
* AOP decorator: `@intercepted_by`.
|
|
248
|
+
* Event bus decorator: `@subscribe`.
|
|
249
|
+
* Health check decorator: `@health`.
|
|
250
|
+
* Async resolution: `container.aget()` and `__ainit__` convention.
|
|
251
|
+
* Async cleanup: `container.cleanup_all_async()`.
|
|
252
|
+
* Qualifier support (`Qualifier` class) for list injection (`Annotated[List[Type], Qualifier(...)]`).
|
|
253
|
+
* Support for `lazy=True` parameter for deferred component instantiation.
|
|
254
|
+
* Conditional binding parameters (`conditional_profiles`, `conditional_require_env`, `conditional_predicate`).
|
|
255
|
+
* Fallback binding parameters (`on_missing_selector`, `on_missing_priority`).
|
|
256
|
+
* Primary selection parameter (`primary=True`).
|
|
257
|
+
* Testing support via `init(overrides={...})` and `init(profiles=(...))`.
|
|
258
|
+
* Container context management (`as_current`, `get_current`, `shutdown`, `all_containers`).
|
|
259
|
+
* Scope management API (`activate_scope`, `deactivate_scope`, `scope` context manager).
|
|
260
|
+
* Configuration sources: `EnvSource`, `FileSource` (flat); `JsonTreeSource`, `YamlTreeSource`, `DictSource` (tree).
|
|
261
|
+
* Protocols for extension: `MethodInterceptor`, `ContainerObserver`, `ScopeProtocol`, `ConfigSource`, `TreeSource`.
|
|
262
|
+
|
|
263
|
+
### ⚠️ Breaking Changes
|
|
264
|
+
|
|
265
|
+
* Complete redesign compared to any prior internal/unreleased versions. APIs are not backward compatible.
|
|
266
|
+
* Requires Python 3.10+.
|
|
267
|
+
|
|
268
|
+
### 📚 Docs
|
|
269
|
+
|
|
270
|
+
* Established new documentation structure including ADRs, Architecture, User Guide, Advanced Features, Cookbook, Integrations, and API Reference.
|
|
271
|
+
|
|
272
|
+
### 🧪 Testing
|
|
273
|
+
|
|
274
|
+
* Added comprehensive test suite covering core features, async behavior, AOP, configuration, scopes, and error handling.
|
|
275
|
+
* Introduced patterns for testing with overrides and profiles.
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## [<2.0.0]
|
|
280
|
+
|
|
281
|
+
* Internal development and prototyping phase. Basic dependency injection concepts established. Architecture significantly reworked for the v2.0.0 release.
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
---
|