gitpure 0.1.1__tar.gz → 1.0.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.
@@ -0,0 +1,289 @@
1
+ # This file is autogenerated by maturin v1.9.4
2
+ # To update, run
3
+ #
4
+ # maturin generate-ci github
5
+ #
6
+ name: CI
7
+
8
+ on:
9
+ push:
10
+ branches:
11
+ - main
12
+ pull_request:
13
+
14
+ permissions:
15
+ contents: read
16
+
17
+ jobs:
18
+ # Determine the next version of the codebase.
19
+ get-next-version:
20
+ uses: semantic-release-action/next-release-version/.github/workflows/next-release-version.yml@v4
21
+ permissions:
22
+ contents: write
23
+
24
+ # Calculate the version to set the package to.
25
+ calculate-version:
26
+ needs: get-next-version
27
+ runs-on: ubuntu-latest
28
+ outputs:
29
+ version: ${{ steps.set-version.outputs.version }}
30
+ steps:
31
+ - name: Set version
32
+ id: set-version
33
+ run: echo "version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
34
+ env:
35
+ PACKAGE_VERSION: ${{ needs.get-next-version.outputs.new-release-published == 'true' && needs.get-next-version.outputs.new-release-version || format('0.0.{0}', github.run_number) }}
36
+
37
+ tests:
38
+ runs-on: ubuntu-latest
39
+ needs: calculate-version
40
+ steps:
41
+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
42
+ - name: Set up Python
43
+ uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6
44
+ with:
45
+ python-version: '3.13'
46
+ - name: Set up Rust toolchain
47
+ uses: dtolnay/rust-toolchain@stable
48
+ - name: Set Cargo.toml package version
49
+ uses: colt-1/toml-editor@1.1.1
50
+ with:
51
+ file: Cargo.toml
52
+ key: package.version
53
+ value: ${{ needs.calculate-version.outputs.version }}
54
+ - name: Install build tooling
55
+ run: |
56
+ python -m pip install --upgrade pip
57
+ pip install maturin
58
+ - name: Install project with test extras
59
+ run: pip install .[test]
60
+ - name: Run pytest
61
+ run: pytest -s
62
+
63
+ linux:
64
+ needs: calculate-version
65
+ runs-on: ${{ matrix.platform.runner }}
66
+ strategy:
67
+ matrix:
68
+ platform:
69
+ - runner: ubuntu-22.04
70
+ target: x86_64
71
+ - runner: ubuntu-22.04
72
+ target: x86
73
+ - runner: ubuntu-22.04
74
+ target: aarch64
75
+ - runner: ubuntu-22.04
76
+ target: armv7
77
+ - runner: ubuntu-22.04
78
+ target: s390x
79
+ - runner: ubuntu-22.04
80
+ target: ppc64le
81
+ steps:
82
+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
83
+ - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6
84
+ with:
85
+ python-version: 3.x
86
+ - name: Set Cargo.toml package version
87
+ uses: colt-1/toml-editor@1.1.1
88
+ with:
89
+ file: Cargo.toml
90
+ key: package.version
91
+ value: ${{ needs.calculate-version.outputs.version }}
92
+ - name: Build wheels
93
+ uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1
94
+ with:
95
+ target: ${{ matrix.platform.target }}
96
+ args: --release --out dist --find-interpreter
97
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
98
+ # ring requires a newer version of manylinux on aarch64
99
+ manylinux: ${{ matrix.platform.target == 'aarch64' && '2_28' || 'auto' }}
100
+ - name: Upload wheels
101
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
102
+ with:
103
+ name: wheels-linux-${{ matrix.platform.target }}
104
+ path: dist
105
+
106
+ musllinux:
107
+ needs: calculate-version
108
+ runs-on: ${{ matrix.platform.runner }}
109
+ strategy:
110
+ matrix:
111
+ platform:
112
+ - runner: ubuntu-22.04
113
+ target: x86_64
114
+ - runner: ubuntu-22.04
115
+ target: x86
116
+ - runner: ubuntu-22.04
117
+ target: aarch64
118
+ - runner: ubuntu-22.04
119
+ target: armv7
120
+ steps:
121
+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
122
+ - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6
123
+ with:
124
+ python-version: 3.x
125
+ - name: Set Cargo.toml package version
126
+ uses: colt-1/toml-editor@1.1.1
127
+ with:
128
+ file: Cargo.toml
129
+ key: package.version
130
+ value: ${{ needs.calculate-version.outputs.version }}
131
+ - name: Build wheels
132
+ uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1
133
+ with:
134
+ target: ${{ matrix.platform.target }}
135
+ args: --release --out dist --find-interpreter
136
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
137
+ manylinux: musllinux_1_2
138
+ - name: Upload wheels
139
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
140
+ with:
141
+ name: wheels-musllinux-${{ matrix.platform.target }}
142
+ path: dist
143
+
144
+ windows:
145
+ needs: calculate-version
146
+ runs-on: ${{ matrix.platform.runner }}
147
+ strategy:
148
+ matrix:
149
+ platform:
150
+ - runner: windows-latest
151
+ target: x64
152
+ - runner: windows-latest
153
+ target: x86
154
+ steps:
155
+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
156
+ - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6
157
+ with:
158
+ python-version: 3.x
159
+ architecture: ${{ matrix.platform.target }}
160
+ - name: Set Cargo.toml package version
161
+ uses: colt-1/toml-editor@1.1.1
162
+ with:
163
+ file: Cargo.toml
164
+ key: package.version
165
+ value: ${{ needs.calculate-version.outputs.version }}
166
+ - name: Build wheels
167
+ uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1
168
+ with:
169
+ target: ${{ matrix.platform.target }}
170
+ args: --release --out dist --find-interpreter
171
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
172
+ - name: Upload wheels
173
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
174
+ with:
175
+ name: wheels-windows-${{ matrix.platform.target }}
176
+ path: dist
177
+
178
+ macos:
179
+ needs: calculate-version
180
+ runs-on: ${{ matrix.platform.runner }}
181
+ strategy:
182
+ matrix:
183
+ platform:
184
+ - runner: macos-13
185
+ target: x86_64
186
+ - runner: macos-14
187
+ target: aarch64
188
+ steps:
189
+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
190
+ - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6
191
+ with:
192
+ python-version: 3.x
193
+ - name: Set Cargo.toml package version
194
+ uses: colt-1/toml-editor@1.1.1
195
+ with:
196
+ file: Cargo.toml
197
+ key: package.version
198
+ value: ${{ needs.calculate-version.outputs.version }}
199
+ - name: Build wheels
200
+ uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1
201
+ with:
202
+ target: ${{ matrix.platform.target }}
203
+ args: --release --out dist --find-interpreter
204
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
205
+ - name: Upload wheels
206
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
207
+ with:
208
+ name: wheels-macos-${{ matrix.platform.target }}
209
+ path: dist
210
+
211
+ sdist:
212
+ needs: calculate-version
213
+ runs-on: ubuntu-latest
214
+ steps:
215
+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
216
+ - name: Set Cargo.toml package version
217
+ uses: colt-1/toml-editor@1.1.1
218
+ with:
219
+ file: Cargo.toml
220
+ key: package.version
221
+ value: ${{ needs.calculate-version.outputs.version }}
222
+ - name: Build sdist
223
+ uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1
224
+ with:
225
+ command: sdist
226
+ args: --out dist
227
+ - name: Upload sdist
228
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
229
+ with:
230
+ name: wheels-sdist
231
+ path: dist
232
+
233
+ release:
234
+ name: Release
235
+ needs: [get-next-version, sdist, linux, musllinux, windows, macos]
236
+ runs-on: ubuntu-latest
237
+ if: needs.get-next-version.outputs.new-release-published == 'true'
238
+ permissions:
239
+ # Use to sign the release artifacts
240
+ id-token: write
241
+ # Used to upload release artifacts
242
+ contents: write
243
+ # Used to generate artifact attestation
244
+ attestations: write
245
+ # Used to comment on pull requests
246
+ pull-requests: write
247
+ environment:
248
+ name: pypi
249
+ url: https://pypi.org/p/gitpure
250
+ steps:
251
+ - name: Checkout
252
+ uses: actions/checkout@v5
253
+ with:
254
+ fetch-depth: 0
255
+ - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5
256
+ - name: Generate artifact attestation
257
+ uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3
258
+ with:
259
+ subject-path: 'wheels-*/*'
260
+ - name: Install semantic-release-cargo
261
+ run: cargo install --locked semantic-release-cargo
262
+
263
+ - name: Set up Node.js
264
+ uses: actions/setup-node@v4
265
+ with:
266
+ node-version: 'lts/*'
267
+
268
+ - name: Install npm dependencies
269
+ run: npm ci
270
+
271
+ - name: Run semantic-release
272
+ env:
273
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
274
+ run: npx semantic-release
275
+
276
+ - name: Publish to PyPI
277
+ uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1
278
+ with:
279
+ command: upload
280
+ args: --non-interactive --skip-existing wheels-*/*
281
+
282
+ success:
283
+ name: Success
284
+ runs-on: ubuntu-latest
285
+ needs: [tests, linux, musllinux, windows, macos, sdist]
286
+ if: ${{ !cancelled() && !failure() }}
287
+ steps:
288
+ - name: Mark success
289
+ run: echo "All required jobs completed successfully."
@@ -1,4 +1,5 @@
1
1
  /target
2
+ node_modules/
2
3
 
3
4
  # Byte-compiled / optimized / DLL files
4
5
  __pycache__/
@@ -0,0 +1,15 @@
1
+ {
2
+ "tagFormat": "${version}",
3
+ "plugins": [
4
+ "@semantic-release/commit-analyzer",
5
+ "@semantic-release/release-notes-generator",
6
+ [
7
+ "@semantic-release/github",
8
+ {
9
+ "assets": [
10
+ "wheels-*/*"
11
+ ]
12
+ }
13
+ ]
14
+ ]
15
+ }
@@ -406,7 +406,7 @@ checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7"
406
406
 
407
407
  [[package]]
408
408
  name = "gitpure"
409
- version = "0.1.1"
409
+ version = "1.0.0"
410
410
  dependencies = [
411
411
  "gix",
412
412
  "pyo3",
@@ -1814,9 +1814,9 @@ dependencies = [
1814
1814
 
1815
1815
  [[package]]
1816
1816
  name = "pyo3"
1817
- version = "0.25.1"
1817
+ version = "0.26.0"
1818
1818
  source = "registry+https://github.com/rust-lang/crates.io-index"
1819
- checksum = "8970a78afe0628a3e3430376fc5fd76b6b45c4d43360ffd6cdd40bdde72b682a"
1819
+ checksum = "7ba0117f4212101ee6544044dae45abe1083d30ce7b29c4b5cbdfa2354e07383"
1820
1820
  dependencies = [
1821
1821
  "indoc",
1822
1822
  "libc",
@@ -1831,19 +1831,18 @@ dependencies = [
1831
1831
 
1832
1832
  [[package]]
1833
1833
  name = "pyo3-build-config"
1834
- version = "0.25.1"
1834
+ version = "0.26.0"
1835
1835
  source = "registry+https://github.com/rust-lang/crates.io-index"
1836
- checksum = "458eb0c55e7ece017adeba38f2248ff3ac615e53660d7c71a238d7d2a01c7598"
1836
+ checksum = "4fc6ddaf24947d12a9aa31ac65431fb1b851b8f4365426e182901eabfb87df5f"
1837
1837
  dependencies = [
1838
- "once_cell",
1839
1838
  "target-lexicon",
1840
1839
  ]
1841
1840
 
1842
1841
  [[package]]
1843
1842
  name = "pyo3-ffi"
1844
- version = "0.25.1"
1843
+ version = "0.26.0"
1845
1844
  source = "registry+https://github.com/rust-lang/crates.io-index"
1846
- checksum = "7114fe5457c61b276ab77c5055f206295b812608083644a5c5b2640c3102565c"
1845
+ checksum = "025474d3928738efb38ac36d4744a74a400c901c7596199e20e45d98eb194105"
1847
1846
  dependencies = [
1848
1847
  "libc",
1849
1848
  "pyo3-build-config",
@@ -1851,9 +1850,9 @@ dependencies = [
1851
1850
 
1852
1851
  [[package]]
1853
1852
  name = "pyo3-macros"
1854
- version = "0.25.1"
1853
+ version = "0.26.0"
1855
1854
  source = "registry+https://github.com/rust-lang/crates.io-index"
1856
- checksum = "a8725c0a622b374d6cb051d11a0983786448f7785336139c3c94f5aa6bef7e50"
1855
+ checksum = "2e64eb489f22fe1c95911b77c44cc41e7c19f3082fc81cce90f657cdc42ffded"
1857
1856
  dependencies = [
1858
1857
  "proc-macro2",
1859
1858
  "pyo3-macros-backend",
@@ -1863,9 +1862,9 @@ dependencies = [
1863
1862
 
1864
1863
  [[package]]
1865
1864
  name = "pyo3-macros-backend"
1866
- version = "0.25.1"
1865
+ version = "0.26.0"
1867
1866
  source = "registry+https://github.com/rust-lang/crates.io-index"
1868
- checksum = "4109984c22491085343c05b0dbc54ddc405c3cf7b4374fc533f5c3313a572ccc"
1867
+ checksum = "100246c0ecf400b475341b8455a9213344569af29a3c841d29270e53102e0fcf"
1869
1868
  dependencies = [
1870
1869
  "heck",
1871
1870
  "proc-macro2",
@@ -0,0 +1,29 @@
1
+ [package]
2
+ name = "gitpure"
3
+ version = "1.0.0"
4
+ edition = "2024"
5
+ authors = [ "Max Dymond <cmeister2@gmail.com>" ]
6
+ license = "MIT"
7
+ description = "A Python git library implemented in Rust using gitoxide"
8
+ readme = "README.md"
9
+ homepage = "https://github.com/cmeister2/gitpure"
10
+ repository = "https://github.com/cmeister2/gitpure"
11
+ documentation = "https://github.com/cmeister2/gitpure"
12
+ keywords = [ "git", "python", "rust", "gitoxide", "version-control" ]
13
+ categories = [ "development-tools", "api-bindings" ]
14
+
15
+ [lib]
16
+ name = "gitpure"
17
+ crate-type = [ "cdylib" ]
18
+
19
+ [dependencies]
20
+ pyo3 = "0.26.0"
21
+
22
+ [dependencies.gix]
23
+ version = "0.73.0"
24
+ default-features = false
25
+ features = [
26
+ "blocking-http-transport-reqwest-rust-tls",
27
+ "parallel",
28
+ "worktree-mutation"
29
+ ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitpure
3
- Version: 0.1.1
3
+ Version: 1.0.0
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -20,6 +20,7 @@ Classifier: Topic :: Software Development :: Version Control
20
20
  Classifier: Topic :: Software Development :: Version Control :: Git
21
21
  Classifier: Typing :: Typed
22
22
  Requires-Dist: pytest ; extra == 'test'
23
+ Requires-Dist: gitpython>=3.1 ; extra == 'test'
23
24
  Provides-Extra: test
24
25
  License-File: LICENSE
25
26
  Summary: A Python git library implemented in Rust using gitoxide
@@ -115,6 +116,21 @@ pip install pytest
115
116
  pytest tests/
116
117
  ```
117
118
 
119
+ ## Release process
120
+
121
+ Releases are fully automated with [semantic-release](https://semantic-release.gitbook.io/). The pipeline will:
122
+
123
+ 1. Inspect the commit history on `main` using Conventional Commits to determine the next semantic version.
124
+ 2. Prepare the Rust crate via `semantic-release-cargo`, ensuring `Cargo.toml` and the Python wheel share the same version.
125
+ 3. Build wheels and source distributions with `maturin` and attach them to the GitHub release.
126
+ 4. Publish the distribution artifacts to PyPI.
127
+
128
+ To keep releases working you must:
129
+
130
+ - Continue to write commits that follow the Conventional Commits specification (`feat:`, `fix:`, etc.).
131
+
132
+ You can trigger a release by merging changes into `main`.
133
+
118
134
  ## Architecture
119
135
 
120
136
  gitpure is built on top of:
@@ -77,6 +77,21 @@ pip install pytest
77
77
  pytest tests/
78
78
  ```
79
79
 
80
+ ## Release process
81
+
82
+ Releases are fully automated with [semantic-release](https://semantic-release.gitbook.io/). The pipeline will:
83
+
84
+ 1. Inspect the commit history on `main` using Conventional Commits to determine the next semantic version.
85
+ 2. Prepare the Rust crate via `semantic-release-cargo`, ensuring `Cargo.toml` and the Python wheel share the same version.
86
+ 3. Build wheels and source distributions with `maturin` and attach them to the GitHub release.
87
+ 4. Publish the distribution artifacts to PyPI.
88
+
89
+ To keep releases working you must:
90
+
91
+ - Continue to write commits that follow the Conventional Commits specification (`feat:`, `fix:`, etc.).
92
+
93
+ You can trigger a release by merging changes into `main`.
94
+
80
95
  ## Architecture
81
96
 
82
97
  gitpure is built on top of:
@@ -0,0 +1,108 @@
1
+ """
2
+ Type stubs for gitpure - A pure git Python module implemented in Rust.
3
+ """
4
+
5
+ from pathlib import Path
6
+ from typing import Type
7
+
8
+
9
+ class Commit:
10
+ """Lightweight representation of a git commit."""
11
+
12
+ @property
13
+ def hexsha(self) -> str:
14
+ """Hexadecimal object id of the commit."""
15
+ ...
16
+
17
+
18
+ class Head:
19
+ """A named reference to a commit, mirroring GitPython's Head."""
20
+
21
+ @property
22
+ def name(self) -> str:
23
+ """The short name of the head (branch)."""
24
+ ...
25
+
26
+ @property
27
+ def commit(self) -> Commit | None:
28
+ """The commit the head points to, if available."""
29
+ ...
30
+
31
+
32
+ class Tag:
33
+ """A tag reference with optional peeled commit."""
34
+
35
+ @property
36
+ def name(self) -> str:
37
+ """The short name of the tag."""
38
+ ...
39
+
40
+ @property
41
+ def commit(self) -> Commit | None:
42
+ """The commit the tag ultimately refers to, if available."""
43
+ ...
44
+
45
+ class Repo:
46
+ """A git repository wrapper using gix (gitoxide)."""
47
+
48
+ @property
49
+ def git_dir(self) -> Path:
50
+ """
51
+ Path to the .git directory of the repository.
52
+
53
+ Returns:
54
+ The absolute path to the .git directory as a pathlib.Path object
55
+ """
56
+ ...
57
+
58
+ def branches(self) -> list[str]:
59
+ """Return the names of all local branches in the repository."""
60
+ ...
61
+
62
+ @property
63
+ def working_tree_dir(self) -> Path | None:
64
+ """Return the working tree directory of the repository, if it exists."""
65
+ ...
66
+
67
+ @property
68
+ def is_bare(self) -> bool:
69
+ """Whether the repository is bare (has no working tree)."""
70
+ ...
71
+
72
+ @property
73
+ def active_branch(self) -> Head | None:
74
+ """Current active branch as a Head object, if available."""
75
+ ...
76
+
77
+ @property
78
+ def head(self) -> Head | None:
79
+ """HEAD reference as a Head object, if available."""
80
+ ...
81
+
82
+ @property
83
+ def heads(self) -> list[Head]:
84
+ """Return all local heads (branches) in the repository."""
85
+ ...
86
+
87
+ @property
88
+ def tags(self) -> list[Tag]:
89
+ """Return all tags in the repository."""
90
+ ...
91
+
92
+ @classmethod
93
+ def clone_from(cls: Type["Repo"], url: str, to_path: str, bare: bool = False) -> "Repo":
94
+ """
95
+ Clone a repository from a URL to a local path.
96
+
97
+ Args:
98
+ url: The URL of the repository to clone
99
+ to_path: The local path where the repository should be cloned
100
+ bare: Whether to create a bare repository (default: False)
101
+
102
+ Returns:
103
+ A new Repo instance representing the cloned repository
104
+
105
+ Raises:
106
+ RuntimeError: If the clone operation fails
107
+ """
108
+ ...