strata-python 0.2.0__py3-none-any.whl → 0.2.2__py3-none-any.whl

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.
Files changed (36) hide show
  1. strata_python/__init__.py +2 -1
  2. strata_python/cli.py +99 -20
  3. strata_python/clients/__init__.py +2 -0
  4. strata_python/clients/models.py +780 -0
  5. strata_python/db/__init__.py +116 -0
  6. strata_python/db/__main__.py +5 -0
  7. strata_python/db/_alembic/env.py +24 -0
  8. strata_python/db/_alembic/script.py.mako +28 -0
  9. strata_python/db/cli.py +199 -0
  10. strata_python/db/config.py +85 -0
  11. strata_python/db/engine.py +53 -0
  12. strata_python/db/guard.py +159 -0
  13. strata_python/db/migrations.py +243 -0
  14. strata_python/db/models.py +62 -0
  15. strata_python/db/project.py +98 -0
  16. strata_python/db/pytest_plugin.py +205 -0
  17. strata_python/db/scratch.py +143 -0
  18. strata_python/db/settings.py +63 -0
  19. strata_python/db/testing.py +43 -0
  20. strata_python/db/testserver.py +205 -0
  21. strata_python/oslib.py +44 -5
  22. strata_python/pages/__init__.py +21 -0
  23. strata_python/pages/model.py +241 -0
  24. strata_python/pages/render.py +273 -0
  25. strata_python/public_check.py +54 -8
  26. strata_python/pytest_plugin.py +70 -1
  27. strata_python/settings.py +243 -42
  28. strata_python/testing.py +257 -0
  29. strata_python/web.py +15 -6
  30. strata_python-0.2.2.dist-info/METADATA +334 -0
  31. strata_python-0.2.2.dist-info/RECORD +38 -0
  32. {strata_python-0.2.0.dist-info → strata_python-0.2.2.dist-info}/entry_points.txt +2 -0
  33. strata_python-0.2.0.dist-info/METADATA +0 -82
  34. strata_python-0.2.0.dist-info/RECORD +0 -16
  35. {strata_python-0.2.0.dist-info → strata_python-0.2.2.dist-info}/WHEEL +0 -0
  36. {strata_python-0.2.0.dist-info → strata_python-0.2.2.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,38 @@
1
+ strata_python/__init__.py,sha256=R8RMrmyXpaCez3TMEsuKoPxCR0cQxFZxgHf-UVPymSg,1321
2
+ strata_python/check.py,sha256=lFjXuPjVIWn6dBu2yMKIW-76RloUREijuMHCRsBW4Z8,2932
3
+ strata_python/cli.py,sha256=KKcFNjLsNXygeSUvzbaznZ8sTTW1ADkgsovJcyd3Sjc,5991
4
+ strata_python/http_server.py,sha256=64uYWy4zFxughOgtvkssGXMJDZ7jhRj1bxUIfnzte8w,4475
5
+ strata_python/live.py,sha256=kNY6h6gMxBo9l78UoGUIWjcADeZi4eZuAEp0jqDowEE,1215
6
+ strata_python/oslib.py,sha256=seDkRBgDEZYqcaZWOF0heGKDd93IHJI_nFPLmOeYcsA,6380
7
+ strata_python/public_check.py,sha256=A0JusSWnwXtaA3sKsRoa4ocM5MNx38Nc49-dymd__3Q,8398
8
+ strata_python/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ strata_python/pytest_plugin.py,sha256=vinyCpDC9KeM_NM37lTN6F1ou0pfHlsn4C3j0Y_4Fg8,6718
10
+ strata_python/settings.py,sha256=9y0zGhmGsBoUaH4zkbQ6RETiH-oLL2IKlmhwml3AkCk,14108
11
+ strata_python/testing.py,sha256=-4mread8_FHMkcGvbajGtRyoP88fyeG3pAh1LlVr_w4,10372
12
+ strata_python/web.py,sha256=7A2G7M0kPjeBr5Dfu6RMZqRX3JjWg0wJx8IeCT47Xcw,5618
13
+ strata_python/clients/__init__.py,sha256=xivuysmYG7rbCGProVNvdSs-h4xVFQsuqUY6EwzuJbk,182
14
+ strata_python/clients/models.py,sha256=rcIKizebN1BEWWpwwqUWBCZBq8zcnV2g7XO9StsLmW8,30146
15
+ strata_python/db/__init__.py,sha256=ELfBNyONSF9vfl-Tw0a-X0rT3w1h1O_t_QLz1ZQTEwo,3775
16
+ strata_python/db/__main__.py,sha256=nHCtenRtjL_Ouig4FHh60dax2oILeVdoIIKrxXEc6Ss,106
17
+ strata_python/db/cli.py,sha256=PCIh0QQuxOH9ybgtFr-8U1p5IY2E4EdOQF1RchKgXrw,9848
18
+ strata_python/db/config.py,sha256=slUPAjWWBbqLhAxkrcCuPTqUCDhNxCSGkB1lyuYEG9c,3778
19
+ strata_python/db/engine.py,sha256=PFLSeYqFrwQPVoyP1i5PUk-sZIgFc7qF3yvj9mgj3NA,1929
20
+ strata_python/db/guard.py,sha256=HyRtDMRgTWFgT9D4gNomA18ErR1mqJbzJgtU7xAqBG8,6722
21
+ strata_python/db/migrations.py,sha256=Hb77afQNjtKS2DD-zmen4BscbAx9DRjLHtcPOdzuaGo,12138
22
+ strata_python/db/models.py,sha256=bWg1xgn-VgDLnFe0Ps_2hiYD5fp-_8W8mCErATS3RQs,3005
23
+ strata_python/db/project.py,sha256=cG5ihJhz4OoOnGPJwmPTFEhaX2o4u-GQYg7Xd0jBAU8,3740
24
+ strata_python/db/pytest_plugin.py,sha256=opJb5AI8Dy8IYqkx6IcZV1KBeMB4DHmnaEKd36h_r9Q,8978
25
+ strata_python/db/scratch.py,sha256=mlb4a1MTevhBS3WWIJOvUiyggLGeBR9NbXi8Jh8Rf2k,5059
26
+ strata_python/db/settings.py,sha256=sg1xDhqYhTzUx8_8-VKJBlpb1qRKKYhujJYZ8KeIbbY,2635
27
+ strata_python/db/testing.py,sha256=U39cwmg_6Dp4XPyc1Z2NWVgSGI_Q93Y--78_7PgEwes,1979
28
+ strata_python/db/testserver.py,sha256=I5__od7FEjNBcYYcJqmzLA_5t1wRqJ85NBukZMebS4Q,8806
29
+ strata_python/db/_alembic/env.py,sha256=gXzRn02h59PB_1RaABkaT6GuyuzPQCZh3Z5ml2JlS34,1125
30
+ strata_python/db/_alembic/script.py.mako,sha256=04kgeBtNMa4cCnG8CfQcKt6P6rnloIfj8wy0u_DBydM,704
31
+ strata_python/pages/__init__.py,sha256=6QsTqJbFiuLCxywt8C0D6nyXRXjpzI1Xoo5u6rK9toQ,665
32
+ strata_python/pages/model.py,sha256=8Skz3eishAZiNHIHzScI0g60wGpH6jZ3vNc0LpMZ4q4,9821
33
+ strata_python/pages/render.py,sha256=69317W03K0AVxGpelpzrNsnEP5y0oIp5aFodlnhckdE,11760
34
+ strata_python-0.2.2.dist-info/METADATA,sha256=lP9ckCGlC4IMVYlbL5mBGaWRRrtRJjCOMzBdyWP-t2o,23333
35
+ strata_python-0.2.2.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
36
+ strata_python-0.2.2.dist-info/entry_points.txt,sha256=6RVv-uDumVQ-KY2YdvKwd5R3l6P9WQD4kPtPOKKEM-I,256
37
+ strata_python-0.2.2.dist-info/licenses/LICENSE,sha256=9yVMCPoK7unONyTAiDYjMTt3MZPGJ639nWOwxyNsZGg,1066
38
+ strata_python-0.2.2.dist-info/RECORD,,
@@ -1,6 +1,8 @@
1
1
  [console_scripts]
2
2
  strata-check = strata_python.check:main
3
+ strata-db = strata_python.db.cli:main
3
4
  strata-public-check = strata_python.public_check:main
4
5
 
5
6
  [pytest11]
6
7
  strata_python = strata_python.pytest_plugin
8
+ strata_python_db = strata_python.db.pytest_plugin
@@ -1,82 +0,0 @@
1
- Metadata-Version: 2.5
2
- Name: strata-python
3
- Version: 0.2.0
4
- Summary: Common code for Python web server apps: OS helpers, settings, FastAPI serving, CLI commands, test fixtures and the strata-check gate
5
- Project-URL: Homepage, https://github.com/jburnhams/strata-python
6
- Project-URL: Source, https://github.com/jburnhams/strata-python
7
- Project-URL: Changelog, https://github.com/jburnhams/strata-python/blob/main/CHANGELOG.md
8
- Author: jburnhams
9
- License-Expression: MIT
10
- License-File: LICENSE
11
- Keywords: cli,fastapi,pytest,settings
12
- Classifier: Development Status :: 4 - Beta
13
- Classifier: Framework :: FastAPI
14
- Classifier: Framework :: Pytest
15
- Classifier: Operating System :: OS Independent
16
- Classifier: Programming Language :: Python :: 3
17
- Classifier: Programming Language :: Python :: 3.11
18
- Classifier: Programming Language :: Python :: 3.12
19
- Classifier: Programming Language :: Python :: 3.13
20
- Classifier: Typing :: Typed
21
- Requires-Python: >=3.11
22
- Requires-Dist: fastapi>=0.115
23
- Requires-Dist: pydantic>=2.9
24
- Requires-Dist: pytest>=8
25
- Requires-Dist: tzdata; sys_platform == 'win32'
26
- Requires-Dist: uvicorn>=0.32
27
- Description-Content-Type: text/markdown
28
-
29
- # strata-python
30
-
31
- Common code for the strata Python web server apps (FastAPI + CLI), the Python counterpart of [strata-react](https://github.com/jburnhams/strata-react). Every app made from [python-app-template](https://github.com/jburnhams/python-app-template) used to carry its own drifting copy of these modules; they live here once. It is opinionated and built for those apps rather than as a general-purpose library, but it is public, MIT-licensed and on PyPI.
32
-
33
- | Module | What it gives an app |
34
- |---|---|
35
- | `strata_python.oslib` | Cross-platform file locks, process liveness (`pid_alive`), `kill_tree`, `lower_priority`, `venv_python`, `cli_command(module)` |
36
- | `strata_python.settings` | `Settings` / `Setting`: one JSON file in `~/.<app>` with `<APP>_*` environment overrides, validation (`absolute_path`, `non_empty`), atomic saves |
37
- | `strata_python.web` | `base_app` (health + settings routes), `add_web` (built web app or stand-in page at every non-API path), `with_base` (reverse-proxy-safe `<base href>`), `static_file` (path-safe), `serve` |
38
- | `strata_python.cli` | `add_doctor`, `add_set`, `add_serve` for the app's argparse subcommands |
39
- | `strata_python.http_server` / `live` | A real scripted HTTP server and a real uvicorn server on loopback, for tests that make actual requests |
40
- | pytest plugin | Loaded automatically: hermetic home and data folders, a no-network guard, `http_server` and `live_app` fixtures |
41
- | `strata-check` | The one gate: lockfile, ruff, `ruff format`, pyright strict, ty, unit tests with coverage |
42
- | `strata-public-check` | Fails on email addresses, private IPv4 addresses, home-folder paths and the regexes in `STRATA_PUBLIC_DENY` in a tree, sdist or wheel; run before anything public is published |
43
-
44
- ## Use it in an app
45
-
46
- ```toml
47
- # pyproject.toml
48
- [project]
49
- dependencies = ["strata-python>=0.2,<0.3"] # from PyPI; while 0.x a minor release may break, so cap below the next one
50
-
51
- [tool.pytest.ini_options]
52
- strata_env_prefix = "MYAPP" # MYAPP_HOME and MYAPP_DATA point into a tmp dir for every test
53
- strata_tuning_vars = ["MYAPP_GREETING"] # removed from the environment for every test
54
- ```
55
-
56
- ```python
57
- from strata_python import cli, web
58
- from strata_python.settings import Setting, Settings, absolute_path, non_empty
59
-
60
- SETTINGS = Settings(
61
- "myapp",
62
- [
63
- Setting("data_dir", default=lambda: "/srv/myapp", normalise=absolute_path),
64
- Setting("greeting", default="Hello", normalise=non_empty),
65
- ],
66
- )
67
-
68
-
69
- def create_app():
70
- app = web.base_app("myapp", __version__, SETTINGS) # /api/health, GET/PUT /api/settings
71
- # ... the app's own /api routes ...
72
- web.add_web(app, STATIC_DIR, LANDING_HTML) # last: it registers the catch-all page route
73
- return app
74
- ```
75
-
76
- To try an unreleased commit, add `[tool.uv.sources] strata-python = { git = "https://github.com/jburnhams/strata-python", rev = "<sha>" }` for the moment and remove it once the release is out.
77
-
78
- `scripts/check` in the app is `exec uv run --locked strata-check "$@"`; git hooks and CI call it. Optional `[tool.strata-check]` in `pyproject.toml` sets `paths` (default `src`, `tests`, `scripts`) and `tests` (default `tests/unit`).
79
-
80
- ## Develop
81
-
82
- `uv sync`, then `scripts/check` (add `--fast` to skip the tests, `--fix` for safe ruff fixes). Integration tests (`uv run pytest tests/integration`) run the gate on a tiny project and `serve` in a separate process. Read [AGENTS.md](AGENTS.md) before changing anything; every change gets a [CHANGELOG.md](CHANGELOG.md) entry. Merging to main releases: `release.yml` bumps the version through its own PR, tags it and creates the GitHub release, and `pypi-publish.yml` uploads it to PyPI.
@@ -1,16 +0,0 @@
1
- strata_python/__init__.py,sha256=VYE4MXdwr1SPPaMtxZKfICzRFHl_q9Ktb0-GMgx1d5M,1207
2
- strata_python/check.py,sha256=lFjXuPjVIWn6dBu2yMKIW-76RloUREijuMHCRsBW4Z8,2932
3
- strata_python/cli.py,sha256=Vdqq2S2BJpGR3zjyRxqSZX9k65ecWL2SV5Zb7aVqUMY,2856
4
- strata_python/http_server.py,sha256=64uYWy4zFxughOgtvkssGXMJDZ7jhRj1bxUIfnzte8w,4475
5
- strata_python/live.py,sha256=kNY6h6gMxBo9l78UoGUIWjcADeZi4eZuAEp0jqDowEE,1215
6
- strata_python/oslib.py,sha256=2YS8Yk5TFgRWNNB9aZQhJlFPZRU1PTW0s0AaTxbNN4g,4206
7
- strata_python/public_check.py,sha256=aCUSdKWakjTQ6Bx1Zx1nMy5YJBWVi3gB3J0dZsIcMtE,5808
8
- strata_python/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- strata_python/pytest_plugin.py,sha256=JbXnerUDy95nSJit6bHPXKjj0GUVh1Zp66TKZPSg5Qc,3574
10
- strata_python/settings.py,sha256=DzzZr-h39lLTXhi078Ed3dl2BPjteTTChvKN-33kEdI,5888
11
- strata_python/web.py,sha256=mhqW0-w0bbYG8O8dBQbKsU8unzKdvmhbsPayTdz4zYQ,5204
12
- strata_python-0.2.0.dist-info/METADATA,sha256=G_x_KtYpJIUOHVbfW-A12CWen5EfilCevKeqTy1W8YY,4797
13
- strata_python-0.2.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
14
- strata_python-0.2.0.dist-info/entry_points.txt,sha256=LL3ID4wRlAUxHpRnCkjgFzoxmNu_uwzjqg1QA247tnA,168
15
- strata_python-0.2.0.dist-info/licenses/LICENSE,sha256=9yVMCPoK7unONyTAiDYjMTt3MZPGJ639nWOwxyNsZGg,1066
16
- strata_python-0.2.0.dist-info/RECORD,,