sindripy 0.1.1__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.
Potentially problematic release.
This version of sindripy might be problematic. Click here for more details.
- sindripy-0.1.1/LICENSE +22 -0
- sindripy-0.1.1/PKG-INFO +144 -0
- sindripy-0.1.1/README.md +97 -0
- sindripy-0.1.1/pyproject.toml +124 -0
- sindripy-0.1.1/src/sindripy/__init__.py +11 -0
- sindripy-0.1.1/src/sindripy/_compat.py +15 -0
- sindripy-0.1.1/src/sindripy/mothers/__init__.py +24 -0
- sindripy-0.1.1/src/sindripy/mothers/identifiers/__init__.py +0 -0
- sindripy-0.1.1/src/sindripy/mothers/identifiers/string_uuid_primitives_mother.py +16 -0
- sindripy-0.1.1/src/sindripy/mothers/object_mother.py +10 -0
- sindripy-0.1.1/src/sindripy/mothers/primitives/__init__.py +0 -0
- sindripy-0.1.1/src/sindripy/mothers/primitives/boolean_primitives_mother.py +20 -0
- sindripy-0.1.1/src/sindripy/mothers/primitives/float_primitives_mother.py +30 -0
- sindripy-0.1.1/src/sindripy/mothers/primitives/integer_primitives_mother.py +36 -0
- sindripy-0.1.1/src/sindripy/mothers/primitives/list_primitives_mother.py +10 -0
- sindripy-0.1.1/src/sindripy/mothers/primitives/string_primitives_mother.py +48 -0
- sindripy-0.1.1/src/sindripy/py.typed +0 -0
- sindripy-0.1.1/src/sindripy/value_objects/__init__.py +29 -0
- sindripy-0.1.1/src/sindripy/value_objects/aggregate.py +312 -0
- sindripy-0.1.1/src/sindripy/value_objects/decorators/__init__.py +0 -0
- sindripy-0.1.1/src/sindripy/value_objects/decorators/validation.py +28 -0
- sindripy-0.1.1/src/sindripy/value_objects/errors/__init__.py +0 -0
- sindripy-0.1.1/src/sindripy/value_objects/errors/incorrect_value_type_error.py +12 -0
- sindripy-0.1.1/src/sindripy/value_objects/errors/invalid_id_format_error.py +8 -0
- sindripy-0.1.1/src/sindripy/value_objects/errors/required_value_error.py +8 -0
- sindripy-0.1.1/src/sindripy/value_objects/errors/sindri_validation_error.py +10 -0
- sindripy-0.1.1/src/sindripy/value_objects/identifiers/__init__.py +0 -0
- sindripy-0.1.1/src/sindripy/value_objects/identifiers/string_uuid.py +55 -0
- sindripy-0.1.1/src/sindripy/value_objects/primitives/__init__.py +0 -0
- sindripy-0.1.1/src/sindripy/value_objects/primitives/boolean.py +44 -0
- sindripy-0.1.1/src/sindripy/value_objects/primitives/float.py +44 -0
- sindripy-0.1.1/src/sindripy/value_objects/primitives/integer.py +44 -0
- sindripy-0.1.1/src/sindripy/value_objects/primitives/list.py +307 -0
- sindripy-0.1.1/src/sindripy/value_objects/primitives/string.py +43 -0
- sindripy-0.1.1/src/sindripy/value_objects/value_object.py +269 -0
sindripy-0.1.1/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 dimanu-py
|
|
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.
|
|
22
|
+
|
sindripy-0.1.1/PKG-INFO
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: sindripy
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Value Object and Object Mother patterns implementation for Python
|
|
5
|
+
Author: dimanu-py
|
|
6
|
+
Author-email: dimanu-py <dimanu.py@gmail.com>
|
|
7
|
+
License: MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2025 dimanu-py
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
|
|
29
|
+
Classifier: Typing :: Typed
|
|
30
|
+
Classifier: Programming Language :: Python
|
|
31
|
+
Classifier: Programming Language :: Python :: 3
|
|
32
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
36
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
37
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
38
|
+
Classifier: Intended Audience :: Developers
|
|
39
|
+
Classifier: Operating System :: OS Independent
|
|
40
|
+
Classifier: Topic :: Software Development :: Testing :: Unit
|
|
41
|
+
Classifier: Topic :: Software Development :: Testing :: BDD
|
|
42
|
+
Classifier: Framework :: FastAPI
|
|
43
|
+
Requires-Python: >=3.10, <3.14
|
|
44
|
+
Project-URL: documentation, https://dimanu-py.github.io/sindri/home/
|
|
45
|
+
Project-URL: repository, https://github.com/dimanu-py/sindri/
|
|
46
|
+
Description-Content-Type: text/markdown
|
|
47
|
+
|
|
48
|
+
<div align="center">
|
|
49
|
+
<h1>🛠️ Sindripy 🛠️</h1>
|
|
50
|
+
<strong>Easy use and customizable implementation for Value Object and Object Mother patterns.</strong>
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<p align="center">
|
|
54
|
+
<a href="https://dimanu-py.github.io/sindri/home/getting_started/">Getting Started</a> •
|
|
55
|
+
<a href="https://dimanu-py.github.io/sindri/value_objects/">Value Object Pattern</a> •
|
|
56
|
+
<a href="https://dimanu-py.github.io/sindri/object_mothers/">Object Mother Pattern</a> •
|
|
57
|
+
<a href="https://dimanu-py.github.io/sindri/home/contributing/">Contributing</a>
|
|
58
|
+
</p>
|
|
59
|
+
|
|
60
|
+
> [!NOTE]
|
|
61
|
+
> This project was generated using [Instant Python](https://github.com/dimanu-py/instant-python), a fast, easy and reliable project generator for Python projects.
|
|
62
|
+
|
|
63
|
+
<div align="center"><table><tr><td>
|
|
64
|
+
Sindri replaces ad hoc primitives and fragile validators with a consistent Value Object and Aggregate
|
|
65
|
+
toolkit you can adopt quickly.
|
|
66
|
+
Spin up validated value objects, aggregates, and test data with a simple and a small, focused API.
|
|
67
|
+
|
|
68
|
+
Sindripy provides a basic-high-customizable implementation to help you enforce
|
|
69
|
+
domain invariants and improve code quality with minimal effort.
|
|
70
|
+
|
|
71
|
+
<br>
|
|
72
|
+
|
|
73
|
+
<b>Why use sindripy?</b> Building your domain with Sindri lets you:
|
|
74
|
+
|
|
75
|
+
<ul style="list-style-type: none">
|
|
76
|
+
<li>⏱️ Cut domain modeling and validation to seconds</li>
|
|
77
|
+
<li>🛡️ Declare immutable, validated value objects with clear error messages</li>
|
|
78
|
+
<li>🧩 Model aggregates with explicit invariants and composition</li>
|
|
79
|
+
<li>🧪 Generate realistic test data via the Object Mother pattern</li>
|
|
80
|
+
<li>🧰 Start from ready made primitives and identifiers or extend with your own</li>
|
|
81
|
+
<li>🔧 Plug in custom validators, decorators, and typed primitives</li>
|
|
82
|
+
</ul>
|
|
83
|
+
|
|
84
|
+
</td></tr></table></div>
|
|
85
|
+
|
|
86
|
+
## Documentation
|
|
87
|
+
|
|
88
|
+
This section provides a high-level overview of the `sindripy` library, its features, and how to get started.
|
|
89
|
+
For detailed instructions and examples, please refer to the [full Sindripy documentation](https://dimanu-py.github.io/sindri/home/).
|
|
90
|
+
|
|
91
|
+
- [Installation](#installation)
|
|
92
|
+
- [Basic Usage](#basic-usage)
|
|
93
|
+
- [Contributing](#contributing)
|
|
94
|
+
|
|
95
|
+
### Need help?
|
|
96
|
+
|
|
97
|
+
- Join a discussion 💬 on [GitHub Discussions]
|
|
98
|
+
- [Raise an issue][GitHub Issues] on GitHub
|
|
99
|
+
|
|
100
|
+
[GitHub Discussions]: https://github.com/dimanu-py/sindri/discussions
|
|
101
|
+
[GitHub Issues]: https://github.com/dimanu-py/sindri/issues
|
|
102
|
+
|
|
103
|
+
## Installation
|
|
104
|
+
|
|
105
|
+
The latest version of `sindripy` can be installed from PyPI:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
pip install sindripy
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Requirements
|
|
112
|
+
|
|
113
|
+
Sindri tries to support the latest Python versions, we officially support from Python 3.10 to 3.13.
|
|
114
|
+
Older versions of Python may work, but they are not guaranteed to be compatible.
|
|
115
|
+
|
|
116
|
+
## Basic Usage
|
|
117
|
+
|
|
118
|
+
Here is a simple example of how to use `sindri` to create a value object and generate test data using an object mother.
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
from sindripy.value_objects import Integer, String
|
|
122
|
+
|
|
123
|
+
age = Integer(30)
|
|
124
|
+
name = String("John Doe")
|
|
125
|
+
|
|
126
|
+
print(f"Name: {name.value}, Age: {age.value}")
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
from sindripy.mothers import IntegerPrimitivesMother, StringPrimitivesMother
|
|
131
|
+
|
|
132
|
+
random_age = IntegerPrimitivesMother.any()
|
|
133
|
+
random_name = StringPrimitivesMother.any()
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
> [!NOTE]
|
|
137
|
+
> To learn more about advanced usage of value objects, including validation, custom value objects,
|
|
138
|
+
> complex objects like aggregates, visit the [Value Objects](https://dimanu-py.github.io/sindri/value_objects/)
|
|
139
|
+
> and [Object Mothers](https://dimanu-py.github.io/sindri/object_mothers) sections.
|
|
140
|
+
|
|
141
|
+
## Contributing
|
|
142
|
+
|
|
143
|
+
We welcome contributions to `sindripy`! If you have ideas, suggestions, or improvements, please check out our
|
|
144
|
+
[contributing guide](https://dimanu-py.github.io/sindri/home/contributing/) for details on how to get involved.
|
sindripy-0.1.1/README.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>🛠️ Sindripy 🛠️</h1>
|
|
3
|
+
<strong>Easy use and customizable implementation for Value Object and Object Mother patterns.</strong>
|
|
4
|
+
</div>
|
|
5
|
+
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a href="https://dimanu-py.github.io/sindri/home/getting_started/">Getting Started</a> •
|
|
8
|
+
<a href="https://dimanu-py.github.io/sindri/value_objects/">Value Object Pattern</a> •
|
|
9
|
+
<a href="https://dimanu-py.github.io/sindri/object_mothers/">Object Mother Pattern</a> •
|
|
10
|
+
<a href="https://dimanu-py.github.io/sindri/home/contributing/">Contributing</a>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
> [!NOTE]
|
|
14
|
+
> This project was generated using [Instant Python](https://github.com/dimanu-py/instant-python), a fast, easy and reliable project generator for Python projects.
|
|
15
|
+
|
|
16
|
+
<div align="center"><table><tr><td>
|
|
17
|
+
Sindri replaces ad hoc primitives and fragile validators with a consistent Value Object and Aggregate
|
|
18
|
+
toolkit you can adopt quickly.
|
|
19
|
+
Spin up validated value objects, aggregates, and test data with a simple and a small, focused API.
|
|
20
|
+
|
|
21
|
+
Sindripy provides a basic-high-customizable implementation to help you enforce
|
|
22
|
+
domain invariants and improve code quality with minimal effort.
|
|
23
|
+
|
|
24
|
+
<br>
|
|
25
|
+
|
|
26
|
+
<b>Why use sindripy?</b> Building your domain with Sindri lets you:
|
|
27
|
+
|
|
28
|
+
<ul style="list-style-type: none">
|
|
29
|
+
<li>⏱️ Cut domain modeling and validation to seconds</li>
|
|
30
|
+
<li>🛡️ Declare immutable, validated value objects with clear error messages</li>
|
|
31
|
+
<li>🧩 Model aggregates with explicit invariants and composition</li>
|
|
32
|
+
<li>🧪 Generate realistic test data via the Object Mother pattern</li>
|
|
33
|
+
<li>🧰 Start from ready made primitives and identifiers or extend with your own</li>
|
|
34
|
+
<li>🔧 Plug in custom validators, decorators, and typed primitives</li>
|
|
35
|
+
</ul>
|
|
36
|
+
|
|
37
|
+
</td></tr></table></div>
|
|
38
|
+
|
|
39
|
+
## Documentation
|
|
40
|
+
|
|
41
|
+
This section provides a high-level overview of the `sindripy` library, its features, and how to get started.
|
|
42
|
+
For detailed instructions and examples, please refer to the [full Sindripy documentation](https://dimanu-py.github.io/sindri/home/).
|
|
43
|
+
|
|
44
|
+
- [Installation](#installation)
|
|
45
|
+
- [Basic Usage](#basic-usage)
|
|
46
|
+
- [Contributing](#contributing)
|
|
47
|
+
|
|
48
|
+
### Need help?
|
|
49
|
+
|
|
50
|
+
- Join a discussion 💬 on [GitHub Discussions]
|
|
51
|
+
- [Raise an issue][GitHub Issues] on GitHub
|
|
52
|
+
|
|
53
|
+
[GitHub Discussions]: https://github.com/dimanu-py/sindri/discussions
|
|
54
|
+
[GitHub Issues]: https://github.com/dimanu-py/sindri/issues
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
The latest version of `sindripy` can be installed from PyPI:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install sindripy
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Requirements
|
|
65
|
+
|
|
66
|
+
Sindri tries to support the latest Python versions, we officially support from Python 3.10 to 3.13.
|
|
67
|
+
Older versions of Python may work, but they are not guaranteed to be compatible.
|
|
68
|
+
|
|
69
|
+
## Basic Usage
|
|
70
|
+
|
|
71
|
+
Here is a simple example of how to use `sindri` to create a value object and generate test data using an object mother.
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from sindripy.value_objects import Integer, String
|
|
75
|
+
|
|
76
|
+
age = Integer(30)
|
|
77
|
+
name = String("John Doe")
|
|
78
|
+
|
|
79
|
+
print(f"Name: {name.value}, Age: {age.value}")
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
from sindripy.mothers import IntegerPrimitivesMother, StringPrimitivesMother
|
|
84
|
+
|
|
85
|
+
random_age = IntegerPrimitivesMother.any()
|
|
86
|
+
random_name = StringPrimitivesMother.any()
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
> [!NOTE]
|
|
90
|
+
> To learn more about advanced usage of value objects, including validation, custom value objects,
|
|
91
|
+
> complex objects like aggregates, visit the [Value Objects](https://dimanu-py.github.io/sindri/value_objects/)
|
|
92
|
+
> and [Object Mothers](https://dimanu-py.github.io/sindri/object_mothers) sections.
|
|
93
|
+
|
|
94
|
+
## Contributing
|
|
95
|
+
|
|
96
|
+
We welcome contributions to `sindripy`! If you have ideas, suggestions, or improvements, please check out our
|
|
97
|
+
[contributing guide](https://dimanu-py.github.io/sindri/home/contributing/) for details on how to get involved.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "sindripy"
|
|
3
|
+
version = "0.1.1"
|
|
4
|
+
description = "Value Object and Object Mother patterns implementation for Python"
|
|
5
|
+
authors = [{name = "dimanu-py", email = "dimanu.py@gmail.com"}]
|
|
6
|
+
dependencies = [
|
|
7
|
+
]
|
|
8
|
+
requires-python = ">=3.10, <3.14"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { file = "LICENSE" }
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Typing :: Typed",
|
|
13
|
+
"Programming Language :: Python",
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Programming Language :: Python :: 3.10",
|
|
16
|
+
"Programming Language :: Python :: 3.11",
|
|
17
|
+
"Programming Language :: Python :: 3.12",
|
|
18
|
+
"Programming Language :: Python :: 3.13",
|
|
19
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
20
|
+
"Topic :: Software Development :: Libraries",
|
|
21
|
+
"Intended Audience :: Developers",
|
|
22
|
+
"Operating System :: OS Independent",
|
|
23
|
+
"Topic :: Software Development :: Testing :: Unit",
|
|
24
|
+
"Topic :: Software Development :: Testing :: BDD",
|
|
25
|
+
"Framework :: FastAPI"
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
documentation = "https://dimanu-py.github.io/sindri/home/"
|
|
30
|
+
repository = "https://github.com/dimanu-py/sindri/"
|
|
31
|
+
|
|
32
|
+
[dependency-groups]
|
|
33
|
+
dev = [
|
|
34
|
+
{include-group = "lint"},
|
|
35
|
+
{include-group = "test"},
|
|
36
|
+
{include-group = "release"},
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
release = [
|
|
40
|
+
"python-semantic-release",
|
|
41
|
+
]
|
|
42
|
+
lint = [
|
|
43
|
+
"mypy",
|
|
44
|
+
"ruff",
|
|
45
|
+
"pip-audit",
|
|
46
|
+
"pre-commit",
|
|
47
|
+
]
|
|
48
|
+
test = [
|
|
49
|
+
"expects>=0.9.0",
|
|
50
|
+
"faker",
|
|
51
|
+
"pytest",
|
|
52
|
+
"pytest-asyncio",
|
|
53
|
+
"pytest-sugar>=1.1.1",
|
|
54
|
+
]
|
|
55
|
+
docs = [
|
|
56
|
+
"mkdocs>=1.6.1",
|
|
57
|
+
"mkdocs-literate-nav>=0.6.2",
|
|
58
|
+
"mkdocs-macros-plugin>=1.4.0",
|
|
59
|
+
"mkdocs-material>=9.6.21",
|
|
60
|
+
"mkdocs-section-index>=0.3.10",
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
[tool.ruff]
|
|
64
|
+
line-length = 120
|
|
65
|
+
|
|
66
|
+
[tool.ruff.lint]
|
|
67
|
+
select = ["E", "F", "W", "B", "C4", "UP", "I"]
|
|
68
|
+
ignore = ["B008", "E501"]
|
|
69
|
+
|
|
70
|
+
[tool.ruff.lint.isort]
|
|
71
|
+
known-first-party = ["value_crafter", "test"]
|
|
72
|
+
|
|
73
|
+
[tool.ruff.format]
|
|
74
|
+
quote-style = "double"
|
|
75
|
+
indent-style = "space"
|
|
76
|
+
skip-magic-trailing-comma = false
|
|
77
|
+
|
|
78
|
+
[build-system]
|
|
79
|
+
requires = ["uv_build>=0.8.22,<0.9.0"]
|
|
80
|
+
build-backend = "uv_build"
|
|
81
|
+
|
|
82
|
+
[tool.pytest.ini_options]
|
|
83
|
+
markers = [
|
|
84
|
+
"unit: mark a test as a unit test",
|
|
85
|
+
"acceptance: mark a test as an acceptance test",
|
|
86
|
+
"integration: mark a test as an integration test",
|
|
87
|
+
]
|
|
88
|
+
testpaths = ["test"]
|
|
89
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
90
|
+
asyncio_mode = "auto"
|
|
91
|
+
|
|
92
|
+
[tool.semantic_release]
|
|
93
|
+
version_toml = ["pyproject.toml:project.version"]
|
|
94
|
+
version_variables = ["src/sindripy/__init__.py:__version__"]
|
|
95
|
+
commit_message = "bump: new version {version} created"
|
|
96
|
+
commit_parser = "conventional"
|
|
97
|
+
major_on_zero = false
|
|
98
|
+
allow_zero_version = true
|
|
99
|
+
no_git_verify = false
|
|
100
|
+
tag_format = "{version}"
|
|
101
|
+
build_command = """
|
|
102
|
+
pip install -e '.[build]'
|
|
103
|
+
uv lock --upgrade-package instant-python
|
|
104
|
+
git add uv.lock
|
|
105
|
+
"""
|
|
106
|
+
|
|
107
|
+
[tool.semantic_release.commit_parser_options]
|
|
108
|
+
minor_tags = ["feat"]
|
|
109
|
+
patch_tags = ["fix", "perf", "refactor", "test", "build"]
|
|
110
|
+
allowed_tags = ["feat", "fix", "refactor", "perf", "build"]
|
|
111
|
+
default_bump_level = 0
|
|
112
|
+
parse_squash_commits = false
|
|
113
|
+
ignore_merge_commits = true
|
|
114
|
+
|
|
115
|
+
[tool.semantic_release.changelog]
|
|
116
|
+
changelog_file = "CHANGELOG.md"
|
|
117
|
+
exclude_commit_patterns = ['''^Merge pull request #''', '''^Merge branch ''']
|
|
118
|
+
mode = "update"
|
|
119
|
+
#template_dir = "docs/changelog"
|
|
120
|
+
|
|
121
|
+
[tool.semantic_release.changelog.default_templates]
|
|
122
|
+
changelog_file = "CHANGELOG"
|
|
123
|
+
output_format = "md"
|
|
124
|
+
mask_initial_release = false
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""Top level package for the value-crafter library.
|
|
2
|
+
|
|
3
|
+
This module exposes the most common entry points so the public API is
|
|
4
|
+
available through the ``sindripy`` namespace when the library is
|
|
5
|
+
installed as a dependency.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from src.sindripy import mothers, value_objects
|
|
9
|
+
|
|
10
|
+
__all__ = ["mothers", "value_objects"]
|
|
11
|
+
__version__ = "0.1.1"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Compatibility helpers for typing features across Python versions."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
from typing import Self
|
|
7
|
+
except ImportError:
|
|
8
|
+
from typing_extensions import Self
|
|
9
|
+
|
|
10
|
+
try:
|
|
11
|
+
from typing import override
|
|
12
|
+
except ImportError:
|
|
13
|
+
from typing_extensions import override
|
|
14
|
+
|
|
15
|
+
__all__ = ["Self", "override"]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Public facade for object mother helpers.
|
|
2
|
+
|
|
3
|
+
This module re-exports the available object mother implementations so
|
|
4
|
+
that projects using this library can import them from
|
|
5
|
+
``sindripy.mothers`` directly.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from src.sindripy.mothers.identifiers.string_uuid_primitives_mother import StringUuidPrimitivesMother
|
|
9
|
+
from src.sindripy.mothers.object_mother import ObjectMother
|
|
10
|
+
from src.sindripy.mothers.primitives.boolean_primitives_mother import BooleanPrimitivesMother
|
|
11
|
+
from src.sindripy.mothers.primitives.float_primitives_mother import FloatPrimitivesMother
|
|
12
|
+
from src.sindripy.mothers.primitives.integer_primitives_mother import IntegerPrimitivesMother
|
|
13
|
+
from src.sindripy.mothers.primitives.list_primitives_mother import ListPrimitivesMother
|
|
14
|
+
from src.sindripy.mothers.primitives.string_primitives_mother import StringPrimitivesMother
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"ObjectMother",
|
|
18
|
+
"BooleanPrimitivesMother",
|
|
19
|
+
"FloatPrimitivesMother",
|
|
20
|
+
"IntegerPrimitivesMother",
|
|
21
|
+
"ListPrimitivesMother",
|
|
22
|
+
"StringPrimitivesMother",
|
|
23
|
+
"StringUuidPrimitivesMother",
|
|
24
|
+
]
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from src.sindripy.mothers.object_mother import ObjectMother
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class StringUuidPrimitivesMother(ObjectMother):
|
|
5
|
+
"""Generate string UUID primitive values for testing."""
|
|
6
|
+
|
|
7
|
+
@classmethod
|
|
8
|
+
def any(cls) -> str:
|
|
9
|
+
"""Generate any random UUID string value."""
|
|
10
|
+
return cls._faker().uuid4()
|
|
11
|
+
|
|
12
|
+
@classmethod
|
|
13
|
+
def invalid(cls) -> str:
|
|
14
|
+
"""Generate an invalid UUID string."""
|
|
15
|
+
valid_uuid = cls.any()
|
|
16
|
+
return valid_uuid[:-4]
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from src.sindripy.mothers.object_mother import ObjectMother
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class BooleanPrimitivesMother(ObjectMother):
|
|
5
|
+
"""Generate boolean primitive values for testing."""
|
|
6
|
+
|
|
7
|
+
@classmethod
|
|
8
|
+
def any(cls) -> bool:
|
|
9
|
+
"""Generate any random boolean value."""
|
|
10
|
+
return cls._faker().boolean()
|
|
11
|
+
|
|
12
|
+
@staticmethod
|
|
13
|
+
def true() -> bool:
|
|
14
|
+
"""Generate True value."""
|
|
15
|
+
return True
|
|
16
|
+
|
|
17
|
+
@staticmethod
|
|
18
|
+
def false() -> bool:
|
|
19
|
+
"""Generate False value."""
|
|
20
|
+
return False
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from src.sindripy.mothers.object_mother import ObjectMother
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class FloatPrimitivesMother(ObjectMother):
|
|
5
|
+
"""Generate float primitive values for testing."""
|
|
6
|
+
|
|
7
|
+
@classmethod
|
|
8
|
+
def any(cls) -> float:
|
|
9
|
+
"""Generate any random float value."""
|
|
10
|
+
return cls._faker().pyfloat()
|
|
11
|
+
|
|
12
|
+
@classmethod
|
|
13
|
+
def create(cls, is_positive: bool | None = None, min_value: float = -1000.0, max_value: float = 10000.0) -> float:
|
|
14
|
+
"""Generate a float value with specified constraints."""
|
|
15
|
+
return cls._faker().pyfloat(positive=is_positive, min_value=min_value, max_value=max_value)
|
|
16
|
+
|
|
17
|
+
@classmethod
|
|
18
|
+
def positive(cls) -> float:
|
|
19
|
+
"""Generate a positive float value greater than zero."""
|
|
20
|
+
return cls._faker().pyfloat(positive=True, min_value=0.1)
|
|
21
|
+
|
|
22
|
+
@classmethod
|
|
23
|
+
def negative(cls) -> float:
|
|
24
|
+
"""Generate a negative float value less than zero."""
|
|
25
|
+
return cls._faker().pyfloat(positive=False, max_value=-0.1)
|
|
26
|
+
|
|
27
|
+
@staticmethod
|
|
28
|
+
def zero() -> float:
|
|
29
|
+
"""Generate zero as a float."""
|
|
30
|
+
return 0.0
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from src.sindripy.mothers.object_mother import ObjectMother
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class IntegerPrimitivesMother(ObjectMother):
|
|
5
|
+
"""Generate int primitive values for testing."""
|
|
6
|
+
|
|
7
|
+
@classmethod
|
|
8
|
+
def any(cls) -> int:
|
|
9
|
+
"""Generate any random int value."""
|
|
10
|
+
return cls._faker().random_int()
|
|
11
|
+
|
|
12
|
+
@classmethod
|
|
13
|
+
def create(cls, is_positive: bool | None = None, min_value: int = -10000, max_value: int = 1000) -> int:
|
|
14
|
+
"""Generate an int value with specified constraints."""
|
|
15
|
+
if is_positive:
|
|
16
|
+
return cls._faker().random_int(min=1, max=abs(max_value))
|
|
17
|
+
|
|
18
|
+
if is_positive is False:
|
|
19
|
+
return cls._faker().random_int(min=-abs(min_value), max=-1)
|
|
20
|
+
|
|
21
|
+
return cls._faker().random_int(min=min_value, max=max_value)
|
|
22
|
+
|
|
23
|
+
@classmethod
|
|
24
|
+
def positive(cls) -> int:
|
|
25
|
+
"""Generate a positive int value greater than zero."""
|
|
26
|
+
return cls._faker().random_int(min=1)
|
|
27
|
+
|
|
28
|
+
@classmethod
|
|
29
|
+
def negative(cls) -> int:
|
|
30
|
+
"""Generate a negative int value less than zero."""
|
|
31
|
+
return cls._faker().random_int(min=-(2**31), max=-1)
|
|
32
|
+
|
|
33
|
+
@staticmethod
|
|
34
|
+
def zero() -> int:
|
|
35
|
+
"""Generate zero as an int."""
|
|
36
|
+
return 0
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from src.sindripy.mothers.object_mother import ObjectMother
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class StringPrimitivesMother(ObjectMother):
|
|
5
|
+
"""Generate string primitive values for testing."""
|
|
6
|
+
|
|
7
|
+
@classmethod
|
|
8
|
+
def any(cls) -> str:
|
|
9
|
+
"""Generate any random string value."""
|
|
10
|
+
return cls._faker().word()
|
|
11
|
+
|
|
12
|
+
@staticmethod
|
|
13
|
+
def empty() -> str:
|
|
14
|
+
return ""
|
|
15
|
+
|
|
16
|
+
@classmethod
|
|
17
|
+
def containing_character(cls, character: str) -> str:
|
|
18
|
+
"""Generate a string containing a specific character in a random position (not at beginning or end)."""
|
|
19
|
+
base_word = cls._faker().word()
|
|
20
|
+
|
|
21
|
+
if len(base_word) < 3:
|
|
22
|
+
base_word = cls._faker().word() + cls._faker().word()
|
|
23
|
+
|
|
24
|
+
character_position = cls._faker().random_int(min=1, max=len(base_word) - 1)
|
|
25
|
+
|
|
26
|
+
return base_word[:character_position] + character + base_word[character_position + 1 :]
|
|
27
|
+
|
|
28
|
+
@classmethod
|
|
29
|
+
def ending_with(cls, character: str) -> str:
|
|
30
|
+
"""Generate a string ending with a specific character."""
|
|
31
|
+
return cls._faker().word() + character
|
|
32
|
+
|
|
33
|
+
@classmethod
|
|
34
|
+
def beginning_with(cls, character: str) -> str:
|
|
35
|
+
"""Generate a string beginning with a specific character."""
|
|
36
|
+
return character + cls._faker().word()
|
|
37
|
+
|
|
38
|
+
@classmethod
|
|
39
|
+
def with_length(cls, length: int) -> str:
|
|
40
|
+
"""Generate a string with specific length. If length is less than or equal to 0, return an empty string."""
|
|
41
|
+
if length <= 0:
|
|
42
|
+
return ""
|
|
43
|
+
return cls._faker().pystr(min_chars=length, max_chars=length)
|
|
44
|
+
|
|
45
|
+
@classmethod
|
|
46
|
+
def text(cls) -> str:
|
|
47
|
+
"""Generate a text string (can contain spaces and punctuation)."""
|
|
48
|
+
return cls._faker().text(max_nb_chars=200)
|
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""Public facade for value object implementations.
|
|
2
|
+
|
|
3
|
+
This module re-exports the most common value objects so they can be
|
|
4
|
+
imported directly from :mod:`sindripy.value_object`.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from src.sindripy.value_objects.aggregate import Aggregate
|
|
8
|
+
from src.sindripy.value_objects.decorators.validation import validate
|
|
9
|
+
from src.sindripy.value_objects.errors.sindri_validation_error import SindriValidationError
|
|
10
|
+
from src.sindripy.value_objects.identifiers.string_uuid import StringUuid
|
|
11
|
+
from src.sindripy.value_objects.primitives.boolean import Boolean
|
|
12
|
+
from src.sindripy.value_objects.primitives.float import Float
|
|
13
|
+
from src.sindripy.value_objects.primitives.integer import Integer
|
|
14
|
+
from src.sindripy.value_objects.primitives.list import List
|
|
15
|
+
from src.sindripy.value_objects.primitives.string import String
|
|
16
|
+
from src.sindripy.value_objects.value_object import ValueObject
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"Aggregate",
|
|
20
|
+
"validate",
|
|
21
|
+
"StringUuid",
|
|
22
|
+
"Boolean",
|
|
23
|
+
"Float",
|
|
24
|
+
"Integer",
|
|
25
|
+
"List",
|
|
26
|
+
"String",
|
|
27
|
+
"ValueObject",
|
|
28
|
+
"SindriValidationError",
|
|
29
|
+
]
|