formwork 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.
Files changed (43) hide show
  1. formwork-0.1.0/.env.example +15 -0
  2. formwork-0.1.0/.github/workflows/ci.yml +46 -0
  3. formwork-0.1.0/.github/workflows/release.yml +60 -0
  4. formwork-0.1.0/.gitignore +40 -0
  5. formwork-0.1.0/LICENSE +21 -0
  6. formwork-0.1.0/PKG-INFO +1208 -0
  7. formwork-0.1.0/README.md +1178 -0
  8. formwork-0.1.0/bench/__init__.py +8 -0
  9. formwork-0.1.0/bench/arms.py +266 -0
  10. formwork-0.1.0/bench/errors.py +16 -0
  11. formwork-0.1.0/bench/recordings/smoke_normal.jsonl +1 -0
  12. formwork-0.1.0/bench/recordings/smoke_repair.jsonl +1 -0
  13. formwork-0.1.0/bench/report.py +314 -0
  14. formwork-0.1.0/bench/run.py +140 -0
  15. formwork-0.1.0/bench/runner.py +230 -0
  16. formwork-0.1.0/bench/tasks.py +503 -0
  17. formwork-0.1.0/examples/workout.py +216 -0
  18. formwork-0.1.0/pyproject.toml +73 -0
  19. formwork-0.1.0/scripts/live_smoke.py +171 -0
  20. formwork-0.1.0/src/formwork/__init__.py +62 -0
  21. formwork-0.1.0/src/formwork/engine.py +367 -0
  22. formwork-0.1.0/src/formwork/errors.py +52 -0
  23. formwork-0.1.0/src/formwork/fields.py +128 -0
  24. formwork-0.1.0/src/formwork/prompt.py +182 -0
  25. formwork-0.1.0/src/formwork/providers/__init__.py +55 -0
  26. formwork-0.1.0/src/formwork/providers/base.py +62 -0
  27. formwork-0.1.0/src/formwork/providers/fake.py +187 -0
  28. formwork-0.1.0/src/formwork/providers/gemini.py +289 -0
  29. formwork-0.1.0/src/formwork/providers/record.py +92 -0
  30. formwork-0.1.0/src/formwork/py.typed +0 -0
  31. formwork-0.1.0/src/formwork/repair.py +183 -0
  32. formwork-0.1.0/src/formwork/report.py +102 -0
  33. formwork-0.1.0/src/formwork/rules.py +216 -0
  34. formwork-0.1.0/src/formwork/spec.py +170 -0
  35. formwork-0.1.0/tests/conftest.py +132 -0
  36. formwork-0.1.0/tests/test_adversarial.py +121 -0
  37. formwork-0.1.0/tests/test_bench_fairness.py +225 -0
  38. formwork-0.1.0/tests/test_engine.py +301 -0
  39. formwork-0.1.0/tests/test_gemini_schema.py +88 -0
  40. formwork-0.1.0/tests/test_live_gemini.py +114 -0
  41. formwork-0.1.0/tests/test_repair.py +155 -0
  42. formwork-0.1.0/tests/test_rules.py +119 -0
  43. formwork-0.1.0/tests/test_spec.py +76 -0
@@ -0,0 +1,15 @@
1
+ # Copy to .env and fill in. .env is gitignored; this file is not.
2
+ #
3
+ # Only the live tests and the benchmark read these. The library core never
4
+ # touches the environment — adapters take an explicit api_key, and fall back
5
+ # to os.environ only when you let them.
6
+
7
+ # https://aistudio.google.com/apikey
8
+ GEMINI_API_KEY=
9
+
10
+ # Optional. Unset falls back to DEFAULT_MODEL in formwork/providers/gemini.py.
11
+ GEMINI_MODEL=gemini-2.5-flash
12
+
13
+ # Optional. 0 disables Gemini's thinking tokens, which keeps token accounting
14
+ # comparable across benchmark arms. Leave unset to use the model default.
15
+ GEMINI_THINKING_BUDGET=0
@@ -0,0 +1,46 @@
1
+ name: ci
2
+
3
+ # Triggered only by push and pull_request, and nothing in this workflow
4
+ # interpolates event data (titles, branch names, commit messages) into a shell.
5
+ # The only expression used is the static matrix value below.
6
+ on:
7
+ push:
8
+ branches: [main]
9
+ pull_request:
10
+
11
+ # Least privilege: the jobs only need to read the checkout.
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ test:
17
+ runs-on: ubuntu-latest
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ python-version: ["3.11", "3.12", "3.13"]
22
+
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+
26
+ - uses: actions/setup-python@v5
27
+ with:
28
+ python-version: ${{ matrix.python-version }}
29
+ cache: pip
30
+
31
+ - name: Install
32
+ run: |
33
+ python -m pip install --upgrade pip
34
+ pip install -e ".[dev]"
35
+
36
+ - name: Lint
37
+ run: ruff check src tests examples bench scripts
38
+
39
+ - name: Types
40
+ run: mypy
41
+
42
+ - name: Tests
43
+ run: pytest -q
44
+
45
+ - name: Example runs
46
+ run: python examples/workout.py > /dev/null
@@ -0,0 +1,60 @@
1
+ name: release
2
+
3
+ # Publishes to PyPI when a version tag is pushed.
4
+ #
5
+ # Authentication is Trusted Publishing (OIDC): PyPI is configured to accept
6
+ # releases from this repository and workflow, so no API token is stored
7
+ # anywhere. The publish job is the only place that gets id-token: write.
8
+ on:
9
+ push:
10
+ tags: ["v*"]
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ build:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+
21
+ - uses: actions/setup-python@v5
22
+ with:
23
+ python-version: "3.12"
24
+
25
+ - name: Build
26
+ run: |
27
+ python -m pip install --upgrade pip build twine
28
+ python -m build
29
+ python -m twine check dist/*
30
+
31
+ # The tag is the release's only input, and nothing else checks that it
32
+ # agrees with the package. Tagging v0.2.0 while __init__.py still says
33
+ # 0.1.0 would otherwise publish 0.1.0 under a 0.2.0 tag, once, forever.
34
+ # The tag reaches the shell through the environment, never interpolated.
35
+ - name: Tag must match the package version
36
+ env:
37
+ TAG: ${{ github.ref_name }}
38
+ run: |
39
+ BUILT=$(ls dist/*.tar.gz | sed -E 's|.*/formwork-(.*)\.tar\.gz|\1|')
40
+ echo "tag=${TAG#v} built=$BUILT"
41
+ test "${TAG#v}" = "$BUILT"
42
+
43
+ - uses: actions/upload-artifact@v4
44
+ with:
45
+ name: dist
46
+ path: dist/
47
+
48
+ publish:
49
+ needs: build
50
+ runs-on: ubuntu-latest
51
+ environment: pypi
52
+ permissions:
53
+ id-token: write
54
+ steps:
55
+ - uses: actions/download-artifact@v4
56
+ with:
57
+ name: dist
58
+ path: dist/
59
+
60
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,40 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .eggs/
8
+
9
+ # Environments
10
+ .venv/
11
+ venv/
12
+ env/
13
+
14
+ # Tooling caches
15
+ .pytest_cache/
16
+ .ruff_cache/
17
+ .mypy_cache/
18
+ .coverage
19
+ htmlcov/
20
+
21
+ # Editors / OS
22
+ .vscode/
23
+ .idea/
24
+ .DS_Store
25
+ Thumbs.db
26
+
27
+ # Secrets
28
+ .env
29
+ .env.*
30
+ !.env.example
31
+
32
+ # Benchmark output is a local artifact by default. Published runs — the ones the
33
+ # README quotes — are committed explicitly so the numbers can be re-scored.
34
+ bench/results/*
35
+ !bench/results/pilot-*.jsonl
36
+
37
+ # Local notes for coding assistants
38
+ CLAUDE.md
39
+ AGENTS.md
40
+ .claude/
formwork-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ekber Gulpinar
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.