capper 0.4.1__tar.gz → 1.0.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.
- capper-1.0.0/LICENSE +22 -0
- capper-1.0.0/PKG-INFO +380 -0
- capper-1.0.0/README.md +315 -0
- {capper-0.4.1 → capper-1.0.0}/capper/__init__.py +1 -1
- {capper-0.4.1 → capper-1.0.0}/capper/cli.py +29 -4
- {capper-0.4.1 → capper-1.0.0}/capper/tests/test_cli.py +1 -0
- {capper-0.4.1 → capper-1.0.0}/capper/tests/test_edge_cases.py +2 -2
- capper-1.0.0/capper.egg-info/PKG-INFO +380 -0
- {capper-0.4.1 → capper-1.0.0}/capper.egg-info/SOURCES.txt +1 -0
- {capper-0.4.1 → capper-1.0.0}/pyproject.toml +16 -1
- capper-0.4.1/PKG-INFO +0 -228
- capper-0.4.1/README.md +0 -200
- capper-0.4.1/capper.egg-info/PKG-INFO +0 -228
- {capper-0.4.1 → capper-1.0.0}/capper/_deprecations.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper/barcode.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper/base.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper/color.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper/commerce.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper/date_time.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper/examples/user_factory.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper/file.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper/finance.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper/geo.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper/internet.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper/misc.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper/person.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper/phone.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper/registry.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper/strategies.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper/tests/__init__.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper/tests/benchmark_core.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper/tests/conftest.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper/tests/test_deprecations.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper/tests/test_docs_examples.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper/tests/test_hypothesis_strategies.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper/tests/test_polyfactory_integration.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper/tests/test_thread_safety.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper/tests/test_types.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper/text.py +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper.egg-info/dependency_links.txt +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper.egg-info/entry_points.txt +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper.egg-info/requires.txt +0 -0
- {capper-0.4.1 → capper-1.0.0}/capper.egg-info/top_level.txt +0 -0
- {capper-0.4.1 → capper-1.0.0}/setup.cfg +0 -0
capper-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Odos Matthews
|
|
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
|
+
|
capper-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: capper
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Semantic, typed wrappers for Faker with automatic Polyfactory integration
|
|
5
|
+
Author-email: Odos Matthews <odosmatthews@gmail.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Odos Matthews
|
|
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
|
+
|
|
29
|
+
Project-URL: Documentation, https://github.com/eddiethedean/capper#readme
|
|
30
|
+
Project-URL: Repository, https://github.com/eddiethedean/capper
|
|
31
|
+
Keywords: faker,testing,factories,polyfactory,hypothesis,pydantic
|
|
32
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
33
|
+
Classifier: Intended Audience :: Developers
|
|
34
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
35
|
+
Classifier: Programming Language :: Python
|
|
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: Programming Language :: Python :: 3.13
|
|
41
|
+
Classifier: Topic :: Software Development :: Testing
|
|
42
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
43
|
+
Requires-Python: >=3.10
|
|
44
|
+
Description-Content-Type: text/markdown
|
|
45
|
+
License-File: LICENSE
|
|
46
|
+
Requires-Dist: Faker>=20.0
|
|
47
|
+
Requires-Dist: Polyfactory>=2.0
|
|
48
|
+
Provides-Extra: pydantic
|
|
49
|
+
Requires-Dist: pydantic>=2.0; extra == "pydantic"
|
|
50
|
+
Provides-Extra: hypothesis
|
|
51
|
+
Requires-Dist: hypothesis>=6.0; extra == "hypothesis"
|
|
52
|
+
Provides-Extra: dev
|
|
53
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
54
|
+
Requires-Dist: pytest-benchmark>=4.0; extra == "dev"
|
|
55
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
56
|
+
Requires-Dist: pytest-xdist>=3.0; extra == "dev"
|
|
57
|
+
Requires-Dist: pydantic>=2.0; extra == "dev"
|
|
58
|
+
Requires-Dist: ruff>=0.4; extra == "dev"
|
|
59
|
+
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
60
|
+
Requires-Dist: hypothesis>=6.0; extra == "dev"
|
|
61
|
+
Provides-Extra: docs
|
|
62
|
+
Requires-Dist: mkdocs>=1.5; extra == "docs"
|
|
63
|
+
Requires-Dist: mkdocstrings[python]>=0.24; extra == "docs"
|
|
64
|
+
Dynamic: license-file
|
|
65
|
+
|
|
66
|
+
# Capper
|
|
67
|
+
|
|
68
|
+
[](https://pypi.org/project/capper/)
|
|
69
|
+
[](https://pypi.org/project/capper/)
|
|
70
|
+
[)](https://github.com/eddiethedean/capper/actions/workflows/ci.yml)
|
|
71
|
+
[](https://capper.readthedocs.io/en/latest/)
|
|
72
|
+
[](https://docs.astral.sh/ruff/)
|
|
73
|
+
[](https://mypy-lang.org/)
|
|
74
|
+
|
|
75
|
+
Semantic, typed wrappers for [Faker](https://faker.readthedocs.io/) with automatic [Polyfactory](https://polyfactory.litestar.dev/) integration.
|
|
76
|
+
|
|
77
|
+
**Source:** [github.com/eddiethedean/capper](https://github.com/eddiethedean/capper) · **Docs:** [capper.readthedocs.io](https://capper.readthedocs.io/en/latest/)
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## What is Capper?
|
|
82
|
+
|
|
83
|
+
Capper gives you **semantic Faker types** (like `Name`, `Email`, `Price`) that:
|
|
84
|
+
|
|
85
|
+
- **Zero configuration**: just import a type and use it in your models; Polyfactory knows how to generate values.
|
|
86
|
+
- **Strongly typed**: your models communicate intent instead of bare `str` fields.
|
|
87
|
+
- **Multi-backend**: works with Pydantic, dataclasses, attrs, and other Polyfactory-supported model types.
|
|
88
|
+
- **Thread-safe & reproducible**: per-thread Faker with helpers for seeding and locales.
|
|
89
|
+
|
|
90
|
+
You import types from the top level:
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
from capper import Name, Email
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
and use them anywhere you would use a string (or the relevant base type).
|
|
97
|
+
|
|
98
|
+
For the full story, see the **[Capper documentation](https://capper.readthedocs.io/en/latest/)**.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Installation
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
pip install capper
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
- **Python**: 3.10+
|
|
109
|
+
- **Core deps**: Faker ≥ 20.0, Polyfactory ≥ 2.0 (installed automatically)
|
|
110
|
+
- **Optional extras**:
|
|
111
|
+
- **Pydantic support**: `pip install capper[pydantic]`
|
|
112
|
+
- **Hypothesis strategies**: `pip install capper[hypothesis]`
|
|
113
|
+
|
|
114
|
+
Step‑by‑step instructions live in the **[Getting started guide](https://capper.readthedocs.io/en/latest/user_guides/getting_started/)**.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Quick example
|
|
119
|
+
|
|
120
|
+
Using Capper with a Pydantic model and Polyfactory:
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
from pydantic import BaseModel
|
|
124
|
+
from capper import Name, Email
|
|
125
|
+
from polyfactory.factories.pydantic_factory import ModelFactory
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
class User(BaseModel):
|
|
129
|
+
name: Name
|
|
130
|
+
email: Email
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
class UserFactory(ModelFactory[User]):
|
|
134
|
+
pass
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
if __name__ == "__main__":
|
|
138
|
+
user = UserFactory.build()
|
|
139
|
+
print(user)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
For more patterns (dataclasses and attrs, FastAPI, Django-style service layers, seeding, and custom types), see the **[User guides](https://capper.readthedocs.io/en/latest/#user-guides)**.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## CLI
|
|
147
|
+
|
|
148
|
+
Generate fake values from the command line:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
capper generate Name Email --count 5
|
|
152
|
+
capper generate Name Email --count 3 --seed 42
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
- **Types**: same names as the Python types (e.g. `Name`, `Email`, `Address`).
|
|
156
|
+
- **Flags**:
|
|
157
|
+
- **`-n` / `--count`**: number of rows
|
|
158
|
+
- **`-s` / `--seed`**: seed for reproducible output
|
|
159
|
+
|
|
160
|
+
CLI usage examples are covered in the getting started and models/factories guides on Read the Docs.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Types and providers
|
|
165
|
+
|
|
166
|
+
Capper exports all public types from the top level, for example:
|
|
167
|
+
|
|
168
|
+
```python
|
|
169
|
+
from capper import Name, FirstName, LastName, Address, Email, Price
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
To see:
|
|
173
|
+
|
|
174
|
+
- the **full list of types**, and
|
|
175
|
+
- which **Faker provider** each one uses,
|
|
176
|
+
|
|
177
|
+
visit the **[Faker providers](https://capper.readthedocs.io/en/latest/FAKER_PROVIDERS/)** page.
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Documentation
|
|
182
|
+
|
|
183
|
+
Most detail lives in the hosted docs:
|
|
184
|
+
|
|
185
|
+
- **Docs home**: <https://capper.readthedocs.io/en/latest/>
|
|
186
|
+
- **User guides** (with runnable examples):
|
|
187
|
+
- [Getting started](https://capper.readthedocs.io/en/latest/user_guides/getting_started/)
|
|
188
|
+
- [Models and factories](https://capper.readthedocs.io/en/latest/user_guides/models_and_factories/)
|
|
189
|
+
- [Reproducible data](https://capper.readthedocs.io/en/latest/user_guides/reproducible_data/)
|
|
190
|
+
- [Custom types](https://capper.readthedocs.io/en/latest/user_guides/custom_types/)
|
|
191
|
+
- [FastAPI + Pydantic](https://capper.readthedocs.io/en/latest/user_guides/fastapi_pydantic/)
|
|
192
|
+
- [Django patterns](https://capper.readthedocs.io/en/latest/user_guides/django_patterns/)
|
|
193
|
+
- [Dataclasses and attrs](https://capper.readthedocs.io/en/latest/user_guides/dataclasses_and_attrs/)
|
|
194
|
+
- [Test setup templates](https://capper.readthedocs.io/en/latest/user_guides/test_setup_templates/)
|
|
195
|
+
- [Project structure](https://capper.readthedocs.io/en/latest/user_guides/project_structure/)
|
|
196
|
+
- **Types & API**:
|
|
197
|
+
- [Faker provider mapping](https://capper.readthedocs.io/en/latest/FAKER_PROVIDERS/)
|
|
198
|
+
- [API reference](https://capper.readthedocs.io/en/latest/api/)
|
|
199
|
+
- **Design & roadmap**:
|
|
200
|
+
- [Package plan](https://capper.readthedocs.io/en/latest/capper_package_plan/)
|
|
201
|
+
- [Roadmap](https://capper.readthedocs.io/en/latest/ROADMAP/)
|
|
202
|
+
- **Stability & support**:
|
|
203
|
+
- [Compatibility](https://capper.readthedocs.io/en/latest/compatibility/)
|
|
204
|
+
- [Security](https://capper.readthedocs.io/en/latest/SECURITY/)
|
|
205
|
+
|
|
206
|
+
If you are unsure where to start, begin at the docs home and follow the “User guides” flow.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Compatibility and support
|
|
211
|
+
|
|
212
|
+
- **Runtime targets**: Python 3.10+, Faker ≥ 20.0, Polyfactory ≥ 2.0.
|
|
213
|
+
- **Semantic versioning**: Capper follows SemVer; the 1.x line maintains a stable public API.
|
|
214
|
+
- **Support & backports**: policy, supported versions, and backport rules are described in the **[Compatibility](https://capper.readthedocs.io/en/latest/compatibility/)** docs.
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Development
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
pip install -e ".[dev]"
|
|
222
|
+
pytest capper/tests
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
- **Lint & format**: `ruff format .` and `ruff check .`
|
|
226
|
+
- **Type checking**: `mypy capper`
|
|
227
|
+
- **Coverage**:
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
pytest capper/tests --cov=capper --cov-report=term-missing --cov-fail-under=98
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
For contributor guidance (branching, testing, release process), see `CONTRIBUTING.md` and the maintenance‑oriented guides on Read the Docs.
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## Security
|
|
238
|
+
|
|
239
|
+
- **CI security checks**:
|
|
240
|
+
- `pip-audit` runs in CI to scan dependencies.
|
|
241
|
+
- A scheduled “latest deps” workflow tests Capper against current Faker and Polyfactory releases.
|
|
242
|
+
- **Policy & reporting**: see the **[Security page](https://capper.readthedocs.io/en/latest/SECURITY/)** for how to report issues and which versions are supported.
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## License
|
|
247
|
+
|
|
248
|
+
Capper is licensed under the **MIT License**. See `LICENSE` for details.
|
|
249
|
+
|
|
250
|
+
# Capper
|
|
251
|
+
|
|
252
|
+
[](https://pypi.org/project/capper/)
|
|
253
|
+
[](https://pypi.org/project/capper/)
|
|
254
|
+
[)](https://github.com/eddiethedean/capper/actions/workflows/ci.yml)
|
|
255
|
+
[](https://capper.readthedocs.io/en/latest/)
|
|
256
|
+
[](https://docs.astral.sh/ruff/)
|
|
257
|
+
[](https://mypy-lang.org/)
|
|
258
|
+
|
|
259
|
+
Semantic, typed wrappers for [Faker](https://faker.readthedocs.io/) with automatic [Polyfactory](https://polyfactory.litestar.dev/) integration.
|
|
260
|
+
|
|
261
|
+
**Source:** [github.com/eddiethedean/capper](https://github.com/eddiethedean/capper)
|
|
262
|
+
|
|
263
|
+
## CI pipeline
|
|
264
|
+
|
|
265
|
+
The `ci.yml` workflow runs on pushes and PRs to `main` and includes:
|
|
266
|
+
|
|
267
|
+
- **Linting:** `ruff check .` and `ruff format --check .`
|
|
268
|
+
- **Type checking:** `mypy capper`
|
|
269
|
+
- **Tests:** `pytest -n auto capper/tests -v -m "not benchmark" --cov=capper --cov-report=term-missing --cov-fail-under=98`
|
|
270
|
+
- **Docs:** `mkdocs build --strict`
|
|
271
|
+
|
|
272
|
+
## Why Capper?
|
|
273
|
+
|
|
274
|
+
- **Zero config** — Import a type; Polyfactory uses the right Faker provider. No manual registration.
|
|
275
|
+
- **Typed** — Use `Name`, `Email`, `PhoneNumber`, etc. in your models for clear intent and IDE support.
|
|
276
|
+
- **Multi-backend** — Works with Pydantic, dataclasses, attrs, and other [Polyfactory-supported](https://polyfactory.litestar.dev/) model types.
|
|
277
|
+
- **Thread-safe** — Per-thread Faker via a proxy; seeding and locales are isolated per thread, so concurrent tests are safe.
|
|
278
|
+
- **Optional Pydantic** — Install `capper` alone for dataclasses/attrs; add `capper[pydantic]` when you use Pydantic models.
|
|
279
|
+
|
|
280
|
+
## Install
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
pip install capper
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
Requires **Python 3.10+**, **Faker >= 20.0**, and **Polyfactory >= 2.0**. Optional extras:
|
|
287
|
+
|
|
288
|
+
- **Pydantic** (for Pydantic models): `pip install capper[pydantic]`
|
|
289
|
+
- **Hypothesis** (for property-based tests with `st.from_type(...)`): `pip install capper[hypothesis]`
|
|
290
|
+
|
|
291
|
+
## Usage
|
|
292
|
+
|
|
293
|
+
- **Quick start**: define a Pydantic model or dataclass using Capper types (e.g. `Name`, `Email`), create a Polyfactory factory, and call `Factory.build()` / `Factory.batch()`.
|
|
294
|
+
- **Guided examples**: see the docs:
|
|
295
|
+
- [Getting started](docs/user_guides/getting_started.md) — install, first model, first factory
|
|
296
|
+
- [Models and factories](docs/user_guides/models_and_factories.md) — Pydantic vs dataclasses, batches, mixing Capper and built-in types
|
|
297
|
+
|
|
298
|
+
## Available types
|
|
299
|
+
|
|
300
|
+
Import from the top level: `from capper import Name, Email, Address, ...`.
|
|
301
|
+
See the **[Faker provider mapping](docs/FAKER_PROVIDERS.md)** (or the hosted docs) for the full list of types and which Faker provider each uses.
|
|
302
|
+
|
|
303
|
+
**Optional kwargs:** Subclass `FakerType` and set `faker_kwargs` to pass arguments to the Faker provider (e.g. `faker_kwargs = {"nb_words": 10}` for `Sentence`).
|
|
304
|
+
|
|
305
|
+
**Custom types:** Subclass `FakerType`, set `faker_provider` to the Faker method name (e.g. `"company"`), and optionally `faker_kwargs`. The type auto-registers with Polyfactory when the class is defined.
|
|
306
|
+
|
|
307
|
+
## CLI
|
|
308
|
+
|
|
309
|
+
Generate fake values from the command line:
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
capper generate Name Email --count 5
|
|
313
|
+
capper generate Name Email --count 3 --seed 42
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
Use `-n`/`--count` for the number of rows and `-s`/`--seed` for reproducible output. Type names are the same as the Python types (e.g. `Name`, `Email`, `Address`).
|
|
317
|
+
|
|
318
|
+
## Compatibility
|
|
319
|
+
|
|
320
|
+
Capper targets **Python 3.10+**, **Faker >= 20.0**, and **Polyfactory >= 2.0**. For version ranges, upgrade guidance, the versioning policy, and the deprecation policy, see [Compatibility](docs/compatibility.md).
|
|
321
|
+
|
|
322
|
+
### Support & maintenance
|
|
323
|
+
|
|
324
|
+
- Supported Python and dependency versions, along with backport expectations for the 1.0.x line, are documented in [docs/compatibility.md](docs/compatibility.md).
|
|
325
|
+
- Critical bug fixes and compatibility fixes may be backported to the latest 1.0.x release; new features land in minor releases.
|
|
326
|
+
|
|
327
|
+
## Security
|
|
328
|
+
|
|
329
|
+
- The CI pipeline includes a dependency vulnerability scan using `pip-audit` (see `.github/workflows/ci.yml`).
|
|
330
|
+
- A separate compatibility workflow (`compat-latest.yml`) runs tests against the latest Faker and Polyfactory versions.
|
|
331
|
+
- For details on supported versions and how to report security issues, see [SECURITY.md](SECURITY.md).
|
|
332
|
+
|
|
333
|
+
## What's new in 1.0.0
|
|
334
|
+
|
|
335
|
+
- **Production-ready, stable API:** Capper 1.0.0 promotes the 0.5.x feature set (Phases 9–11) to a stable, production-ready API with documented compatibility and versioning guarantees.
|
|
336
|
+
- **Governance and maintenance:** Added governance and maintenance documentation (issue/PR templates, code of conduct, maintainer expectations, release and maintenance review checklists) to support long-term evolution.
|
|
337
|
+
- **Security and compatibility:** CI now includes `pip-audit` and a scheduled latest-deps workflow; the security policy and compatibility docs describe how issues are reported, triaged, and backported.
|
|
338
|
+
|
|
339
|
+
## Development
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
pip install -e ".[dev]"
|
|
343
|
+
pytest capper/tests
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
Lint and type-check: `ruff check .`, `ruff format .`, `mypy capper`.
|
|
347
|
+
|
|
348
|
+
Run tests with coverage: `pytest capper/tests --cov=capper --cov-report=term-missing`. CI requires coverage ≥ 98% for the `capper/` package (`--cov-fail-under=98`).
|
|
349
|
+
|
|
350
|
+
For seeding, locales, and reproducible test data patterns, see **[Reproducible data](docs/user_guides/reproducible_data.md)**.
|
|
351
|
+
|
|
352
|
+
## Publishing
|
|
353
|
+
|
|
354
|
+
Releases are built and published to PyPI via [GitHub Actions](https://github.com/eddiethedean/capper/blob/main/.github/workflows/publish.yml). To publish:
|
|
355
|
+
|
|
356
|
+
1. Update [CHANGELOG.md](CHANGELOG.md): move Unreleased entries into a new version section and date it.
|
|
357
|
+
2. Add a `PYPI_API_TOKEN` secret (PyPI API token) to the repo.
|
|
358
|
+
3. Create a GitHub release (tag e.g. `v0.4.1`). The workflow runs tests, builds the package, and uploads to PyPI.
|
|
359
|
+
|
|
360
|
+
To build and upload manually: `pip install build twine`, `python -m build`, `twine upload dist/*`.
|
|
361
|
+
|
|
362
|
+
## Documentation
|
|
363
|
+
|
|
364
|
+
- **[Docs index](docs/README.md)** — overview and links to all documentation
|
|
365
|
+
- **[API reference](docs/api.md)** — generated API docs (build with `mkdocs serve`; see [Contributing](CONTRIBUTING.md))
|
|
366
|
+
- **[Contributing](CONTRIBUTING.md)** — dev setup and how to add new types
|
|
367
|
+
- **User guides** (step-by-step, with runnable examples):
|
|
368
|
+
- [Getting started](docs/user_guides/getting_started.md) — install, first model, first factory
|
|
369
|
+
- [Models and factories](docs/user_guides/models_and_factories.md) — Pydantic, dataclasses, batches
|
|
370
|
+
- [Reproducible data](docs/user_guides/reproducible_data.md) — seeding for tests and demos
|
|
371
|
+
- [Custom types](docs/user_guides/custom_types.md) — `FakerType` subclasses and `faker_kwargs`
|
|
372
|
+
- [FastAPI + Pydantic](docs/user_guides/fastapi_pydantic.md) — API payloads and tests using Capper-backed Pydantic models
|
|
373
|
+
- [Django patterns](docs/user_guides/django_patterns.md) — Django-style schemas, factories, and service tests
|
|
374
|
+
- [Dataclasses and attrs](docs/user_guides/dataclasses_and_attrs.md) — non-Pydantic projects with `DataclassFactory`
|
|
375
|
+
- [Test setup templates](docs/user_guides/test_setup_templates.md) — pytest/Hypothesis fixtures and seeding patterns
|
|
376
|
+
- [Project structure](docs/user_guides/project_structure.md) — organizing Capper types, factories, and type packs
|
|
377
|
+
- [Package plan](docs/capper_package_plan.md) — design and rationale
|
|
378
|
+
- [Roadmap](docs/ROADMAP.md) — development phases and status
|
|
379
|
+
- [Faker provider mapping](docs/FAKER_PROVIDERS.md) — which Faker method each type uses
|
|
380
|
+
- [Example notebooks](docs/notebooks/README.md) — Jupyter notebooks in `docs/notebooks/`
|