pico-fastapi 0.2.0__tar.gz → 0.2.3.dev0__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.
Files changed (69) hide show
  1. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/.github/workflows/ci.yml +1 -1
  2. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/.github/workflows/docs.yml +12 -26
  3. pico_fastapi-0.2.3.dev0/AGENTS.md +54 -0
  4. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/CHANGELOG.md +34 -3
  5. pico_fastapi-0.2.3.dev0/CLAUDE.md +18 -0
  6. pico_fastapi-0.2.3.dev0/MANIFEST.in +18 -0
  7. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/PKG-INFO +25 -19
  8. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/README.md +22 -15
  9. pico_fastapi-0.2.3.dev0/docs/CHANGELOG.md +89 -0
  10. pico_fastapi-0.2.3.dev0/docs/faq.md +413 -0
  11. pico_fastapi-0.2.3.dev0/docs/getting-started.md +436 -0
  12. pico_fastapi-0.2.3.dev0/docs/how-to/index.md +99 -0
  13. pico_fastapi-0.2.3.dev0/docs/index.md +157 -0
  14. pico_fastapi-0.2.3.dev0/docs/javascripts/extra.js +10 -0
  15. pico_fastapi-0.2.3.dev0/docs/reference/index.md +333 -0
  16. pico_fastapi-0.2.3.dev0/docs/requirements.txt +6 -0
  17. pico_fastapi-0.2.3.dev0/docs/skills.md +108 -0
  18. pico_fastapi-0.2.3.dev0/docs/stylesheets/extra.css +53 -0
  19. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/docs/tutorial.md +9 -9
  20. pico_fastapi-0.2.3.dev0/docs/user-guide/configurers.md +335 -0
  21. pico_fastapi-0.2.3.dev0/docs/user-guide/index.md +189 -0
  22. pico_fastapi-0.2.3.dev0/manage.sh +65 -0
  23. pico_fastapi-0.2.3.dev0/mkdocs.yml +146 -0
  24. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/pyproject.toml +4 -5
  25. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/src/pico_fastapi/__init__.py +1 -2
  26. pico_fastapi-0.2.3.dev0/src/pico_fastapi/_version.py +1 -0
  27. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/src/pico_fastapi/exceptions.py +0 -4
  28. pico_fastapi-0.2.3.dev0/src/pico_fastapi/factory.py +200 -0
  29. pico_fastapi-0.2.3.dev0/src/pico_fastapi/middleware.py +56 -0
  30. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/src/pico_fastapi.egg-info/PKG-INFO +25 -19
  31. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/src/pico_fastapi.egg-info/SOURCES.txt +21 -1
  32. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/src/pico_fastapi.egg-info/entry_points.txt +1 -1
  33. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/src/pico_fastapi.egg-info/requires.txt +1 -1
  34. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/tests/conftest.py +1 -1
  35. pico_fastapi-0.2.3.dev0/tests/test_config.py +188 -0
  36. pico_fastapi-0.2.3.dev0/tests/test_configurer_priority.py +235 -0
  37. pico_fastapi-0.2.3.dev0/tests/test_decorators.py +225 -0
  38. pico_fastapi-0.2.3.dev0/tests/test_exceptions.py +73 -0
  39. pico_fastapi-0.2.3.dev0/tests/test_exports.py +114 -0
  40. pico_fastapi-0.2.3.dev0/tests/test_factory.py +374 -0
  41. pico_fastapi-0.2.3.dev0/tests/test_middleware.py +239 -0
  42. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/tox.ini +3 -3
  43. pico_fastapi-0.2.0/.github/workflows/sync-keywords.yml +0 -80
  44. pico_fastapi-0.2.0/MANIFEST.in +0 -24
  45. pico_fastapi-0.2.0/docs/how-to/index.md +0 -8
  46. pico_fastapi-0.2.0/mkdocs.yml +0 -65
  47. pico_fastapi-0.2.0/src/pico_fastapi/_version.py +0 -1
  48. pico_fastapi-0.2.0/src/pico_fastapi/factory.py +0 -155
  49. pico_fastapi-0.2.0/src/pico_fastapi/middleware.py +0 -37
  50. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/.coveragerc +0 -0
  51. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/.github/workflows/publish-to-pypi.yml +0 -0
  52. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/LICENSE +0 -0
  53. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/docs/architecture.md +0 -0
  54. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/docs/explanation/test-suite.md +0 -0
  55. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/docs/how-to/session-cart.md +0 -0
  56. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/docs/how-to/settings-applied.md +0 -0
  57. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/docs/how-to/websocket-chat.md +0 -0
  58. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/docs/reference/config.md +0 -0
  59. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/docs/reference/exceptions.md +0 -0
  60. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/setup.cfg +0 -0
  61. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/src/pico_fastapi/config.py +0 -0
  62. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/src/pico_fastapi/decorators.py +0 -0
  63. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/src/pico_fastapi.egg-info/dependency_links.txt +0 -0
  64. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/src/pico_fastapi.egg-info/top_level.txt +0 -0
  65. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/tests/__init__.py +0 -0
  66. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/tests/test_http_admin.py +0 -0
  67. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/tests/test_session_cart.py +0 -0
  68. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/tests/test_settings_applied.py +0 -0
  69. {pico_fastapi-0.2.0 → pico_fastapi-0.2.3.dev0}/tests/test_websocket_chat.py +0 -0
@@ -13,7 +13,7 @@ jobs:
13
13
  strategy:
14
14
  fail-fast: false
15
15
  matrix:
16
- python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ]
16
+ python-version: [ "3.11", "3.12", "3.13", "3.14" ]
17
17
 
18
18
  steps:
19
19
  - name: Checkout
@@ -6,16 +6,12 @@ on:
6
6
  paths:
7
7
  - 'docs/**'
8
8
  - 'mkdocs.yml'
9
- - 'src/**'
10
- - 'pyproject.toml'
11
9
  - '.github/workflows/docs.yml'
12
10
  pull_request:
13
11
  branches: [ main, master ]
14
12
  paths:
15
13
  - 'docs/**'
16
14
  - 'mkdocs.yml'
17
- - 'src/**'
18
- - 'pyproject.toml'
19
15
  workflow_dispatch:
20
16
 
21
17
  permissions:
@@ -26,7 +22,7 @@ permissions:
26
22
 
27
23
  concurrency:
28
24
  group: "pages"
29
- cancel-in-progress: true
25
+ cancel-in-progress: false
30
26
 
31
27
  jobs:
32
28
  validate:
@@ -45,20 +41,18 @@ jobs:
45
41
  - name: Install dependencies
46
42
  run: |
47
43
  pip install --upgrade pip
48
- pip install -e .
49
- # INSTALACIÓN EXPLÍCITA: Aseguramos que mkdocs siempre esté presente
50
- pip install mkdocs mkdocs-material "mkdocstrings[python]"
51
- # Si existe un archivo extra de requirements, lo instalamos también
52
- if [ -f docs/requirements.txt ]; then pip install -r docs/requirements.txt; fi
53
-
54
- - name: Prepare documentation files
55
- run: |
56
- cp README.md docs/index.md
57
- cp CHANGELOG.md docs/CHANGELOG.md
44
+ pip install -r docs/requirements.txt
58
45
 
59
46
  - name: Validate documentation build
60
47
  run: mkdocs build --strict
61
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
+
62
56
  deploy:
63
57
  if: github.event_name != 'pull_request'
64
58
  runs-on: ubuntu-latest
@@ -79,16 +73,7 @@ jobs:
79
73
  - name: Install dependencies
80
74
  run: |
81
75
  pip install --upgrade pip
82
- pip install -e .
83
- # INSTALACIÓN EXPLÍCITA: Aseguramos que mkdocs siempre esté presente
84
- pip install mkdocs mkdocs-material "mkdocstrings[python]"
85
- # Si existe un archivo extra de requirements, lo instalamos también
86
- if [ -f docs/requirements.txt ]; then pip install -r docs/requirements.txt; fi
87
-
88
- - name: Prepare documentation files
89
- run: |
90
- cp README.md docs/index.md
91
- cp CHANGELOG.md docs/CHANGELOG.md
76
+ pip install -r docs/requirements.txt
92
77
 
93
78
  - name: Build documentation
94
79
  run: |
@@ -105,7 +90,7 @@ jobs:
105
90
  id: deployment
106
91
  uses: actions/deploy-pages@v4
107
92
 
108
- - name: Comment on commit
93
+ - name: Comment on commit (optional)
109
94
  if: success()
110
95
  uses: actions/github-script@v7
111
96
  with:
@@ -116,3 +101,4 @@ jobs:
116
101
  commit_sha: context.sha,
117
102
  body: `✅ Documentation deployed successfully!\n\n📚 View at: ${'${{ steps.deployment.outputs.page_url }}'}`
118
103
  })
104
+
@@ -0,0 +1,54 @@
1
+ # pico-fastapi
2
+
3
+ FastAPI integration for pico-ioc. Class-based controllers with DI, scope middleware, and configurer system.
4
+
5
+ ## Commands
6
+
7
+ ```bash
8
+ pip install -e ".[test]" # Install in dev mode
9
+ pytest tests/ -v # Run tests
10
+ pytest --cov=pico_fastapi --cov-report=term-missing tests/ # Coverage
11
+ tox # Full matrix (3.11-3.14)
12
+ mkdocs serve -f mkdocs.yml # Local docs
13
+ ```
14
+
15
+ ## Project Structure
16
+
17
+ ```
18
+ src/pico_fastapi/
19
+ __init__.py # Public API exports
20
+ decorators.py # @controller, @get, @post, @put, @delete, @patch, @websocket
21
+ middleware.py # PicoScopeMiddleware - request/session/websocket scope management
22
+ factory.py # FastApiAppFactory, PicoLifespanConfigurer, register_controllers()
23
+ config.py # FastApiSettings, FastApiConfigurer protocol
24
+ exceptions.py # NoControllersFoundError, InvalidConfigurerError
25
+ ```
26
+
27
+ ## Key Concepts
28
+
29
+ - **`@controller(prefix="/api")`**: Class-based API router with DI. Methods decorated with `@get`, `@post`, etc.
30
+ - **`PicoScopeMiddleware`**: ASGI middleware managing `request`, `session`, `websocket` scopes via pico-ioc's ScopeManager
31
+ - **`FastApiConfigurer`**: Protocol for setup hooks. `priority >= 0` = inner (after scope middleware), `priority < 0` = outer (before). Sandwich pattern.
32
+ - **`FastApiAppFactory`**: Creates FastAPI app from `FastApiSettings`
33
+ - **`PicoLifespanConfigurer`**: Applies configurers, registers controllers, adds scope middleware during app lifespan
34
+ - **Controller discovery**: Via `container._locator._metadata` - finds classes with `_pico_meta` containing controller info
35
+
36
+ ## Code Style
37
+
38
+ - Python 3.11+
39
+ - Async-first for all middleware and controller methods
40
+ - Use pico-ioc's `@component`, `@configured` decorators
41
+ - WebSocket parameter detected by type annotation (`ws: WebSocket`), not by name
42
+
43
+ ## Testing
44
+
45
+ - pytest + pytest-asyncio (mode=strict)
46
+ - Mock pico-ioc container with `MagicMock` for unit tests
47
+ - `MagicMock.__exit__` must return `False` to propagate exceptions in context manager mocks
48
+ - Target: >95% coverage
49
+
50
+ ## Boundaries
51
+
52
+ - Do not modify `_version.py`
53
+ - Controllers discovered from container metadata, not a global registry
54
+ - No direct dependency on pico-boot (uses entry point for auto-discovery)
@@ -7,18 +7,49 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.h
7
7
 
8
8
  ---
9
9
 
10
+ ## v0.2.2 — Internal Quality (2026-02-06)
11
+
12
+ ### Changed
13
+ - **Error Handling**: Replaced `InvalidConfigurerError` exception with a `logger.warning()` — invalid configurers are now logged and discarded instead of raising.
14
+ - **Logging**: Added `logging` to `factory.py` for configurer validation and WebSocket parameter detection.
15
+
16
+ ### Removed
17
+ - **`InvalidConfigurerError`**: Removed exception class, its export from `__init__.py`, and all related tests.
18
+
19
+ ### Fixed
20
+ - **Code Quality**: Changed bare `except:` to `except Exception:` in test conftest.
21
+
22
+ ---
23
+
24
+ ## v0.2.1 — Fixes & Quality (2026-02-05)
25
+
26
+ ### Fixed
27
+ - Fixed CI badge in README pointing to pico-ioc instead of pico-fastapi.
28
+ - Fixed all references from `pico-stack` to `pico-boot` in CHANGELOG and release notes.
29
+ - Fixed 5 broken unit tests against current pico-ioc attribute names (`_pico_meta`, `_pico_infra`).
30
+ - Fixed middleware test mock not propagating exceptions correctly.
31
+ - Fixed factory test expecting silent return instead of `NoControllersFoundError`.
32
+ - Removed redundant `pip install pico-ioc fastapi` from README (already dependencies).
33
+
34
+ ### Changed
35
+ - Bumped `pico-ioc` dependency from `>= 2.1.3` to `>= 2.2.0`.
36
+ - Dropped Python 3.10 from CI matrix, tox and Makefile (requires-python is `>=3.11`).
37
+ - Changed `version_scheme` from `post-release` to `guess-next-dev` for clean release versions.
38
+
39
+ ---
40
+
10
41
  ## v0.2.0 — Ecosystem Integration (2025-11-25)
11
42
 
12
43
  ### 🔌 New
13
- - Added native `pico-stack` auto-discovery using the `pico_stack.modules` entry point.
14
- - `pico-fastapi` is now automatically detected and loaded when initializing applications with `pico-stack`.
44
+ - Added native `pico-boot` auto-discovery using the `pico_boot.modules` entry point.
45
+ - `pico-fastapi` is now automatically detected and loaded when initializing applications with `pico-boot`.
15
46
 
16
47
  ### 🧱 No Behavioral Changes
17
48
  - No updates to middleware behavior.
18
49
  - No DI or request lifecycle changes.
19
50
  - No breaking changes.
20
51
 
21
- This release focuses exclusively on ecosystem alignment and improving the developer experience when bootstrapping applications with `pico-stack`.
52
+ This release focuses exclusively on ecosystem alignment and improving the developer experience when bootstrapping applications with `pico-boot`.
22
53
 
23
54
  ---
24
55
 
@@ -0,0 +1,18 @@
1
+ Read and follow ./AGENTS.md for project conventions.
2
+
3
+ ## Pico Ecosystem Context
4
+
5
+ pico-fastapi provides FastAPI integration for pico-ioc. It uses:
6
+ - `@component` from pico-ioc for controllers
7
+ - `@configured` for FastApiSettings
8
+ - `MethodInterceptor` is NOT used here (unlike pico-sqlalchemy/pico-pydantic)
9
+ - Auto-discovered via `pico_boot.modules` entry point
10
+
11
+ ## Key Reminders
12
+
13
+ - pico-ioc dependency: `>= 2.2.0`
14
+ - `version_scheme = "guess-next-dev"` (clean versions on tag)
15
+ - requires-python >= 3.11
16
+ - Commit messages: one line only
17
+ - CI badge must point to `pico-fastapi` repo (not pico-ioc)
18
+ - Internal pico-ioc attributes: `_pico_meta`, `_pico_infra` (not dunder versions)
@@ -0,0 +1,18 @@
1
+ include README.md
2
+ include LICENSE
3
+
4
+ recursive-include src *.py
5
+
6
+ recursive-include tests *.py
7
+
8
+ exclude .gitignore
9
+ exclude Dockerfile*
10
+ exclude docker-compose*.yml
11
+ exclude Makefile
12
+
13
+ prune build
14
+ prune dist
15
+ prune .tox
16
+ prune .pytest_cache
17
+ prune __pycache__
18
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pico-fastapi
3
- Version: 0.2.0
3
+ Version: 0.2.3.dev0
4
4
  Summary: Pico-ioc integration for FastAPI. Adds Spring Boot-style controllers, autoconfiguration, and scopes (request, websocket, session).
5
5
  Author-email: David Perez Cabrera <dperezcabrera@gmail.com>
6
6
  License: MIT License
@@ -34,17 +34,16 @@ Classifier: Framework :: FastAPI
34
34
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
35
35
  Classifier: Programming Language :: Python :: 3
36
36
  Classifier: Programming Language :: Python :: 3 :: Only
37
- Classifier: Programming Language :: Python :: 3.10
38
37
  Classifier: Programming Language :: Python :: 3.11
39
38
  Classifier: Programming Language :: Python :: 3.12
40
39
  Classifier: Programming Language :: Python :: 3.13
41
40
  Classifier: Programming Language :: Python :: 3.14
42
41
  Classifier: License :: OSI Approved :: MIT License
43
42
  Classifier: Operating System :: OS Independent
44
- Requires-Python: >=3.10
43
+ Requires-Python: >=3.11
45
44
  Description-Content-Type: text/markdown
46
45
  License-File: LICENSE
47
- Requires-Dist: pico-ioc>=2.1.3
46
+ Requires-Dist: pico-ioc>=2.2.0
48
47
  Requires-Dist: fastapi>=0.100
49
48
  Provides-Extra: session
50
49
  Requires-Dist: starlette-session; extra == "session"
@@ -57,7 +56,7 @@ Dynamic: license-file
57
56
  [![PyPI](https://img.shields.io/pypi/v/pico-fastapi.svg)](https://pypi.org/project/pico-fastapi/)
58
57
  [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/dperezcabrera/pico-fastapi)
59
58
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
60
- ![CI (tox matrix)](https://github.com/dperezcabrera/pico-ioc/actions/workflows/ci.yml/badge.svg)
59
+ ![CI (tox matrix)](https://github.com/dperezcabrera/pico-fastapi/actions/workflows/ci.yml/badge.svg)
61
60
  [![codecov](https://codecov.io/gh/dperezcabrera/pico-fastapi/branch/main/graph/badge.svg)](https://codecov.io/gh/dperezcabrera/pico-fastapi)
62
61
  [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=dperezcabrera_pico-fastapi&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=dperezcabrera_pico-fastapi)
63
62
  [![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=dperezcabrera_pico-fastapi&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=dperezcabrera_pico-fastapi)
@@ -70,7 +69,7 @@ Dynamic: license-file
70
69
 
71
70
  It provides scoped lifecycles, automatic controller registration, and clean architectural boundaries, without global state and without FastAPI’s function-based dependency system.
72
71
 
73
- > 🐍 Requires Python 3.10+
72
+ > 🐍 Requires Python 3.11+
74
73
  > ⚡ Built on FastAPI
75
74
  > ✅ Fully async-compatible
76
75
  > ✅ Real IoC with constructor injection
@@ -110,12 +109,6 @@ FastAPI’s built-in dependency system is function-based, which often ties busin
110
109
  pip install pico-fastapi
111
110
  ````
112
111
 
113
- Also install:
114
-
115
- ```bash
116
- pip install pico-ioc fastapi
117
- ```
118
-
119
112
  ---
120
113
 
121
114
  ## 🚀 Quick Example
@@ -158,7 +151,7 @@ app = container.get(FastAPI)
158
151
  ```
159
152
  ---
160
153
 
161
- # 🚀 Quick Example (with pico-stack auto-discovery)
154
+ # 🚀 Quick Example (with pico-boot auto-discovery)
162
155
 
163
156
  ### 1. Controller
164
157
 
@@ -186,13 +179,13 @@ class MyService:
186
179
  return "hello from service"
187
180
  ```
188
181
 
189
- ### 3. App Initialization (Using pico-stack)
182
+ ### 3. App Initialization (Using pico-boot)
190
183
 
191
184
  ```python
192
- from pico_stack import init
185
+ from pico_boot import init
193
186
  from fastapi import FastAPI
194
187
 
195
- # No need to declare "pico_fastapi.factory" anymore.
188
+ # No need to declare "pico_fastapi" anymore.
196
189
  # pico-fastapi is auto-discovered via entry points.
197
190
 
198
191
  container = init(
@@ -237,7 +230,7 @@ class FakeService:
237
230
  return "test"
238
231
 
239
232
  container = init(
240
- modules=["controllers", "services", "pico_fastapi.factory"],
233
+ modules=["controllers", "services", "pico_fastapi"],
241
234
  overrides={"MyService": FakeService()}
242
235
  )
243
236
 
@@ -280,7 +273,7 @@ from fastapi import FastAPI
280
273
 
281
274
  container = init(
282
275
  modules=[
283
- "pico_fastapi.factory",
276
+ "pico_fastapi",
284
277
  "static_config",
285
278
  ],
286
279
  config=configuration(
@@ -387,7 +380,7 @@ class ProfileController:
387
380
 
388
381
  container = init(
389
382
  modules=[
390
- "pico_fastapi.factory",
383
+ "pico_fastapi",
391
384
  "jwt_config",
392
385
  "controllers",
393
386
  ]
@@ -409,6 +402,19 @@ No global state and no implicit singletons.
409
402
 
410
403
  ---
411
404
 
405
+ ## 🤖 Claude Code Skills
406
+
407
+ This project includes pre-designed skills for [Claude Code](https://claude.ai/claude-code), enabling AI-assisted development with pico-fastapi patterns.
408
+
409
+ | Skill | Command | Description |
410
+ |-------|---------|-------------|
411
+ | **Pico FastAPI Endpoint** | `/pico-fastapi` | Creates endpoints with controller-based routing and DI |
412
+ | **Pico Test Generator** | `/pico-tests` | Generates tests for pico-framework components |
413
+
414
+ See [Skills documentation](docs/skills.md) for full details and installation instructions.
415
+
416
+ ---
417
+
412
418
  ## 📝 License
413
419
 
414
420
  MIT
@@ -3,7 +3,7 @@
3
3
  [![PyPI](https://img.shields.io/pypi/v/pico-fastapi.svg)](https://pypi.org/project/pico-fastapi/)
4
4
  [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/dperezcabrera/pico-fastapi)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
6
- ![CI (tox matrix)](https://github.com/dperezcabrera/pico-ioc/actions/workflows/ci.yml/badge.svg)
6
+ ![CI (tox matrix)](https://github.com/dperezcabrera/pico-fastapi/actions/workflows/ci.yml/badge.svg)
7
7
  [![codecov](https://codecov.io/gh/dperezcabrera/pico-fastapi/branch/main/graph/badge.svg)](https://codecov.io/gh/dperezcabrera/pico-fastapi)
8
8
  [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=dperezcabrera_pico-fastapi&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=dperezcabrera_pico-fastapi)
9
9
  [![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=dperezcabrera_pico-fastapi&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=dperezcabrera_pico-fastapi)
@@ -16,7 +16,7 @@
16
16
 
17
17
  It provides scoped lifecycles, automatic controller registration, and clean architectural boundaries, without global state and without FastAPI’s function-based dependency system.
18
18
 
19
- > 🐍 Requires Python 3.10+
19
+ > 🐍 Requires Python 3.11+
20
20
  > ⚡ Built on FastAPI
21
21
  > ✅ Fully async-compatible
22
22
  > ✅ Real IoC with constructor injection
@@ -56,12 +56,6 @@ FastAPI’s built-in dependency system is function-based, which often ties busin
56
56
  pip install pico-fastapi
57
57
  ````
58
58
 
59
- Also install:
60
-
61
- ```bash
62
- pip install pico-ioc fastapi
63
- ```
64
-
65
59
  ---
66
60
 
67
61
  ## 🚀 Quick Example
@@ -104,7 +98,7 @@ app = container.get(FastAPI)
104
98
  ```
105
99
  ---
106
100
 
107
- # 🚀 Quick Example (with pico-stack auto-discovery)
101
+ # 🚀 Quick Example (with pico-boot auto-discovery)
108
102
 
109
103
  ### 1. Controller
110
104
 
@@ -132,13 +126,13 @@ class MyService:
132
126
  return "hello from service"
133
127
  ```
134
128
 
135
- ### 3. App Initialization (Using pico-stack)
129
+ ### 3. App Initialization (Using pico-boot)
136
130
 
137
131
  ```python
138
- from pico_stack import init
132
+ from pico_boot import init
139
133
  from fastapi import FastAPI
140
134
 
141
- # No need to declare "pico_fastapi.factory" anymore.
135
+ # No need to declare "pico_fastapi" anymore.
142
136
  # pico-fastapi is auto-discovered via entry points.
143
137
 
144
138
  container = init(
@@ -183,7 +177,7 @@ class FakeService:
183
177
  return "test"
184
178
 
185
179
  container = init(
186
- modules=["controllers", "services", "pico_fastapi.factory"],
180
+ modules=["controllers", "services", "pico_fastapi"],
187
181
  overrides={"MyService": FakeService()}
188
182
  )
189
183
 
@@ -226,7 +220,7 @@ from fastapi import FastAPI
226
220
 
227
221
  container = init(
228
222
  modules=[
229
- "pico_fastapi.factory",
223
+ "pico_fastapi",
230
224
  "static_config",
231
225
  ],
232
226
  config=configuration(
@@ -333,7 +327,7 @@ class ProfileController:
333
327
 
334
328
  container = init(
335
329
  modules=[
336
- "pico_fastapi.factory",
330
+ "pico_fastapi",
337
331
  "jwt_config",
338
332
  "controllers",
339
333
  ]
@@ -355,6 +349,19 @@ No global state and no implicit singletons.
355
349
 
356
350
  ---
357
351
 
352
+ ## 🤖 Claude Code Skills
353
+
354
+ This project includes pre-designed skills for [Claude Code](https://claude.ai/claude-code), enabling AI-assisted development with pico-fastapi patterns.
355
+
356
+ | Skill | Command | Description |
357
+ |-------|---------|-------------|
358
+ | **Pico FastAPI Endpoint** | `/pico-fastapi` | Creates endpoints with controller-based routing and DI |
359
+ | **Pico Test Generator** | `/pico-tests` | Generates tests for pico-framework components |
360
+
361
+ See [Skills documentation](docs/skills.md) for full details and installation instructions.
362
+
363
+ ---
364
+
358
365
  ## 📝 License
359
366
 
360
367
  MIT
@@ -0,0 +1,89 @@
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
+ ## v0.2.2 — Internal Quality (2026-02-06)
11
+
12
+ ### Changed
13
+ - **Error Handling**: Replaced `InvalidConfigurerError` exception with a `logger.warning()` — invalid configurers are now logged and discarded instead of raising.
14
+ - **Logging**: Added `logging` to `factory.py` for configurer validation and WebSocket parameter detection.
15
+
16
+ ### Removed
17
+ - **`InvalidConfigurerError`**: Removed exception class, its export from `__init__.py`, and all related tests.
18
+
19
+ ### Fixed
20
+ - **Code Quality**: Changed bare `except:` to `except Exception:` in test conftest.
21
+
22
+ ---
23
+
24
+ ## v0.2.1 — Fixes & Quality (2026-02-05)
25
+
26
+ ### Fixed
27
+ - Fixed CI badge in README pointing to pico-ioc instead of pico-fastapi.
28
+ - Fixed all references from `pico-stack` to `pico-boot` in CHANGELOG and release notes.
29
+ - Fixed 5 broken unit tests against current pico-ioc attribute names (`_pico_meta`, `_pico_infra`).
30
+ - Fixed middleware test mock not propagating exceptions correctly.
31
+ - Fixed factory test expecting silent return instead of `NoControllersFoundError`.
32
+ - Removed redundant `pip install pico-ioc fastapi` from README (already dependencies).
33
+
34
+ ### Changed
35
+ - Bumped `pico-ioc` dependency from `>= 2.1.3` to `>= 2.2.0`.
36
+ - Dropped Python 3.10 from CI matrix, tox and Makefile (requires-python is `>=3.11`).
37
+ - Changed `version_scheme` from `post-release` to `guess-next-dev` for clean release versions.
38
+
39
+ ---
40
+
41
+ ## v0.2.0 — Ecosystem Integration (2025-11-25)
42
+
43
+ ### 🔌 New
44
+ - Added native `pico-boot` auto-discovery using the `pico_boot.modules` entry point.
45
+ - `pico-fastapi` is now automatically detected and loaded when initializing applications with `pico-boot`.
46
+
47
+ ### 🧱 No Behavioral Changes
48
+ - No updates to middleware behavior.
49
+ - No DI or request lifecycle changes.
50
+ - No breaking changes.
51
+
52
+ This release focuses exclusively on ecosystem alignment and improving the developer experience when bootstrapping applications with `pico-boot`.
53
+
54
+ ---
55
+
56
+ ## [0.1.2] - 2025-11-18
57
+
58
+ ### Fixed
59
+ - **Middleware Ordering:** Fixed a critical issue where `PicoScopeMiddleware` was always added last (outermost), preventing inner middlewares (like Authentication) from accessing the IoC container.
60
+ - **Architecture:** Implemented a "Sandwich" strategy for `FastApiConfigurer`. Configurers with negative priority (`priority < 0`) now wrap the scope middleware (e.g., Session, CORS), while configurers with positive priority (`priority >= 0`) run inside the scope (e.g., Auth, Business Logic).
61
+
62
+ ---
63
+
64
+ ## [0.1.1] - 2025-11-18
65
+
66
+ ### Fixed
67
+ - **Critical:** Fixed a memory leak in `PicoScopeMiddleware`. Request and WebSocket scopes were not being explicitly cleaned up after connection closure, leading to unbounded memory usage (aligned with `pico-ioc` v2.1.3 breaking changes).
68
+ - Fixed WebSocket argument injection mechanism. Previously, the controller method argument *had* to be named `websocket`. It is now detected dynamically by type annotation (`websocket: WebSocket`), allowing any argument name (e.g., `ws: WebSocket`).
69
+
70
+ ### Changed
71
+ - **Architecture:** Removed the global `CONTROLLERS` set used for route registration. Controllers are now discovered by inspecting the `pico-ioc` container's metadata directly. This fixes state pollution issues during testing and ensures a single source of truth.
72
+ - Updated dependency requirement to `pico-ioc>=2.1.3`.
73
+
74
+ ---
75
+
76
+ ## [0.1.0] - 2025-11-02
77
+
78
+ ### Added
79
+
80
+ * Initial public release of `pico-fastapi`.
81
+ * **`@controller`** decorator for class-based, dependency-injected API routers.
82
+ * Route decorators (`@get`, `@post`, `@put`, `@delete`, `@patch`, `@websocket`) for controller methods.
83
+ * **`PicoScopeMiddleware`** for automatic `request`, `session`, and `websocket` scope management, linking FastAPI's lifecycle to `pico-ioc`.
84
+ * **`FastApiAppFactory`** to provide a `FastAPI` instance as an injectable singleton.
85
+ * **`FastApiSettings`** dataclass for type-safe application configuration via `@configured`.
86
+ * **`FastApiConfigurer`** protocol for creating custom, prioritized setup hooks.
87
+ * Automatic FastAPI `lifespan` integration to manage container startup and shutdown (`cleanup_all_async`, `shutdown`).
88
+ * Custom exceptions (`InvalidConfigurerError`, `NoControllersFoundError`).
89
+