rowsmyth 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.
- rowsmyth-0.1.0/.gitignore +27 -0
- rowsmyth-0.1.0/CHANGELOG.md +30 -0
- rowsmyth-0.1.0/CONTRIBUTING.md +85 -0
- rowsmyth-0.1.0/LICENSE +21 -0
- rowsmyth-0.1.0/PKG-INFO +674 -0
- rowsmyth-0.1.0/README.md +644 -0
- rowsmyth-0.1.0/pyproject.toml +160 -0
- rowsmyth-0.1.0/src/rowsmyth/__init__.py +16 -0
- rowsmyth-0.1.0/src/rowsmyth/_base.py +185 -0
- rowsmyth-0.1.0/src/rowsmyth/_builder.py +147 -0
- rowsmyth-0.1.0/src/rowsmyth/_dataset.py +117 -0
- rowsmyth-0.1.0/src/rowsmyth/_execute.py +208 -0
- rowsmyth-0.1.0/src/rowsmyth/_spark.py +60 -0
- rowsmyth-0.1.0/src/rowsmyth/_variant.py +25 -0
- rowsmyth-0.1.0/src/rowsmyth/_version.py +24 -0
- rowsmyth-0.1.0/src/rowsmyth/py.typed +0 -0
- rowsmyth-0.1.0/tests/conftest.py +111 -0
- rowsmyth-0.1.0/tests/test_base.py +145 -0
- rowsmyth-0.1.0/tests/test_builder.py +83 -0
- rowsmyth-0.1.0/tests/test_dataset.py +92 -0
- rowsmyth-0.1.0/tests/test_execute.py +205 -0
- rowsmyth-0.1.0/tests/test_integration.py +123 -0
- rowsmyth-0.1.0/tests/test_spark.py +284 -0
- rowsmyth-0.1.0/tests/test_variant.py +17 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[oc]
|
|
4
|
+
build/
|
|
5
|
+
dist/
|
|
6
|
+
wheels/
|
|
7
|
+
*.egg-info
|
|
8
|
+
_version.py
|
|
9
|
+
|
|
10
|
+
# Virtual environments
|
|
11
|
+
.venv
|
|
12
|
+
|
|
13
|
+
# Tools
|
|
14
|
+
.ruff_cache/
|
|
15
|
+
.ty_cache/
|
|
16
|
+
.mypy_cache/
|
|
17
|
+
.pytest_cache/
|
|
18
|
+
.coverage
|
|
19
|
+
htmlcov/
|
|
20
|
+
site/
|
|
21
|
+
|
|
22
|
+
# Env
|
|
23
|
+
.env
|
|
24
|
+
*.log
|
|
25
|
+
|
|
26
|
+
# Testing scratch (private)
|
|
27
|
+
testing/
|
|
@@ -0,0 +1,30 @@
|
|
|
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.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
<!-- commitizen will append entries here on `cz bump` -->
|
|
9
|
+
|
|
10
|
+
## 0.1.0 (2026-05-25)
|
|
11
|
+
|
|
12
|
+
### Feat
|
|
13
|
+
|
|
14
|
+
- `declarative_base()` with rowsmyth capabilities mixed in; accepts `metadata`, `type_annotation_map` and `registry` arguments matching `DeclarativeBase`
|
|
15
|
+
- `generators()` classmethod for co-located factory-boy declarations; keys are column attributes or strings, values are any factory-boy declaration
|
|
16
|
+
- `@variant` decorator for named model variants; returned dicts override specific generators when applied via `.mix()`
|
|
17
|
+
- `Model.factory(n)` / `Model.factory(min, max)` for hierarchical data generation with exact or random-range counts
|
|
18
|
+
- `FactoryBuilder.has(*builders, via=None)` to attach child builders; foreign keys resolved automatically from SQLAlchemy relationship metadata; use `via=` to disambiguate multiple relationships to the same parent
|
|
19
|
+
- `FactoryBuilder.mix(**proportions)` to distribute generated instances across named variants using proportions that sum to <= 1.0; the remainder receives no variant
|
|
20
|
+
- `FactoryBuilder.where(overrides)` to force fixed column values on every generated instance; takes precedence over variants and generators
|
|
21
|
+
- `FactoryBuilder.random_seed(value)` to seed `random` and `Faker` for reproducible output
|
|
22
|
+
- `FactoryBuilder.create()` to generate and persist instances to an in-memory SQLite database; returns a list of root model instances
|
|
23
|
+
- `Base.dataset(*builders)` for flat multi-table generation; rows are created in FK dependency order with foreign keys sampled randomly from the created pool
|
|
24
|
+
- `Dataset.random_seed(value)` to seed `random` and `Faker` for reproducible output
|
|
25
|
+
- `Dataset.create()` to generate and persist instances; returns `dict[str, list[Model]]` keyed by `__tablename__`
|
|
26
|
+
- `Model.__comment__` classproperty for table-level comment from `__table_args__`
|
|
27
|
+
- `Model.__table_info__` classproperty for table-level `info` dict from `__table_args__`
|
|
28
|
+
- `Model.__column_info__` classproperty for per-column `info` dicts, keyed by column name
|
|
29
|
+
- `Model.__expectations__` classproperty for named `CheckConstraint` expressions keyed by constraint name; maps directly to data quality frameworks
|
|
30
|
+
- `Model.__spark_schema__` classproperty to convert the model to a PySpark `StructType` preserving nullability and column metadata; requires `rowsmyth[spark]`
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Contributing to rowsmyth
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing!
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- Python 3.12+
|
|
8
|
+
- [uv](https://docs.astral.sh/uv/) - package manager
|
|
9
|
+
- [pre-commit](https://pre-commit.com/) - git hooks
|
|
10
|
+
|
|
11
|
+
## Setup
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
git clone https://github.com/LaurenceRawlings/rowsmyth.git
|
|
15
|
+
cd rowsmyth
|
|
16
|
+
make install
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Pull requests
|
|
20
|
+
|
|
21
|
+
PRs are merged via **squash merge** - the PR title becomes the single commit
|
|
22
|
+
on `main`. Keep each PR focused on one type of change so `cz bump` can
|
|
23
|
+
determine the correct version bump from the commit history.
|
|
24
|
+
|
|
25
|
+
**PR title format:** `type(optional-scope): short description`
|
|
26
|
+
|
|
27
|
+
Example: `feat: add .where() method to FactoryBuilder`
|
|
28
|
+
|
|
29
|
+
See the PR template for the full type reference and version bump rules.
|
|
30
|
+
|
|
31
|
+
## Commit convention
|
|
32
|
+
|
|
33
|
+
This project uses [Conventional Commits](https://www.conventionalcommits.org/).
|
|
34
|
+
The `commit-msg` hook enforces this on local commits automatically.
|
|
35
|
+
|
|
36
|
+
Commits within a branch are squashed on merge, so local commit messages are
|
|
37
|
+
flexible - what matters is the **PR title**.
|
|
38
|
+
|
|
39
|
+
| Type | Version bump | When to use |
|
|
40
|
+
|------|-------------|-------------|
|
|
41
|
+
| `feat` | minor | New user-visible feature |
|
|
42
|
+
| `fix` | patch | Bug fix |
|
|
43
|
+
| `feat!` / `fix!` | major | Breaking change (append `!`) |
|
|
44
|
+
| `docs` | none | Documentation only |
|
|
45
|
+
| `style` | none | Formatting, whitespace - no logic change |
|
|
46
|
+
| `refactor` | none | No functional change |
|
|
47
|
+
| `test` | none | Tests only |
|
|
48
|
+
| `perf` | patch | Performance improvement |
|
|
49
|
+
| `build` | none | Build system or dependency changes |
|
|
50
|
+
| `ci` | none | CI/CD configuration changes |
|
|
51
|
+
| `chore` | none | Maintenance not covered by other types |
|
|
52
|
+
| `revert` | patch | Reverts a previous commit |
|
|
53
|
+
|
|
54
|
+
## Running checks
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
make test # tests only
|
|
58
|
+
make lint # ruff check + format check
|
|
59
|
+
make typecheck # ty strict mode
|
|
60
|
+
make security # bandit scan
|
|
61
|
+
make pre-commit # run all pre-commit hooks on all files
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Adding tests
|
|
65
|
+
|
|
66
|
+
All PRs must maintain **100% test coverage**. If you add or change code, add
|
|
67
|
+
tests that cover it. Docstring examples in `src/` must also be valid doctests -
|
|
68
|
+
run `pytest --doctest-modules src/rowsmyth/` to verify them separately.
|
|
69
|
+
|
|
70
|
+
## Understanding the codebase
|
|
71
|
+
|
|
72
|
+
See [docs/design.md](docs/design.md) for an explanation of the internal
|
|
73
|
+
architecture, module responsibilities and data flow.
|
|
74
|
+
|
|
75
|
+
## Releasing (maintainers only)
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
cz bump
|
|
79
|
+
git push
|
|
80
|
+
git push --tags
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
`cz bump` reads the commit history, determines the next
|
|
84
|
+
SemVer, updates `CHANGELOG.md` and creates a bump commit + `vX.Y.Z` tag.
|
|
85
|
+
The CD workflow on GitHub Actions handles the rest.
|
rowsmyth-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Laurence Rawlings
|
|
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.
|