forkreduce 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 (45) hide show
  1. forkreduce-0.1.0/.github/workflows/ci.yml +31 -0
  2. forkreduce-0.1.0/.github/workflows/release.yml +79 -0
  3. forkreduce-0.1.0/.gitignore +16 -0
  4. forkreduce-0.1.0/LICENSE +21 -0
  5. forkreduce-0.1.0/PKG-INFO +631 -0
  6. forkreduce-0.1.0/README.md +598 -0
  7. forkreduce-0.1.0/README.zh-CN.md +598 -0
  8. forkreduce-0.1.0/docs/assets/overview.svg +84 -0
  9. forkreduce-0.1.0/docs/assets/overview.zh-CN.svg +83 -0
  10. forkreduce-0.1.0/examples/__init__.py +0 -0
  11. forkreduce-0.1.0/examples/notice.py +84 -0
  12. forkreduce-0.1.0/examples/run_live.py +60 -0
  13. forkreduce-0.1.0/examples/run_offline.py +228 -0
  14. forkreduce-0.1.0/pyproject.toml +76 -0
  15. forkreduce-0.1.0/src/forkreduce/__init__.py +76 -0
  16. forkreduce-0.1.0/src/forkreduce/checks.py +274 -0
  17. forkreduce-0.1.0/src/forkreduce/context.py +157 -0
  18. forkreduce-0.1.0/src/forkreduce/contrib/__init__.py +5 -0
  19. forkreduce-0.1.0/src/forkreduce/contrib/temporal.py +349 -0
  20. forkreduce-0.1.0/src/forkreduce/coverage.py +187 -0
  21. forkreduce-0.1.0/src/forkreduce/documents.py +173 -0
  22. forkreduce-0.1.0/src/forkreduce/errors.py +39 -0
  23. forkreduce-0.1.0/src/forkreduce/executor.py +200 -0
  24. forkreduce-0.1.0/src/forkreduce/failures.py +239 -0
  25. forkreduce-0.1.0/src/forkreduce/followup.py +215 -0
  26. forkreduce-0.1.0/src/forkreduce/models.py +48 -0
  27. forkreduce-0.1.0/src/forkreduce/plan.py +355 -0
  28. forkreduce-0.1.0/src/forkreduce/policy.py +147 -0
  29. forkreduce-0.1.0/src/forkreduce/prefix.py +90 -0
  30. forkreduce-0.1.0/src/forkreduce/py.typed +0 -0
  31. forkreduce-0.1.0/src/forkreduce/query.py +77 -0
  32. forkreduce-0.1.0/src/forkreduce/reduce.py +625 -0
  33. forkreduce-0.1.0/src/forkreduce/schemas.py +30 -0
  34. forkreduce-0.1.0/src/forkreduce/session.py +447 -0
  35. forkreduce-0.1.0/src/forkreduce/stats.py +92 -0
  36. forkreduce-0.1.0/src/forkreduce/textutil.py +21 -0
  37. forkreduce-0.1.0/tests/conftest.py +3 -0
  38. forkreduce-0.1.0/tests/support.py +92 -0
  39. forkreduce-0.1.0/tests/test_checks.py +153 -0
  40. forkreduce-0.1.0/tests/test_context.py +304 -0
  41. forkreduce-0.1.0/tests/test_example.py +19 -0
  42. forkreduce-0.1.0/tests/test_executor.py +358 -0
  43. forkreduce-0.1.0/tests/test_prefix.py +255 -0
  44. forkreduce-0.1.0/tests/test_reduce.py +592 -0
  45. forkreduce-0.1.0/tests/test_temporal.py +320 -0
@@ -0,0 +1,31 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ check:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ python-version: ["3.11", "3.12"]
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-python@v5
17
+ with:
18
+ python-version: ${{ matrix.python-version }}
19
+ cache: pip
20
+ - name: Install
21
+ run: python -m pip install -e ".[dev]"
22
+ - name: Ruff
23
+ run: |
24
+ ruff check src tests examples
25
+ ruff format --check src tests examples
26
+ - name: Type check
27
+ run: mypy
28
+ - name: Tests
29
+ env:
30
+ PYDANTIC_AI_NO_BANNER: "1"
31
+ run: python -m pytest
@@ -0,0 +1,79 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ build:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: "3.12"
20
+ - name: Install build tools
21
+ run: python -m pip install build twine
22
+ - name: Build sdist and wheel
23
+ run: python -m build
24
+ - name: Check distributions
25
+ run: twine check dist/*
26
+ - name: Require the tag to match the package version
27
+ env:
28
+ GITHUB_REF: ${{ github.ref }}
29
+ GITHUB_REF_NAME: ${{ github.ref_name }}
30
+ run: |
31
+ python - <<'PY'
32
+ import os
33
+ import re
34
+ import tomllib
35
+ from pathlib import Path
36
+
37
+ ref = os.environ["GITHUB_REF"]
38
+ name = os.environ["GITHUB_REF_NAME"]
39
+ if not ref.startswith("refs/tags/v"):
40
+ raise SystemExit(
41
+ f"Release must run from a v* tag (got {ref}). "
42
+ "Push a tag, or dispatch this workflow on that tag."
43
+ )
44
+ pyproject = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))
45
+ version = pyproject["project"]["version"]
46
+ init = Path("src/forkreduce/__init__.py").read_text(encoding="utf-8")
47
+ match = re.search(r'^__version__ = "([^"]+)"', init, flags=re.MULTILINE)
48
+ if match is None or match.group(1) != version:
49
+ found = match.group(1) if match else "(missing)"
50
+ raise SystemExit(f"__version__ is {found}, pyproject version is {version}")
51
+ expected = f"v{version}"
52
+ if name != expected:
53
+ raise SystemExit(f"tag {name} does not match package version {version} (expected {expected})")
54
+ print(f"tag {name} matches package version {version}")
55
+ PY
56
+ - uses: actions/upload-artifact@v4
57
+ with:
58
+ name: dist
59
+ path: dist/
60
+ if-no-files-found: error
61
+
62
+ publish:
63
+ needs: build
64
+ if: startsWith(github.ref, 'refs/tags/v')
65
+ runs-on: ubuntu-latest
66
+ environment: pypi
67
+ permissions:
68
+ id-token: write
69
+ contents: read
70
+ steps:
71
+ - uses: actions/download-artifact@v4
72
+ with:
73
+ name: dist
74
+ path: dist
75
+ # Attestations default to on and need `attestations: write`. This publisher
76
+ # is registered with id-token only, so keep the upload to trusted publishing.
77
+ - uses: pypa/gh-action-pypi-publish@release/v1
78
+ with:
79
+ attestations: false
@@ -0,0 +1,16 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .eggs/
5
+ dist/
6
+ build/
7
+ .mypy_cache/
8
+ .ruff_cache/
9
+ .pytest_cache/
10
+ .venv/
11
+ venv/
12
+ .env
13
+ .env.*
14
+ *.log
15
+ .coverage
16
+ htmlcov/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 forkreduce contributors
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.