gwz 0.7.4__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 (72) hide show
  1. gwz-0.7.4/.github/workflows/package-smoke.yml +131 -0
  2. gwz-0.7.4/.github/workflows/publish.yml +251 -0
  3. gwz-0.7.4/.gitignore +11 -0
  4. gwz-0.7.4/Cargo.lock +748 -0
  5. gwz-0.7.4/Cargo.toml +19 -0
  6. gwz-0.7.4/PKG-INFO +108 -0
  7. gwz-0.7.4/README.md +80 -0
  8. gwz-0.7.4/RELEASE.md +155 -0
  9. gwz-0.7.4/dev-docs/GwzPyDesign.md +411 -0
  10. gwz-0.7.4/dev-docs/GwzPyPlan-Review48-2.md +124 -0
  11. gwz-0.7.4/dev-docs/GwzPyPlan-Review48.md +300 -0
  12. gwz-0.7.4/dev-docs/GwzPyPlan-Review55-2-Resolution.md +58 -0
  13. gwz-0.7.4/dev-docs/GwzPyPlan-Review55-2.md +109 -0
  14. gwz-0.7.4/dev-docs/GwzPyPlan-Review55.md +74 -0
  15. gwz-0.7.4/dev-docs/GwzPyPlan.md +840 -0
  16. gwz-0.7.4/dev-docs/GwzPyReleaseChecklist.md +73 -0
  17. gwz-0.7.4/native/src/codec.rs +54 -0
  18. gwz-0.7.4/native/src/dispatch/branch_stash.rs +62 -0
  19. gwz-0.7.4/native/src/dispatch/git_mutation.rs +151 -0
  20. gwz-0.7.4/native/src/dispatch/materialize.rs +142 -0
  21. gwz-0.7.4/native/src/dispatch/mod.rs +249 -0
  22. gwz-0.7.4/native/src/dispatch/read.rs +203 -0
  23. gwz-0.7.4/native/src/error.rs +18 -0
  24. gwz-0.7.4/native/src/lib.rs +109 -0
  25. gwz-0.7.4/native/src/operations.rs +300 -0
  26. gwz-0.7.4/native/src/shims.rs +38 -0
  27. gwz-0.7.4/pyproject.toml +55 -0
  28. gwz-0.7.4/run_tests.py +35 -0
  29. gwz-0.7.4/scripts/check_protocol_drift.py +82 -0
  30. gwz-0.7.4/scripts/package_smoke.py +246 -0
  31. gwz-0.7.4/scripts/regen_protocol.py +145 -0
  32. gwz-0.7.4/scripts/release.py +486 -0
  33. gwz-0.7.4/src/README.md +4 -0
  34. gwz-0.7.4/src/gwz/__init__.py +20 -0
  35. gwz-0.7.4/src/gwz/_version.py +24 -0
  36. gwz-0.7.4/src/gwz/bridge.py +205 -0
  37. gwz-0.7.4/src/gwz/cli.py +72 -0
  38. gwz-0.7.4/src/gwz/cli_branch_stash.py +155 -0
  39. gwz-0.7.4/src/gwz/cli_local.py +281 -0
  40. gwz-0.7.4/src/gwz/cli_mutation.py +209 -0
  41. gwz-0.7.4/src/gwz/cli_read.py +148 -0
  42. gwz-0.7.4/src/gwz/cli_render.py +66 -0
  43. gwz-0.7.4/src/gwz/cli_shared.py +308 -0
  44. gwz-0.7.4/src/gwz/client.py +571 -0
  45. gwz-0.7.4/src/gwz/client_helpers.py +80 -0
  46. gwz-0.7.4/src/gwz/errors.py +35 -0
  47. gwz-0.7.4/src/gwz/protocol/__init__.py +4 -0
  48. gwz-0.7.4/src/gwz/protocol/codec.py +292 -0
  49. gwz-0.7.4/src/gwz/protocol/generated/__init__.py +1 -0
  50. gwz-0.7.4/src/gwz/protocol/generated/api.py +840 -0
  51. gwz-0.7.4/src/gwz/protocol/generated/gwz.ir.json +5560 -0
  52. gwz-0.7.4/src/gwz/py.typed +1 -0
  53. gwz-0.7.4/src/tests/fixtures/cli_parity/parser_cases.json +38 -0
  54. gwz-0.7.4/src/tests/native_helpers.py +77 -0
  55. gwz-0.7.4/src/tests/test_bridge_transport.py +200 -0
  56. gwz-0.7.4/src/tests/test_cli.py +50 -0
  57. gwz-0.7.4/src/tests/test_cli_branch_stash.py +101 -0
  58. gwz-0.7.4/src/tests/test_cli_local.py +274 -0
  59. gwz-0.7.4/src/tests/test_cli_mutation.py +125 -0
  60. gwz-0.7.4/src/tests/test_cli_parity.py +51 -0
  61. gwz-0.7.4/src/tests/test_cli_parser.py +166 -0
  62. gwz-0.7.4/src/tests/test_cli_read.py +79 -0
  63. gwz-0.7.4/src/tests/test_client.py +385 -0
  64. gwz-0.7.4/src/tests/test_codec.py +235 -0
  65. gwz-0.7.4/src/tests/test_errors.py +176 -0
  66. gwz-0.7.4/src/tests/test_native_branch_stash.py +90 -0
  67. gwz-0.7.4/src/tests/test_native_bridge.py +78 -0
  68. gwz-0.7.4/src/tests/test_native_git_mutation.py +86 -0
  69. gwz-0.7.4/src/tests/test_native_materialize.py +85 -0
  70. gwz-0.7.4/src/tests/test_native_operations.py +155 -0
  71. gwz-0.7.4/src/tests/test_native_read.py +95 -0
  72. gwz-0.7.4/src/tests/test_protocol.py +55 -0
@@ -0,0 +1,131 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main]
7
+ workflow_dispatch:
8
+
9
+ env:
10
+ PIP_DISABLE_PIP_VERSION_CHECK: "1"
11
+ PIP_NO_CACHE_DIR: "1"
12
+
13
+ jobs:
14
+ validate:
15
+ runs-on: ${{ matrix.os }}
16
+
17
+ strategy:
18
+ fail-fast: false
19
+ matrix:
20
+ os: [macos-14, ubuntu-24.04, windows-2022]
21
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
22
+
23
+ steps:
24
+ - name: Checkout gwz-py
25
+ uses: actions/checkout@v5
26
+ with:
27
+ path: gwz-py
28
+
29
+ - name: Checkout gwz-core
30
+ uses: actions/checkout@v5
31
+ with:
32
+ repository: owebeeone/gwz-core
33
+ path: gwz-core
34
+
35
+ - name: Set up Python
36
+ uses: actions/setup-python@v6
37
+ with:
38
+ python-version: ${{ matrix.python-version }}
39
+
40
+ - name: Set up Rust
41
+ uses: dtolnay/rust-toolchain@stable
42
+
43
+ - name: Install macOS native build prerequisites
44
+ if: runner.os == 'macOS'
45
+ run: brew install openssl@3 pkg-config
46
+
47
+ - name: Install Linux native build prerequisites
48
+ if: runner.os == 'Linux'
49
+ run: sudo apt-get update && sudo apt-get install -y pkg-config libssl-dev
50
+
51
+ - name: Install Windows native build prerequisites
52
+ if: runner.os == 'Windows'
53
+ run: |
54
+ if (-not $env:VCPKG_INSTALLATION_ROOT) {
55
+ $env:VCPKG_INSTALLATION_ROOT = "C:\vcpkg"
56
+ }
57
+ "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append
58
+ "VCPKGRS_DYNAMIC=0" | Out-File -FilePath $env:GITHUB_ENV -Append
59
+ vcpkg install openssl:x64-windows-static
60
+
61
+ - name: Install Python dependencies
62
+ working-directory: gwz-py
63
+ run: python -m pip install --upgrade pip && python -m pip install -e ".[dev]"
64
+
65
+ - name: Check protocol drift
66
+ working-directory: gwz-py
67
+ run: python scripts/check_protocol_drift.py
68
+
69
+ - name: Check generated protocol
70
+ working-directory: gwz-py
71
+ run: python scripts/regen_protocol.py --check
72
+
73
+ - name: Check native extension crate
74
+ working-directory: gwz-py
75
+ run: cargo check
76
+
77
+ - name: Run Python tests
78
+ working-directory: gwz-py
79
+ run: python run_tests.py
80
+
81
+ package-smoke:
82
+ runs-on: ${{ matrix.os }}
83
+ needs: validate
84
+
85
+ strategy:
86
+ fail-fast: false
87
+ matrix:
88
+ os: [macos-14, windows-2022]
89
+
90
+ steps:
91
+ - name: Checkout gwz-py
92
+ uses: actions/checkout@v5
93
+ with:
94
+ path: gwz-py
95
+
96
+ - name: Checkout gwz-core
97
+ uses: actions/checkout@v5
98
+ with:
99
+ repository: owebeeone/gwz-core
100
+ path: gwz-core
101
+
102
+ - name: Set up Python
103
+ uses: actions/setup-python@v6
104
+ with:
105
+ python-version: "3.10"
106
+
107
+ - name: Set up Rust
108
+ uses: dtolnay/rust-toolchain@stable
109
+
110
+ - name: Install native build prerequisites
111
+ if: runner.os == 'macOS'
112
+ run: brew install openssl@3 pkg-config
113
+
114
+ - name: Install Windows native build prerequisites
115
+ if: runner.os == 'Windows'
116
+ run: |
117
+ if (-not $env:VCPKG_INSTALLATION_ROOT) {
118
+ $env:VCPKG_INSTALLATION_ROOT = "C:\vcpkg"
119
+ }
120
+ "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append
121
+ "VCPKGRS_DYNAMIC=0" | Out-File -FilePath $env:GITHUB_ENV -Append
122
+ vcpkg install openssl:x64-windows-static
123
+
124
+ - name: Install Python build tools
125
+ run: |
126
+ python -m pip install --upgrade pip
127
+ python -m pip install maturin "taut-proto>=0.6.0"
128
+
129
+ - name: Run package smoke
130
+ working-directory: gwz-py
131
+ run: python scripts/package_smoke.py
@@ -0,0 +1,251 @@
1
+ name: Publish
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+ inputs:
8
+ tag:
9
+ description: "Existing release tag to publish or retry, e.g. v0.3.0"
10
+ required: true
11
+ type: string
12
+
13
+ permissions:
14
+ contents: read
15
+ id-token: write
16
+
17
+ env:
18
+ PIP_DISABLE_PIP_VERSION_CHECK: "1"
19
+ PIP_NO_CACHE_DIR: "1"
20
+
21
+ jobs:
22
+ resolve:
23
+ runs-on: ubuntu-24.04
24
+ outputs:
25
+ tag: ${{ steps.release-tag.outputs.tag }}
26
+ version: ${{ steps.release-tag.outputs.version }}
27
+ steps:
28
+ - uses: actions/checkout@v5
29
+ with:
30
+ ref: ${{ github.event.release.tag_name || inputs.tag }}
31
+ fetch-depth: 0
32
+ persist-credentials: false
33
+
34
+ - id: release-tag
35
+ name: Resolve release tag
36
+ shell: bash
37
+ run: |
38
+ tag="${{ github.event.release.tag_name || inputs.tag }}"
39
+ if [[ ! "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
40
+ echo "release tag must look like v0.3.0, got '$tag'" >&2
41
+ exit 1
42
+ fi
43
+ git rev-parse --verify "refs/tags/$tag"
44
+ echo "tag=$tag" >> "$GITHUB_OUTPUT"
45
+ echo "version=${tag#v}" >> "$GITHUB_OUTPUT"
46
+
47
+ build:
48
+ needs: resolve
49
+ runs-on: ${{ matrix.os }}
50
+ strategy:
51
+ fail-fast: false
52
+ matrix:
53
+ include:
54
+ - os: ubuntu-24.04
55
+ artifact: linux-amd64
56
+ auditwheel: "--auditwheel=repair"
57
+ build-sdist: true
58
+ - os: ubuntu-24.04-arm
59
+ artifact: linux-arm64
60
+ auditwheel: "--auditwheel=repair"
61
+ build-sdist: false
62
+ - os: macos-15-intel
63
+ artifact: macos-amd64
64
+ auditwheel: "--auditwheel=repair"
65
+ build-sdist: false
66
+ - os: macos-14
67
+ artifact: macos-arm64
68
+ auditwheel: "--auditwheel=repair"
69
+ build-sdist: false
70
+ - os: windows-2022
71
+ artifact: windows-amd64
72
+ auditwheel: ""
73
+ build-sdist: false
74
+
75
+ steps:
76
+ - name: Checkout gwz-py
77
+ uses: actions/checkout@v5
78
+ with:
79
+ ref: ${{ needs.resolve.outputs.tag }}
80
+ path: gwz-py
81
+ fetch-depth: 0
82
+ persist-credentials: false
83
+
84
+ - name: Checkout matching gwz-core tag
85
+ uses: actions/checkout@v5
86
+ with:
87
+ repository: owebeeone/gwz-core
88
+ ref: ${{ needs.resolve.outputs.tag }}
89
+ path: gwz-core
90
+ persist-credentials: false
91
+
92
+ - name: Set up Python
93
+ uses: actions/setup-python@v6
94
+ with:
95
+ python-version: "3.10"
96
+
97
+ - name: Set up Rust
98
+ uses: dtolnay/rust-toolchain@stable
99
+
100
+ - name: Install Linux native build prerequisites
101
+ if: runner.os == 'Linux'
102
+ run: sudo apt-get update && sudo apt-get install -y pkg-config libssl-dev patchelf
103
+
104
+ - name: Install macOS native build prerequisites
105
+ if: runner.os == 'macOS'
106
+ run: brew install openssl@3 pkg-config
107
+
108
+ - name: Install Windows native build prerequisites
109
+ if: runner.os == 'Windows'
110
+ run: |
111
+ if (-not $env:VCPKG_INSTALLATION_ROOT) {
112
+ $env:VCPKG_INSTALLATION_ROOT = "C:\vcpkg"
113
+ }
114
+ "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append
115
+ "VCPKGRS_DYNAMIC=0" | Out-File -FilePath $env:GITHUB_ENV -Append
116
+ vcpkg install openssl:x64-windows-static
117
+
118
+ - name: Install Python build tools
119
+ run: |
120
+ python -m pip install --upgrade pip
121
+ python -m pip install maturin "taut-proto>=0.6.0" "pytest>=8" "pytest-asyncio>=0.23" "setuptools-scm>=8"
122
+
123
+ - name: Verify release metadata
124
+ working-directory: gwz-py
125
+ shell: python
126
+ run: |
127
+ import pathlib
128
+ import re
129
+ import sys
130
+
131
+ tag = "${{ needs.resolve.outputs.tag }}"
132
+ version = "${{ needs.resolve.outputs.version }}"
133
+ cargo = pathlib.Path("Cargo.toml").read_text(encoding="utf-8")
134
+ lock = pathlib.Path("Cargo.lock").read_text(encoding="utf-8")
135
+ pyproject = pathlib.Path("pyproject.toml").read_text(encoding="utf-8")
136
+
137
+ def require(condition, message):
138
+ if not condition:
139
+ print(message, file=sys.stderr)
140
+ raise SystemExit(1)
141
+
142
+ require(
143
+ re.search(rf'^version = "{re.escape(version)}"$', cargo, re.M),
144
+ f"Cargo.toml package version must be {version}",
145
+ )
146
+ require(
147
+ re.search(
148
+ rf'gwz-core\s*=\s*\{{[^\n}}]*\bgit\s*=\s*"[^"]+"'
149
+ rf'[^\n}}]*\btag\s*=\s*"{re.escape(tag)}"',
150
+ cargo,
151
+ ),
152
+ f"Cargo.toml must pin gwz-core to git tag {tag}",
153
+ )
154
+ require(
155
+ re.search(r'^name = "gwz"$', pyproject, re.M),
156
+ "pyproject.toml must publish the Python distribution as gwz",
157
+ )
158
+ require(
159
+ re.search(r'^gwz-py = "gwz\.cli:main"$', pyproject, re.M),
160
+ "pyproject.toml must install gwz-py = gwz.cli:main",
161
+ )
162
+ require(
163
+ re.search(
164
+ rf'\[\[package\]\]\nname = "gwz-core"\n'
165
+ rf'version = "[^"]+"\nsource = "git\+[^"]*tag={re.escape(tag)}',
166
+ lock,
167
+ ),
168
+ f"Cargo.lock must pin gwz-core through git tag {tag}",
169
+ )
170
+
171
+ - name: Check protocol drift against matching gwz-core tag
172
+ working-directory: gwz-py
173
+ run: python scripts/check_protocol_drift.py
174
+
175
+ - name: Check generated protocol
176
+ working-directory: gwz-py
177
+ run: python scripts/regen_protocol.py --check
178
+
179
+ - name: Check native extension crate
180
+ working-directory: gwz-py
181
+ run: cargo check
182
+
183
+ - name: Run Python tests
184
+ working-directory: gwz-py
185
+ run: python run_tests.py
186
+
187
+ - name: Build wheel
188
+ working-directory: gwz-py
189
+ run: python -m maturin build --release -o dist ${{ matrix.auditwheel }}
190
+
191
+ - name: Build source distribution
192
+ if: matrix.build-sdist
193
+ working-directory: gwz-py
194
+ run: python -m maturin sdist -o dist
195
+
196
+ - name: Smoke-test built wheel
197
+ working-directory: gwz-py
198
+ shell: python
199
+ run: |
200
+ import pathlib
201
+ import subprocess
202
+ import sys
203
+
204
+ version = "${{ needs.resolve.outputs.version }}"
205
+ wheels = sorted(pathlib.Path("dist").glob("gwz-*.whl"))
206
+ matching = [wheel for wheel in wheels if wheel.name.startswith(f"gwz-{version}-")]
207
+ if not matching:
208
+ print(f"no gwz {version} wheel found in dist", file=sys.stderr)
209
+ raise SystemExit(1)
210
+ subprocess.check_call(
211
+ [
212
+ sys.executable,
213
+ "scripts/package_smoke.py",
214
+ "--wheel",
215
+ str(matching[-1]),
216
+ "--expected-version",
217
+ version,
218
+ ]
219
+ )
220
+
221
+ - name: Upload distributions
222
+ uses: actions/upload-artifact@v6
223
+ with:
224
+ name: dist-${{ matrix.artifact }}
225
+ path: gwz-py/dist/*
226
+ if-no-files-found: error
227
+
228
+ publish:
229
+ needs:
230
+ - resolve
231
+ - build
232
+ runs-on: ubuntu-24.04
233
+ environment:
234
+ name: pypi
235
+ url: https://pypi.org/p/gwz
236
+ steps:
237
+ - name: Download distributions
238
+ uses: actions/download-artifact@v7
239
+ with:
240
+ pattern: dist-*
241
+ path: dist
242
+ merge-multiple: true
243
+
244
+ - name: List distributions
245
+ run: ls -l dist
246
+
247
+ - name: Publish to PyPI
248
+ uses: pypa/gh-action-pypi-publish@release/v1
249
+ with:
250
+ packages-dir: dist
251
+ skip-existing: true
gwz-0.7.4/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .pytest_cache/
5
+ .mypy_cache/
6
+ .ruff_cache/
7
+ .venv/
8
+ build/
9
+ dist/
10
+ target/
11
+ src/gwz/_gwz_core*.so