gitpure 0.1.2__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.
@@ -9,18 +9,34 @@ on:
9
9
  push:
10
10
  branches:
11
11
  - main
12
- - master
13
- tags:
14
- - '*'
15
12
  pull_request:
16
- workflow_dispatch:
17
13
 
18
14
  permissions:
19
15
  contents: read
20
16
 
21
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
+
22
37
  tests:
23
38
  runs-on: ubuntu-latest
39
+ needs: calculate-version
24
40
  steps:
25
41
  - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
26
42
  - name: Set up Python
@@ -29,6 +45,12 @@ jobs:
29
45
  python-version: '3.13'
30
46
  - name: Set up Rust toolchain
31
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 }}
32
54
  - name: Install build tooling
33
55
  run: |
34
56
  python -m pip install --upgrade pip
@@ -39,6 +61,7 @@ jobs:
39
61
  run: pytest -s
40
62
 
41
63
  linux:
64
+ needs: calculate-version
42
65
  runs-on: ${{ matrix.platform.runner }}
43
66
  strategy:
44
67
  matrix:
@@ -60,6 +83,12 @@ jobs:
60
83
  - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6
61
84
  with:
62
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 }}
63
92
  - name: Build wheels
64
93
  uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1
65
94
  with:
@@ -75,6 +104,7 @@ jobs:
75
104
  path: dist
76
105
 
77
106
  musllinux:
107
+ needs: calculate-version
78
108
  runs-on: ${{ matrix.platform.runner }}
79
109
  strategy:
80
110
  matrix:
@@ -92,6 +122,12 @@ jobs:
92
122
  - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6
93
123
  with:
94
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 }}
95
131
  - name: Build wheels
96
132
  uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1
97
133
  with:
@@ -106,6 +142,7 @@ jobs:
106
142
  path: dist
107
143
 
108
144
  windows:
145
+ needs: calculate-version
109
146
  runs-on: ${{ matrix.platform.runner }}
110
147
  strategy:
111
148
  matrix:
@@ -120,6 +157,12 @@ jobs:
120
157
  with:
121
158
  python-version: 3.x
122
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 }}
123
166
  - name: Build wheels
124
167
  uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1
125
168
  with:
@@ -133,6 +176,7 @@ jobs:
133
176
  path: dist
134
177
 
135
178
  macos:
179
+ needs: calculate-version
136
180
  runs-on: ${{ matrix.platform.runner }}
137
181
  strategy:
138
182
  matrix:
@@ -146,6 +190,12 @@ jobs:
146
190
  - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6
147
191
  with:
148
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 }}
149
199
  - name: Build wheels
150
200
  uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1
151
201
  with:
@@ -158,19 +208,17 @@ jobs:
158
208
  name: wheels-macos-${{ matrix.platform.target }}
159
209
  path: dist
160
210
 
161
- success:
162
- name: Success
163
- runs-on: ubuntu-latest
164
- needs: [tests, linux, musllinux, windows, macos, sdist]
165
- if: ${{ !cancelled() && !failure() }}
166
- steps:
167
- - name: Mark success
168
- run: echo "All required jobs completed successfully."
169
-
170
211
  sdist:
212
+ needs: calculate-version
171
213
  runs-on: ubuntu-latest
172
214
  steps:
173
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 }}
174
222
  - name: Build sdist
175
223
  uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1
176
224
  with:
@@ -184,9 +232,9 @@ jobs:
184
232
 
185
233
  release:
186
234
  name: Release
235
+ needs: [get-next-version, sdist, linux, musllinux, windows, macos]
187
236
  runs-on: ubuntu-latest
188
- if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
189
- needs: [tests, linux, musllinux, windows, macos, sdist]
237
+ if: needs.get-next-version.outputs.new-release-published == 'true'
190
238
  permissions:
191
239
  # Use to sign the release artifacts
192
240
  id-token: write
@@ -194,18 +242,48 @@ jobs:
194
242
  contents: write
195
243
  # Used to generate artifact attestation
196
244
  attestations: write
245
+ # Used to comment on pull requests
246
+ pull-requests: write
197
247
  environment:
198
248
  name: pypi
199
- url: https://pypi.org/p/gitpure
249
+ url: https://pypi.org/p/gitpure
200
250
  steps:
251
+ - name: Checkout
252
+ uses: actions/checkout@v5
253
+ with:
254
+ fetch-depth: 0
201
255
  - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5
202
256
  - name: Generate artifact attestation
203
257
  uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3
204
258
  with:
205
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
+
206
276
  - name: Publish to PyPI
207
- if: ${{ startsWith(github.ref, 'refs/tags/') }}
208
277
  uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1
209
278
  with:
210
279
  command: upload
211
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.2"
409
+ version = "1.0.0"
410
410
  dependencies = [
411
411
  "gix",
412
412
  "pyo3",
@@ -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.2
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
@@ -116,6 +116,21 @@ pip install pytest
116
116
  pytest tests/
117
117
  ```
118
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
+
119
134
  ## Architecture
120
135
 
121
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:
@@ -44,12 +44,12 @@ class Tag:
44
44
 
45
45
  class Repo:
46
46
  """A git repository wrapper using gix (gitoxide)."""
47
-
47
+
48
48
  @property
49
49
  def git_dir(self) -> Path:
50
50
  """
51
51
  Path to the .git directory of the repository.
52
-
52
+
53
53
  Returns:
54
54
  The absolute path to the .git directory as a pathlib.Path object
55
55
  """
@@ -88,20 +88,20 @@ class Repo:
88
88
  def tags(self) -> list[Tag]:
89
89
  """Return all tags in the repository."""
90
90
  ...
91
-
91
+
92
92
  @classmethod
93
93
  def clone_from(cls: Type["Repo"], url: str, to_path: str, bare: bool = False) -> "Repo":
94
94
  """
95
95
  Clone a repository from a URL to a local path.
96
-
96
+
97
97
  Args:
98
98
  url: The URL of the repository to clone
99
99
  to_path: The local path where the repository should be cloned
100
100
  bare: Whether to create a bare repository (default: False)
101
-
101
+
102
102
  Returns:
103
103
  A new Repo instance representing the cloned repository
104
-
104
+
105
105
  Raises:
106
106
  RuntimeError: If the clone operation fails
107
107
  """