tools2fast-fastapi 0.3.11__tar.gz → 0.3.12__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.
- {tools2fast_fastapi-0.3.11/src/tools2fast_fastapi.egg-info → tools2fast_fastapi-0.3.12}/PKG-INFO +3 -1
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/README.md +2 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/pyproject.toml +10 -1
- tools2fast_fastapi-0.3.12/src/tools2fast_fastapi/__version__.py +1 -0
- tools2fast_fastapi-0.3.12/src/tools2fast_fastapi/skills/SKILL.md +60 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12/src/tools2fast_fastapi.egg-info}/PKG-INFO +3 -1
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi.egg-info/SOURCES.txt +1 -0
- tools2fast_fastapi-0.3.11/src/tools2fast_fastapi/__version__.py +0 -1
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/LICENSE +0 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/MANIFEST.in +0 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/docs/guide.md +0 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/examples/example.py +0 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/setup.cfg +0 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi/__init__.py +0 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi/models/__init__.py +0 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi/models/mixins.py +0 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi/schemas/__init__.py +0 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi/schemas/mixins.py +0 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi/schemas/response_schema.py +0 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi/services/__init__.py +0 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi/services/document_simple_revision_service.py +0 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi/services/document_with_items_revision_service.py +0 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi/services/number_service.py +0 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi/services/revision_service.py +0 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi/services/transaction_service.py +0 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi/utils/__init__.py +0 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi/utils/routing.py +0 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi.egg-info/dependency_links.txt +0 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi.egg-info/requires.txt +0 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi.egg-info/top_level.txt +0 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/tests/test_initial.py +0 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/tests/test_response_schema.py +0 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/tests/test_revision_service.py +0 -0
- {tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/tests/test_schemas.py +0 -0
{tools2fast_fastapi-0.3.11/src/tools2fast_fastapi.egg-info → tools2fast_fastapi-0.3.12}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tools2fast-fastapi
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.12
|
|
4
4
|
Summary: Shared tools, mixins, and base services for FastAPI applications - Solautyc Team internal use
|
|
5
5
|
Author-email: Angel Daniel Sanchez Castillo <angeldaniel.sanchezcastillo@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -50,6 +50,8 @@ Dynamic: license-file
|
|
|
50
50
|
|
|
51
51
|
Shared tools, mixins, and base services for FastAPI applications. Designed for internal use by the Solautyc Team to standardize model definitions and common services across multiple packages.
|
|
52
52
|
|
|
53
|
+
> 📖 **Conventions reference**: this package follows the [2fast-handbook](https://github.com/AngelDanielSanchezCastillo/2fast-handbook) for ecosystem conventions (structure, versioning, README, commits, release).
|
|
54
|
+
|
|
53
55
|
## Installation
|
|
54
56
|
|
|
55
57
|
You can install this package from PyPI (if published) or use it locally within your workspace:
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Shared tools, mixins, and base services for FastAPI applications. Designed for internal use by the Solautyc Team to standardize model definitions and common services across multiple packages.
|
|
4
4
|
|
|
5
|
+
> 📖 **Conventions reference**: this package follows the [2fast-handbook](https://github.com/AngelDanielSanchezCastillo/2fast-handbook) for ecosystem conventions (structure, versioning, README, commits, release).
|
|
6
|
+
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
7
9
|
You can install this package from PyPI (if published) or use it locally within your workspace:
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tools2fast-fastapi"
|
|
7
|
-
|
|
7
|
+
dynamic = ["version"]
|
|
8
8
|
description = "Shared tools, mixins, and base services for FastAPI applications - Solautyc Team internal use"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -61,6 +61,15 @@ package-dir = {"" = "src"}
|
|
|
61
61
|
where = ["src"]
|
|
62
62
|
include = ["tools2fast_fastapi*"]
|
|
63
63
|
|
|
64
|
+
# Single source of truth for the version: __version__.py
|
|
65
|
+
[tool.setuptools.dynamic]
|
|
66
|
+
version = {attr = "tools2fast_fastapi.__version__.__version__"}
|
|
67
|
+
|
|
68
|
+
[tool.setuptools.package-data]
|
|
69
|
+
tools2fast_fastapi = [
|
|
70
|
+
"skills/*.md",
|
|
71
|
+
]
|
|
72
|
+
|
|
64
73
|
[tool.pytest.ini_options]
|
|
65
74
|
testpaths = ["tests"]
|
|
66
75
|
python_files = ["test_*.py"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.3.12"
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tools2fast-fastapi
|
|
3
|
+
description: "Trigger: working on or with tools2fast-fastapi. Shared base layer of the 2fast stack: model/schema mixins, APIResponse envelope, SafeRouter, revision and number services. Prevails over the 2fast-handbook base skill for this package."
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
author: AngelDanielSanchezCastillo
|
|
7
|
+
version: "1.0"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Purpose
|
|
11
|
+
|
|
12
|
+
Shared foundation consumed by nearly every 2fast package (oauth2fast,
|
|
13
|
+
permissions2fast, tenants2fast, cashing2fast, Metal-ERP): model mixins,
|
|
14
|
+
schema mixins, the response envelope (`APIResponse`), `SafeRouter`, audit
|
|
15
|
+
automation, and revision/document services. No settings module by design.
|
|
16
|
+
|
|
17
|
+
## Import quirk — TWO mixin namespaces, same names
|
|
18
|
+
|
|
19
|
+
- Top-level `from tools2fast_fastapi import IdMixin, TimestampMixin, ...` exports the **MODEL** versions (`models/mixins.py`): DB columns — nullable BigInteger PK `id`, tz-aware `created_at`/`updated_at` with `onupdate`, `revision` defaults to 1, `NumberUniqueMixin` has NO `tenant_id`.
|
|
20
|
+
- `tools2fast_fastapi.schemas.*` are the validation-only versions: REQUIRED `id`, REQUIRED `revision`, `NumberUniqueMixin` REQUIRES `tenant_id`. A schema built on `NumberUniqueMixin` cannot round-trip the model.
|
|
21
|
+
- Never mix the two families in one class; downstream imports top-level (model) mixins — that re-export is a hard cross-package contract.
|
|
22
|
+
|
|
23
|
+
## Envelope — `APIResponse`
|
|
24
|
+
|
|
25
|
+
- Success factories `ok/saved/created/deleted` return **bare Pydantic models** (HTTP 200 implied; a 201 must come from the route decorator).
|
|
26
|
+
- Error factories `fail(message, status_code=400)` / `payment_required` / `from_exception` return **`(model, http_status)` tuples** the caller must wrap in a `JSONResponse`.
|
|
27
|
+
- `error_type` Literal allows ONLY `controlled` / `unexpected` / `payment_required`. Unexpected errors **hide `error.detail`** (security) with fixed Spanish message "Ha ocurrido un error".
|
|
28
|
+
- `ERROR_RESPONSES` maps {400/402/404/500} → response classes (reuse for OpenAPI docs).
|
|
29
|
+
- `from_exception` treats `ValueError` subclasses as controlled 400; anything else → 500. Legacy `schemas.BaseResponse/DataResponse/ErrorResponse` still exported until all routers migrate.
|
|
30
|
+
|
|
31
|
+
## SafeRouter / handle_exceptions (traps)
|
|
32
|
+
|
|
33
|
+
- Endpoints under `SafeRouter`/`handle_exceptions` MUST be `async def` — the wrapper awaits unconditionally, sync endpoints crash with TypeError.
|
|
34
|
+
- **`HTTPException` is NOT a controlled error** → it becomes a 500 with hidden detail (loses the intended 404). Only `ValueError` subclasses survive as 400s. Prefer `TransactionService` + explicit `APIResponse.fail`/`from_exception`; never rely on SafeRouter to emit 404s.
|
|
35
|
+
|
|
36
|
+
## AuditTimestampMixin
|
|
37
|
+
|
|
38
|
+
- Only auto-audits **when tenants2fast is installed** (lazy import of `get_user_context` inside SQLAlchemy events; silently skipped otherwise). `created_by` filled only if absent; `updated_by` always set; `updated_at` force-set on every flush (even no-op updates).
|
|
39
|
+
- Revision clones copy `created_by`/`updated_by` verbatim (`_EXCLUDED_ON_CLONE = {"id", "created_at", "updated_at"}`) — new revisions carry stale audit attribution.
|
|
40
|
+
|
|
41
|
+
## Revision / number services
|
|
42
|
+
|
|
43
|
+
- `RevisionMixin` invariant: the consumer table MUST declare `UniqueConstraint("number", "revision", ...)` — **services never enforce it**; "current revision = max revision" depends on that constraint.
|
|
44
|
+
- Item/document services key items by the numeric `number` column (AttributeError otherwise); deleted items are implicit (absent from the payload → not cloned); `create_document_with_items` **mutates the caller's dict** (injects the header FK).
|
|
45
|
+
- `get_next_number(session, model_class)` = `max(number) + 1` over the WHOLE table — not tenant-filtered, **not atomic** (race-prone under concurrency), safe only in per-tenant DBs, and untested.
|
|
46
|
+
|
|
47
|
+
## Conventions
|
|
48
|
+
|
|
49
|
+
- Spanish response messages ("Éxito", "Guardado con éxito", "Ha ocurrido un error", "Pago requerido").
|
|
50
|
+
- All `error_type` values are Literals — only the three above exist.
|
|
51
|
+
|
|
52
|
+
## Stale docs
|
|
53
|
+
|
|
54
|
+
- README claims services are "(coming soon)" — 5 service modules exist; its `docs/guide.md` and `examples/` only cover the 3 basic mixins. Docstrings reference a nonexistent `tenant.*` module (copied from the original project).
|
|
55
|
+
- `pyproject.toml` pins deps with `>=` ranges and leaves `pydantic`/`sqlalchemy`/`tenant2fast` undeclared (tenant2fast is imported lazily at runtime).
|
|
56
|
+
|
|
57
|
+
## Golden rule (inherited)
|
|
58
|
+
|
|
59
|
+
Follow the 2fast-handbook base skill for layout/versioning/naming/README/commits/release.
|
|
60
|
+
Local edits are fine; NEVER bump/publish on your own — prepare the exact command and hand it to the developer.
|
{tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12/src/tools2fast_fastapi.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tools2fast-fastapi
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.12
|
|
4
4
|
Summary: Shared tools, mixins, and base services for FastAPI applications - Solautyc Team internal use
|
|
5
5
|
Author-email: Angel Daniel Sanchez Castillo <angeldaniel.sanchezcastillo@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -50,6 +50,8 @@ Dynamic: license-file
|
|
|
50
50
|
|
|
51
51
|
Shared tools, mixins, and base services for FastAPI applications. Designed for internal use by the Solautyc Team to standardize model definitions and common services across multiple packages.
|
|
52
52
|
|
|
53
|
+
> 📖 **Conventions reference**: this package follows the [2fast-handbook](https://github.com/AngelDanielSanchezCastillo/2fast-handbook) for ecosystem conventions (structure, versioning, README, commits, release).
|
|
54
|
+
|
|
53
55
|
## Installation
|
|
54
56
|
|
|
55
57
|
You can install this package from PyPI (if published) or use it locally within your workspace:
|
{tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi.egg-info/SOURCES.txt
RENAMED
|
@@ -22,6 +22,7 @@ src/tools2fast_fastapi/services/document_with_items_revision_service.py
|
|
|
22
22
|
src/tools2fast_fastapi/services/number_service.py
|
|
23
23
|
src/tools2fast_fastapi/services/revision_service.py
|
|
24
24
|
src/tools2fast_fastapi/services/transaction_service.py
|
|
25
|
+
src/tools2fast_fastapi/skills/SKILL.md
|
|
25
26
|
src/tools2fast_fastapi/utils/__init__.py
|
|
26
27
|
src/tools2fast_fastapi/utils/routing.py
|
|
27
28
|
tests/test_initial.py
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.3.11"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi/models/__init__.py
RENAMED
|
File without changes
|
{tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi/models/mixins.py
RENAMED
|
File without changes
|
{tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi/schemas/__init__.py
RENAMED
|
File without changes
|
{tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi/schemas/mixins.py
RENAMED
|
File without changes
|
|
File without changes
|
{tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi/services/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi/utils/__init__.py
RENAMED
|
File without changes
|
{tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi/utils/routing.py
RENAMED
|
File without changes
|
|
File without changes
|
{tools2fast_fastapi-0.3.11 → tools2fast_fastapi-0.3.12}/src/tools2fast_fastapi.egg-info/requires.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|