tools2fast-fastapi 0.1.0__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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Angel Daniel Sanchez Castillo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,8 @@
1
+ include README.md
2
+ include LICENSE
3
+ recursive-include docs *.md *.example
4
+ recursive-include examples *.py
5
+ recursive-include src/tools2fast_fastapi *.py *.html
6
+ global-exclude __pycache__
7
+ global-exclude *.py[co]
8
+ global-exclude .DS_Store
@@ -0,0 +1,84 @@
1
+ Metadata-Version: 2.4
2
+ Name: tools2fast-fastapi
3
+ Version: 0.1.0
4
+ Summary: Shared tools, mixins, and base services for FastAPI applications - Solautyc Team internal use
5
+ Author-email: Angel Daniel Sanchez Castillo <angeldaniel.sanchezcastillo@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Angel Daniel Sanchez Castillo
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/AngelDanielSanchezCastillo/tools2fast-fastapi
29
+ Project-URL: Documentation, https://github.com/AngelDanielSanchezCastillo/tools2fast-fastapi/tree/main/docs
30
+ Project-URL: Repository, https://github.com/AngelDanielSanchezCastillo/tools2fast-fastapi
31
+ Project-URL: Issues, https://github.com/AngelDanielSanchezCastillo/tools2fast-fastapi/issues
32
+ Keywords: fastapi,tools,mixins,services,sqlmodel
33
+ Classifier: Development Status :: 3 - Alpha
34
+ Classifier: Intended Audience :: Developers
35
+ Classifier: License :: OSI Approved :: MIT License
36
+ Classifier: Programming Language :: Python :: 3
37
+ Classifier: Programming Language :: Python :: 3.10
38
+ Classifier: Programming Language :: Python :: 3.11
39
+ Classifier: Programming Language :: Python :: 3.12
40
+ Classifier: Framework :: FastAPI
41
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
42
+ Requires-Python: >=3.10
43
+ Description-Content-Type: text/markdown
44
+ License-File: LICENSE
45
+ Requires-Dist: fastapi>=0.100.0
46
+ Requires-Dist: sqlmodel>=0.0.16
47
+ Dynamic: license-file
48
+
49
+ # Tools2Fast FastAPI
50
+
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
+
53
+ ## Installation
54
+
55
+ You can install this package from PyPI (if published) or use it locally within your workspace:
56
+
57
+ ```bash
58
+ pip install tools2fast-fastapi
59
+ ```
60
+
61
+ Locally with UV:
62
+ ```bash
63
+ uv pip install -e path/to/tools2fast-fastapi
64
+ ```
65
+
66
+ ## Features
67
+
68
+ - **SQLModel Mixins**: Standardized `IdMixin`, `TimestampMixin`, and `AuditMixin`.
69
+ - **Base Models**: Core models setup to be inherited across all entity definitions.
70
+ - **Shared Services**: Reusable services logic for basic CRUD and related queries (coming soon).
71
+
72
+ ## Documentation
73
+
74
+ See the `docs/` folder for more detailed instructions and usage guides:
75
+
76
+ - [Usage Guide](docs/guide.md)
77
+
78
+ ## Examples
79
+
80
+ Check the `examples/` folder for sample implementation.
81
+
82
+ ## License
83
+
84
+ This project is licensed under the MIT License.
@@ -0,0 +1,36 @@
1
+ # Tools2Fast FastAPI
2
+
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
+
5
+ ## Installation
6
+
7
+ You can install this package from PyPI (if published) or use it locally within your workspace:
8
+
9
+ ```bash
10
+ pip install tools2fast-fastapi
11
+ ```
12
+
13
+ Locally with UV:
14
+ ```bash
15
+ uv pip install -e path/to/tools2fast-fastapi
16
+ ```
17
+
18
+ ## Features
19
+
20
+ - **SQLModel Mixins**: Standardized `IdMixin`, `TimestampMixin`, and `AuditMixin`.
21
+ - **Base Models**: Core models setup to be inherited across all entity definitions.
22
+ - **Shared Services**: Reusable services logic for basic CRUD and related queries (coming soon).
23
+
24
+ ## Documentation
25
+
26
+ See the `docs/` folder for more detailed instructions and usage guides:
27
+
28
+ - [Usage Guide](docs/guide.md)
29
+
30
+ ## Examples
31
+
32
+ Check the `examples/` folder for sample implementation.
33
+
34
+ ## License
35
+
36
+ This project is licensed under the MIT License.
@@ -0,0 +1,33 @@
1
+ # Usage Guide
2
+
3
+ This package provides standard mixins for SQLModel.
4
+
5
+ ## Mixins
6
+
7
+ To use the mixins, simply inherit from them when defining your models.
8
+
9
+ ```python
10
+ from sqlmodel import Field, MetaData, SQLModel
11
+ from tools2fast_fastapi.models.mixins import AuditMixin, IdMixin, TimestampMixin
12
+
13
+ metadata = MetaData()
14
+
15
+ class BasicModel(TimestampMixin, SQLModel):
16
+ """Base model without predefined primary key, but with timestamps."""
17
+
18
+ __abstract__ = True
19
+ metadata = metadata
20
+
21
+
22
+ class CoreModel(IdMixin, BasicModel):
23
+ """Default base model with BigInteger primary key and timestamps."""
24
+
25
+ __abstract__ = True
26
+
27
+
28
+ class User(CoreModel, AuditMixin, table=True):
29
+ name: str = Field(index=True)
30
+ email: str = Field(unique=True, index=True)
31
+ ```
32
+
33
+ The `CoreModel` automatically includes the `IdMixin` and `TimestampMixin`, giving your model an `id`, `created_at`, and `updated_at`. By including `AuditMixin`, you also track `created_by` and `updated_by`.
@@ -0,0 +1,25 @@
1
+ from sqlmodel import Field, MetaData, SQLModel
2
+ from tools2fast_fastapi.models.mixins import AuditMixin, IdMixin, TimestampMixin
3
+
4
+ metadata = MetaData()
5
+
6
+ class BasicModel(TimestampMixin, SQLModel):
7
+ """Base model without predefined primary key, but with timestamps."""
8
+
9
+ __abstract__ = True
10
+ metadata = metadata
11
+
12
+
13
+ class CoreModel(IdMixin, BasicModel):
14
+ """Default base model with BigInteger primary key and timestamps."""
15
+
16
+ __abstract__ = True
17
+
18
+ class User(CoreModel, AuditMixin, table=True):
19
+ name: str = Field(index=True)
20
+ email: str = Field(unique=True, index=True)
21
+
22
+ if __name__ == "__main__":
23
+ user = User(name="Test", email="test@example.com")
24
+ print("User ID:", user.id)
25
+ print("User Created At:", user.created_at)
@@ -0,0 +1,73 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "tools2fast-fastapi"
7
+ version = "0.1.0"
8
+ description = "Shared tools, mixins, and base services for FastAPI applications - Solautyc Team internal use"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = {file = "LICENSE"}
12
+ authors = [
13
+ {name = "Angel Daniel Sanchez Castillo", email = "angeldaniel.sanchezcastillo@gmail.com"}
14
+ ]
15
+ keywords = ["fastapi", "tools", "mixins", "services", "sqlmodel"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Framework :: FastAPI",
25
+ "Topic :: Software Development :: Libraries :: Python Modules",
26
+ ]
27
+
28
+ dependencies = [
29
+ "fastapi>=0.100.0",
30
+ "sqlmodel>=0.0.16",
31
+ # Add other common dependencies if needed
32
+ ]
33
+
34
+ [dependency-groups]
35
+ dev = [
36
+ "black",
37
+ "ruff",
38
+ "mypy>=1.0.0",
39
+ "build",
40
+ "twine",
41
+ "pre-commit",
42
+ ]
43
+ test = [
44
+ "pytest>=7.0.0",
45
+ "pytest-asyncio>=0.21.0",
46
+ "httpx>=0.24.0",
47
+ ]
48
+
49
+ [project.urls]
50
+ Homepage = "https://github.com/AngelDanielSanchezCastillo/tools2fast-fastapi"
51
+ Documentation = "https://github.com/AngelDanielSanchezCastillo/tools2fast-fastapi/tree/main/docs"
52
+ Repository = "https://github.com/AngelDanielSanchezCastillo/tools2fast-fastapi"
53
+ Issues = "https://github.com/AngelDanielSanchezCastillo/tools2fast-fastapi/issues"
54
+
55
+ [tool.setuptools]
56
+ package-dir = {"" = "src"}
57
+
58
+ [tool.setuptools.packages.find]
59
+ where = ["src"]
60
+ include = ["tools2fast_fastapi*"]
61
+
62
+ [tool.pytest.ini_options]
63
+ testpaths = ["tests"]
64
+ python_files = ["test_*.py"]
65
+ python_classes = ["Test*"]
66
+ python_functions = ["test_*"]
67
+ asyncio_mode = "auto"
68
+
69
+ [tool.mypy]
70
+ python_version = "3.10"
71
+ warn_return_any = true
72
+ warn_unused_configs = true
73
+ disallow_untyped_defs = false
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,11 @@
1
+ from .models.mixins import AuditMixin, IdMixin, TimestampMixin
2
+ from . import schemas
3
+ from .__version__ import __version__
4
+
5
+ __all__ = [
6
+ "IdMixin",
7
+ "TimestampMixin",
8
+ "AuditMixin",
9
+ "schemas",
10
+ "__version__",
11
+ ]
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"
@@ -0,0 +1,7 @@
1
+ from .mixins import IdMixin, TimestampMixin, AuditMixin
2
+
3
+ __all__ = [
4
+ "IdMixin",
5
+ "TimestampMixin",
6
+ "AuditMixin",
7
+ ]
@@ -0,0 +1,42 @@
1
+ from datetime import datetime, timezone
2
+
3
+ from sqlalchemy import DateTime, func
4
+ from sqlmodel import BigInteger, Field
5
+
6
+
7
+ class IdMixin:
8
+ """Mixin para proveer clave primaria autoincremental tipo BigInteger."""
9
+
10
+ id: int | None = Field(default=None, primary_key=True, index=True, sa_type=BigInteger)
11
+
12
+
13
+ class TimestampMixin:
14
+ """Mixin reutilizable para marcas de tiempo en UTC."""
15
+
16
+ created_at: datetime = Field(
17
+ default_factory=lambda: datetime.now(timezone.utc),
18
+ nullable=False,
19
+ sa_type=DateTime(timezone=True),
20
+ )
21
+ updated_at: datetime = Field(
22
+ default_factory=lambda: datetime.now(timezone.utc),
23
+ nullable=False,
24
+ sa_type=DateTime(timezone=True),
25
+ sa_column_kwargs={"onupdate": func.now()},
26
+ )
27
+
28
+
29
+ class AuditMixin:
30
+ """Mixin para rastrear el usuario que crea y actualiza un registro."""
31
+
32
+ created_by: int | None = Field(
33
+ default=None,
34
+ description="ID of the user who created this record.",
35
+ sa_type=BigInteger,
36
+ )
37
+ updated_by: int | None = Field(
38
+ default=None,
39
+ description="ID of the user who last updated this record.",
40
+ sa_type=BigInteger,
41
+ )
42
+
@@ -0,0 +1,7 @@
1
+ from .mixins import AuditMixin, IdMixin, TimestampMixin
2
+
3
+ __all__ = [
4
+ "IdMixin",
5
+ "TimestampMixin",
6
+ "AuditMixin",
7
+ ]
@@ -0,0 +1,23 @@
1
+ from datetime import datetime
2
+
3
+ from sqlmodel import SQLModel
4
+
5
+
6
+ class IdMixin(SQLModel):
7
+ """Schema mixin for resources that have an integer ID."""
8
+
9
+ id: int
10
+
11
+
12
+ class TimestampMixin(SQLModel):
13
+ """Schema mixin for resources that include created and updated timestamps."""
14
+
15
+ created_at: datetime
16
+ updated_at: datetime
17
+
18
+
19
+ class AuditMixin(SQLModel):
20
+ """Schema mixin for resources that include audit user IDs."""
21
+
22
+ created_by: int | None = None
23
+ updated_by: int | None = None
@@ -0,0 +1,84 @@
1
+ Metadata-Version: 2.4
2
+ Name: tools2fast-fastapi
3
+ Version: 0.1.0
4
+ Summary: Shared tools, mixins, and base services for FastAPI applications - Solautyc Team internal use
5
+ Author-email: Angel Daniel Sanchez Castillo <angeldaniel.sanchezcastillo@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Angel Daniel Sanchez Castillo
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/AngelDanielSanchezCastillo/tools2fast-fastapi
29
+ Project-URL: Documentation, https://github.com/AngelDanielSanchezCastillo/tools2fast-fastapi/tree/main/docs
30
+ Project-URL: Repository, https://github.com/AngelDanielSanchezCastillo/tools2fast-fastapi
31
+ Project-URL: Issues, https://github.com/AngelDanielSanchezCastillo/tools2fast-fastapi/issues
32
+ Keywords: fastapi,tools,mixins,services,sqlmodel
33
+ Classifier: Development Status :: 3 - Alpha
34
+ Classifier: Intended Audience :: Developers
35
+ Classifier: License :: OSI Approved :: MIT License
36
+ Classifier: Programming Language :: Python :: 3
37
+ Classifier: Programming Language :: Python :: 3.10
38
+ Classifier: Programming Language :: Python :: 3.11
39
+ Classifier: Programming Language :: Python :: 3.12
40
+ Classifier: Framework :: FastAPI
41
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
42
+ Requires-Python: >=3.10
43
+ Description-Content-Type: text/markdown
44
+ License-File: LICENSE
45
+ Requires-Dist: fastapi>=0.100.0
46
+ Requires-Dist: sqlmodel>=0.0.16
47
+ Dynamic: license-file
48
+
49
+ # Tools2Fast FastAPI
50
+
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
+
53
+ ## Installation
54
+
55
+ You can install this package from PyPI (if published) or use it locally within your workspace:
56
+
57
+ ```bash
58
+ pip install tools2fast-fastapi
59
+ ```
60
+
61
+ Locally with UV:
62
+ ```bash
63
+ uv pip install -e path/to/tools2fast-fastapi
64
+ ```
65
+
66
+ ## Features
67
+
68
+ - **SQLModel Mixins**: Standardized `IdMixin`, `TimestampMixin`, and `AuditMixin`.
69
+ - **Base Models**: Core models setup to be inherited across all entity definitions.
70
+ - **Shared Services**: Reusable services logic for basic CRUD and related queries (coming soon).
71
+
72
+ ## Documentation
73
+
74
+ See the `docs/` folder for more detailed instructions and usage guides:
75
+
76
+ - [Usage Guide](docs/guide.md)
77
+
78
+ ## Examples
79
+
80
+ Check the `examples/` folder for sample implementation.
81
+
82
+ ## License
83
+
84
+ This project is licensed under the MIT License.
@@ -0,0 +1,19 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ pyproject.toml
5
+ docs/guide.md
6
+ examples/example.py
7
+ src/tools2fast_fastapi/__init__.py
8
+ src/tools2fast_fastapi/__version__.py
9
+ src/tools2fast_fastapi.egg-info/PKG-INFO
10
+ src/tools2fast_fastapi.egg-info/SOURCES.txt
11
+ src/tools2fast_fastapi.egg-info/dependency_links.txt
12
+ src/tools2fast_fastapi.egg-info/requires.txt
13
+ src/tools2fast_fastapi.egg-info/top_level.txt
14
+ src/tools2fast_fastapi/models/__init__.py
15
+ src/tools2fast_fastapi/models/mixins.py
16
+ src/tools2fast_fastapi/schemas/__init__.py
17
+ src/tools2fast_fastapi/schemas/mixins.py
18
+ tests/test_initial.py
19
+ tests/test_schemas.py
@@ -0,0 +1,2 @@
1
+ fastapi>=0.100.0
2
+ sqlmodel>=0.0.16
@@ -0,0 +1 @@
1
+ tools2fast_fastapi
@@ -0,0 +1,29 @@
1
+ from sqlmodel import Field, MetaData, SQLModel
2
+ from tools2fast_fastapi.models.mixins import IdMixin, TimestampMixin
3
+
4
+ metadata = MetaData()
5
+
6
+
7
+ class BasicModel(TimestampMixin, SQLModel):
8
+ """Base model without predefined primary key, but with timestamps."""
9
+
10
+ __abstract__ = True
11
+ metadata = metadata
12
+
13
+
14
+ class CoreModel(IdMixin, BasicModel):
15
+ """Default base model with BigInteger primary key and timestamps."""
16
+
17
+ __abstract__ = True
18
+
19
+
20
+ class SampleModel(CoreModel, table=True):
21
+ name: str = Field(default="Test")
22
+
23
+
24
+ def test_model_creation():
25
+ model = SampleModel()
26
+ assert model.name == "Test"
27
+ assert model.created_at is not None
28
+ assert model.updated_at is not None
29
+ assert model.id is None # Initialized without it being set yet in DB
@@ -0,0 +1,12 @@
1
+ from datetime import datetime, timezone
2
+ from tools2fast_fastapi.schemas.mixins import IdMixin, TimestampMixin
3
+
4
+ def test_schema_mixins():
5
+ class TestSchema(IdMixin, TimestampMixin):
6
+ name: str
7
+
8
+ now = datetime.now(timezone.utc)
9
+ schema = TestSchema(id=1, created_at=now, updated_at=now, name="Test")
10
+ assert schema.id == 1
11
+ assert schema.name == "Test"
12
+ assert schema.created_at == now