bencode-rs 0.0.8__tar.gz → 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 (46) hide show
  1. bencode_rs-0.1.0/.github/mergify.yml +34 -0
  2. {bencode_rs-0.0.8 → bencode_rs-0.1.0}/.github/renovate.json +6 -2
  3. bencode_rs-0.1.0/.github/workflows/_build_wheels.yaml +173 -0
  4. bencode_rs-0.1.0/.github/workflows/autofix.yaml +26 -0
  5. bencode_rs-0.1.0/.github/workflows/ci.yaml +254 -0
  6. {bencode_rs-0.0.8 → bencode_rs-0.1.0}/.github/workflows/release.yaml +5 -3
  7. {bencode_rs-0.0.8 → bencode_rs-0.1.0}/.pre-commit-config.yaml +12 -5
  8. {bencode_rs-0.0.8 → bencode_rs-0.1.0}/Cargo.lock +38 -73
  9. {bencode_rs-0.0.8 → bencode_rs-0.1.0}/Cargo.toml +6 -3
  10. bencode_rs-0.1.0/PKG-INFO +88 -0
  11. bencode_rs-0.1.0/dprint.json +15 -0
  12. {bencode_rs-0.0.8 → bencode_rs-0.1.0}/leak.py +3 -4
  13. bencode_rs-0.1.0/py/bencode_rs/__init__.py +15 -0
  14. {bencode_rs-0.0.8 → bencode_rs-0.1.0}/py/bencode_rs/__init__.pyi +1 -0
  15. bencode_rs-0.1.0/pyproject.toml +62 -0
  16. bencode_rs-0.1.0/readme.md +65 -0
  17. {bencode_rs-0.0.8 → bencode_rs-0.1.0}/rust-toolchain.toml +1 -1
  18. bencode_rs-0.1.0/rustfmt.toml +12 -0
  19. {bencode_rs-0.0.8 → bencode_rs-0.1.0}/src/decode.rs +57 -30
  20. bencode_rs-0.1.0/src/encode.rs +444 -0
  21. {bencode_rs-0.0.8 → bencode_rs-0.1.0}/src/lib.rs +3 -1
  22. bencode_rs-0.1.0/taskfile.dist.yaml +12 -0
  23. {bencode_rs-0.0.8 → bencode_rs-0.1.0}/tests/test_1_encode.py +39 -4
  24. {bencode_rs-0.0.8 → bencode_rs-0.1.0}/tests/test_2_decode.py +84 -4
  25. bencode_rs-0.1.0/tests/test_3_freethreaded.py +55 -0
  26. bencode_rs-0.1.0/uv.lock +1055 -0
  27. bencode_rs-0.0.8/.github/mergify.yml +0 -8
  28. bencode_rs-0.0.8/.github/workflows/_build_wheels.yaml +0 -98
  29. bencode_rs-0.0.8/.github/workflows/autofix.yaml +0 -42
  30. bencode_rs-0.0.8/.github/workflows/ci.yaml +0 -188
  31. bencode_rs-0.0.8/PKG-INFO +0 -49
  32. bencode_rs-0.0.8/py/bencode_rs/__init__.py +0 -8
  33. bencode_rs-0.0.8/pyproject.toml +0 -50
  34. bencode_rs-0.0.8/readme.md +0 -26
  35. bencode_rs-0.0.8/rustfmt.toml +0 -12
  36. bencode_rs-0.0.8/src/encode.rs +0 -354
  37. bencode_rs-0.0.8/uv.lock +0 -873
  38. {bencode_rs-0.0.8 → bencode_rs-0.1.0}/.coveragerc +0 -0
  39. {bencode_rs-0.0.8 → bencode_rs-0.1.0}/.gitattributes +0 -0
  40. {bencode_rs-0.0.8 → bencode_rs-0.1.0}/.gitignore +0 -0
  41. {bencode_rs-0.0.8 → bencode_rs-0.1.0}/LICENSE +0 -0
  42. {bencode_rs-0.0.8 → bencode_rs-0.1.0}/py/bencode_rs/py.typed +0 -0
  43. {bencode_rs-0.0.8 → bencode_rs-0.1.0}/tests/bench.py +0 -0
  44. {bencode_rs-0.0.8 → bencode_rs-0.1.0}/tests/fixtures/56507.torrent.bin +0 -0
  45. {bencode_rs-0.0.8 → bencode_rs-0.1.0}/tests/fixtures/multiple-files.torrent.bin +0 -0
  46. {bencode_rs-0.0.8 → bencode_rs-0.1.0}/tests/fixtures/ubuntu-22.04.2-desktop-amd64.iso.torrent.bin +0 -0
@@ -0,0 +1,34 @@
1
+ merge_queue:
2
+ max_parallel_checks: 1
3
+ queued_label: 'ci:queued'
4
+ dequeued_label: 'ci:dequeued'
5
+
6
+ queue_rules:
7
+ - name: renovate
8
+ update_method: merge
9
+
10
+ pull_request_rules:
11
+ - name: label conflicts
12
+ conditions:
13
+ - conflict
14
+ actions:
15
+ label:
16
+ toggle:
17
+ - conflict
18
+
19
+ - name: Automatic merge on approval
20
+ conditions:
21
+ - or:
22
+ - '#approved-reviews-by>=1'
23
+ - label=ci:auto-merge
24
+ - or:
25
+ - not:
26
+ and:
27
+ - 'head*=renovate/lockfile-maintenance-*'
28
+ - 'created-at<=24h ago'
29
+ - base=master
30
+ - check-success=cargo-fmt
31
+ - check-success=all-ci-jobs
32
+ actions:
33
+ queue:
34
+ name: renovate
@@ -2,8 +2,12 @@
2
2
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
3
  "extends": [
4
4
  "github>trim21/renovate-config",
5
- "github>trim21/renovate-config:python",
6
- "github>trim21/renovate-config:rust"
5
+ "github>trim21/renovate-config:rust",
6
+ "github>trim21/renovate-config:python"
7
+ ],
8
+ "labels": [
9
+ "ci:auto-merge",
10
+ "dependencies"
7
11
  ],
8
12
  "lockFileMaintenance": {
9
13
  "enabled": true
@@ -0,0 +1,173 @@
1
+ name: Reusable workflow example
2
+
3
+ on:
4
+ workflow_call:
5
+
6
+ jobs:
7
+ sdist:
8
+ runs-on: ubuntu-26.04
9
+ steps:
10
+ - uses: actions/checkout@v7
11
+ - name: Set up Python ${{ matrix.python-version }}
12
+ uses: actions/setup-python@v7
13
+ with:
14
+ python-version: '3.15.2'
15
+ - name: Build sdist
16
+ uses: PyO3/maturin-action@v1
17
+ with:
18
+ command: sdist
19
+ args: --out dist
20
+ - name: Upload sdist
21
+ uses: actions/upload-artifact@v7
22
+ with:
23
+ name: wheels-sdist
24
+ path: dist
25
+
26
+ wheel:
27
+ runs-on: ${{ matrix.platform.runner }}
28
+ strategy:
29
+ fail-fast: false
30
+ matrix:
31
+ platform:
32
+ - runner: macos-15
33
+ target: aarch64
34
+ py: arm64
35
+ manylinux: auto
36
+
37
+ - runner: windows-latest
38
+ target: x64
39
+ py: x64
40
+ manylinux: auto
41
+
42
+ - runner: ubuntu-24.04
43
+ target: x86_64
44
+ manylinux: auto
45
+ - runner: ubuntu-24.04-arm
46
+ target: aarch64
47
+ manylinux: auto
48
+ - runner: ubuntu-24.04
49
+ target: armv7
50
+ manylinux: auto
51
+ - runner: ubuntu-24.04
52
+ target: s390x
53
+ manylinux: auto
54
+ - runner: ubuntu-24.04
55
+ target: ppc64le
56
+ manylinux: auto
57
+ - runner: ubuntu-24.04
58
+ target: x86_64-unknown-linux-musl
59
+ manylinux: musllinux_1_2
60
+ - runner: ubuntu-24.04-arm
61
+ target: aarch64-unknown-linux-musl
62
+ manylinux: musllinux_1_2
63
+
64
+ steps:
65
+ - uses: actions/checkout@v7
66
+
67
+ - uses: trim21/setup-rust@v0.0.2
68
+ if: ${{ runner.os != 'Linux' }}
69
+
70
+ - uses: actions/setup-python@v7
71
+ if: ${{ runner.os != 'Linux' }}
72
+ with:
73
+ python-version: '3.10'
74
+ architecture: ${{ matrix.platform.py }}
75
+
76
+ - uses: actions/setup-python@v7
77
+ if: ${{ runner.os != 'Linux' }}
78
+ with:
79
+ python-version: '3.11'
80
+ architecture: ${{ matrix.platform.py }}
81
+
82
+ - name: Build wheels
83
+ uses: PyO3/maturin-action@v1
84
+ with:
85
+ target: ${{ matrix.platform.target }}
86
+ args: --release --out dist --interpreter '3.11' --interpreter '3.10'
87
+ manylinux: ${{ matrix.platform.manylinux }}
88
+
89
+ - run: ls -ahl dist
90
+ shell: bash
91
+
92
+ - shell: bash
93
+ run: |
94
+ python3 -c "
95
+ import hashlib, glob
96
+ for f in sorted(glob.glob('dist/*.whl')):
97
+ h = hashlib.sha256(open(f, 'rb').read()).hexdigest()
98
+ print(f'{h} {f}')
99
+ "
100
+
101
+ - name: Upload wheels
102
+ uses: actions/upload-artifact@v7
103
+ with:
104
+ name: wheels-${{ runner.os }}-${{ matrix.platform.target }}
105
+ path: dist
106
+
107
+ wheel-freethreaded:
108
+ runs-on: ${{ matrix.platform.runner }}
109
+ strategy:
110
+ fail-fast: false
111
+ matrix:
112
+ platform:
113
+ - runner: macos-15
114
+ target: aarch64
115
+ py: arm64
116
+ manylinux: auto
117
+
118
+ - runner: windows-latest
119
+ target: x64
120
+ py: x64
121
+ manylinux: auto
122
+
123
+ - runner: ubuntu-24.04
124
+ target: x86_64
125
+ manylinux: auto
126
+ - runner: ubuntu-24.04-arm
127
+ target: aarch64
128
+ manylinux: auto
129
+ - runner: ubuntu-24.04
130
+ target: x86_64-unknown-linux-musl
131
+ manylinux: musllinux_1_2
132
+ - runner: ubuntu-24.04-arm
133
+ target: aarch64-unknown-linux-musl
134
+ manylinux: musllinux_1_2
135
+
136
+ steps:
137
+ - uses: actions/checkout@v7
138
+
139
+ - uses: trim21/setup-rust@v0.0.2
140
+ if: ${{ runner.os != 'Linux' }}
141
+
142
+ # the manylinux images already ship the free-threaded interpreter
143
+ - uses: actions/setup-python@v7
144
+ if: ${{ runner.os != 'Linux' }}
145
+ with:
146
+ python-version: '3.14t'
147
+ architecture: ${{ matrix.platform.py }}
148
+
149
+ - name: Build wheels
150
+ uses: PyO3/maturin-action@v1
151
+ with:
152
+ target: ${{ matrix.platform.target }}
153
+ args: --release --out dist --interpreter '3.14t'
154
+ manylinux: ${{ matrix.platform.manylinux }}
155
+
156
+ - run: ls -ahl dist
157
+ shell: bash
158
+
159
+ - name: Upload wheels
160
+ uses: actions/upload-artifact@v7
161
+ with:
162
+ name: wheels-freethreaded-${{ runner.os }}-${{ matrix.platform.target }}
163
+ path: dist
164
+
165
+ merge-wheel-artifact:
166
+ runs-on: ubuntu-26.04
167
+ needs: ['sdist', 'wheel', 'wheel-freethreaded']
168
+ steps:
169
+ - name: Merge Artifacts
170
+ uses: actions/upload-artifact/merge@v7
171
+ with:
172
+ name: wheel
173
+ pattern: wheels-*
@@ -0,0 +1,26 @@
1
+ name: autofix.ci
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - master
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ cargo:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - name: Checkout code
16
+ uses: actions/checkout@v7
17
+
18
+ - uses: trim21/setup-rust@v0.0.2
19
+
20
+ - run: cargo fmt || true
21
+ - run: cargo clippy --fix --allow-dirty || true
22
+ # incomplete hook fixes are committed by autofix-ci/action below, the strict run lives in ci.yaml
23
+ - uses: trim21/actions/prek@master
24
+ continue-on-error: true
25
+
26
+ - uses: autofix-ci/action@v1
@@ -0,0 +1,254 @@
1
+ name: ci
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - master
7
+ workflow_dispatch:
8
+ push:
9
+ branches:
10
+ - master
11
+ tags-ignore:
12
+ - '*'
13
+
14
+ jobs:
15
+ build:
16
+ concurrency:
17
+ group: '${{ github.workflow }}-${{ github.ref }}'
18
+ cancel-in-progress: true
19
+ uses: ./.github/workflows/_build_wheels.yaml
20
+
21
+ cargo-fmt:
22
+ runs-on: ubuntu-26.04
23
+ steps:
24
+ - uses: actions/checkout@v7
25
+ - uses: trim21/setup-rust@v0.0.2
26
+ - run: cargo fmt --check --all
27
+
28
+ lint:
29
+ runs-on: ubuntu-26.04
30
+ steps:
31
+ - uses: actions/checkout@v7
32
+ - uses: trim21/setup-rust@v0.0.2
33
+ - run: cargo clippy --all-targets -- -D warnings
34
+
35
+ prek:
36
+ runs-on: ubuntu-26.04
37
+ steps:
38
+ - uses: actions/checkout@v7
39
+ - uses: trim21/actions/prek@master
40
+
41
+ all-ci-jobs:
42
+ needs: [
43
+ 'test',
44
+ 'test-freethreaded',
45
+ 'bench-cp',
46
+ 'coverage',
47
+ 'audit',
48
+ 'lint',
49
+ 'prek',
50
+ ]
51
+ runs-on: ubuntu-slim
52
+ steps:
53
+ - run: echo 1
54
+
55
+ test:
56
+ strategy:
57
+ fail-fast: false
58
+ matrix:
59
+ os: ['ubuntu-24.04', 'macos-15', 'windows-latest']
60
+ python-version:
61
+ - '3.10'
62
+ - '3.11'
63
+ - '3.12'
64
+ - '3.13'
65
+ - '3.14'
66
+
67
+ runs-on: '${{ matrix.os }}'
68
+
69
+ needs: [build]
70
+
71
+ steps:
72
+ - uses: actions/checkout@v7
73
+ - uses: actions/download-artifact@v8
74
+ with:
75
+ name: wheel
76
+ path: dist
77
+ - name: Set up Python ${{ matrix.python-version }}
78
+ uses: actions/setup-python@v7
79
+ with:
80
+ python-version: ${{ matrix.python-version }}
81
+
82
+ - name: Set up uv
83
+ uses: astral-sh/setup-uv@v10.3.3
84
+ with:
85
+ enable-cache: true
86
+ activate-environment: true
87
+
88
+ - name: Install Python deps from lock (dev)
89
+ run: |
90
+ uv sync --locked --group dev
91
+
92
+ - run: |
93
+ python3 -c "
94
+ import hashlib, glob
95
+ for f in sorted(glob.glob('dist/*.whl')):
96
+ h = hashlib.sha256(open(f, 'rb').read()).hexdigest()
97
+ print(f'{h} {f}')
98
+ "
99
+
100
+ - run: uv pip install --no-cache --reinstall bencode-rs --no-index --find-links ./dist/ -vv
101
+
102
+ - run: pytest -sv
103
+ env:
104
+ RUST_BACKTRACE: 'full'
105
+
106
+ test-freethreaded:
107
+ strategy:
108
+ fail-fast: false
109
+ matrix:
110
+ os: ['ubuntu-24.04', 'macos-15', 'windows-latest']
111
+
112
+ runs-on: '${{ matrix.os }}'
113
+
114
+ needs: [build]
115
+
116
+ steps:
117
+ - uses: actions/checkout@v7
118
+ - uses: actions/download-artifact@v8
119
+ with:
120
+ name: wheel
121
+ path: dist
122
+
123
+ - name: Set up Python 3.14t
124
+ uses: actions/setup-python@v7
125
+ with:
126
+ python-version: '3.14t'
127
+
128
+ # the dev group pulls in packages without free-threaded wheels, the suite itself needs pytest only
129
+ - run: python -m pip install pytest
130
+ - run: python -m pip install --no-index --find-links ./dist/ --force-reinstall bencode-rs
131
+
132
+ - run: python -m pytest -sv tests --ignore=tests/bench.py
133
+ env:
134
+ RUST_BACKTRACE: 'full'
135
+
136
+ bench-cp:
137
+ strategy:
138
+ matrix:
139
+ python-version:
140
+ - '3.12'
141
+
142
+ runs-on: 'ubuntu-26.04'
143
+
144
+ steps:
145
+ - uses: actions/checkout@v7
146
+ - uses: trim21/setup-rust@v0.0.2
147
+
148
+ - name: Set up Python ${{ matrix.python-version }}
149
+ uses: actions/setup-python@v7
150
+ with:
151
+ python-version: ${{ matrix.python-version }}
152
+
153
+ - name: Set up uv
154
+ uses: astral-sh/setup-uv@v10.3.3
155
+ with:
156
+ enable-cache: true
157
+ activate-environment: true
158
+
159
+ - name: Install Python deps from lock (dev)
160
+ run: |
161
+ uv sync --locked --group dev
162
+
163
+ - run: maturin build --release --out dist
164
+ - run: uv pip install bencode-rs --no-index --find-links ./dist/
165
+
166
+ - name: Run benchmarks
167
+ uses: CodSpeedHQ/action@v5
168
+ with:
169
+ token: ${{ secrets.CODSPEED_TOKEN }}
170
+ mode: 'simulation'
171
+ run: python -m pytest tests/bench.py --codspeed
172
+
173
+ audit:
174
+ name: Audit
175
+ needs: [build]
176
+ runs-on: ubuntu-26.04
177
+ steps:
178
+ - uses: actions/checkout@v7
179
+
180
+ - name: Set up Python 3.14.2
181
+ uses: actions/setup-python@v7
182
+ with:
183
+ python-version: '3.15.2'
184
+
185
+ - name: Set up uv
186
+ uses: astral-sh/setup-uv@v10.3.3
187
+ with:
188
+ enable-cache: true
189
+ activate-environment: true
190
+
191
+ - run: uv sync --dev
192
+
193
+ - uses: actions/download-artifact@v8
194
+ with:
195
+ name: wheel
196
+ path: dist
197
+
198
+ - run: abi3audit --verbose dist/*abi3*.whl
199
+ - run: twine check --strict dist/*
200
+
201
+ coverage:
202
+ name: Coverage for ${{ matrix.python-version }}
203
+ strategy:
204
+ matrix:
205
+ python-version:
206
+ - '3.10'
207
+ - '3.11'
208
+ - '3.12'
209
+ - '3.13'
210
+ - '3.14'
211
+
212
+ runs-on: ubuntu-26.04
213
+ steps:
214
+ - uses: actions/checkout@v7
215
+ - name: Set up Python ${{ matrix.python-version }}
216
+ uses: actions/setup-python@v7
217
+ with:
218
+ python-version: '${{ matrix.python-version }}'
219
+
220
+ - name: Set up uv
221
+ uses: astral-sh/setup-uv@v10.3.3
222
+ with:
223
+ enable-cache: true
224
+ activate-environment: true
225
+
226
+ - uses: trim21/setup-rust@v0.0.2
227
+ with:
228
+ components: llvm-tools
229
+
230
+ - name: Install cargo-llvm-cov
231
+ uses: taiki-e/install-action@v2
232
+ with:
233
+ tool: cargo-llvm-cov
234
+
235
+ - run: uv sync --dev
236
+ - run: uv tool install maturin
237
+
238
+ - name: Run coverage
239
+ run: |
240
+ set -euxo pipefail
241
+ source <(cargo llvm-cov show-env --export-prefix)
242
+ export CARGO_TARGET_DIR=$CARGO_LLVM_COV_TARGET_DIR
243
+ if [ "${{ matrix.python-version }}" = "3.10" ]; then
244
+ maturin develop --uv --no-default-features
245
+ else
246
+ maturin develop --uv
247
+ fi
248
+ pytest tests
249
+ cargo llvm-cov report --lcov --output-path coverage.lcov
250
+
251
+ - uses: codecov/codecov-action@v7
252
+ with:
253
+ files: coverage.lcov
254
+ token: '${{ secrets.CODECOV_TOKEN }}'
@@ -12,14 +12,16 @@ jobs:
12
12
  upload_all:
13
13
  name: Upload wheels to PyPI
14
14
  needs: [build]
15
- runs-on: ubuntu-24.04
15
+ runs-on: ubuntu-slim
16
16
  environment: pypi
17
17
  permissions:
18
18
  id-token: write
19
19
  steps:
20
- - uses: actions/download-artifact@v7
20
+ - uses: actions/download-artifact@v8
21
21
  with:
22
22
  name: wheel
23
23
  path: dist
24
24
 
25
- - uses: pypa/gh-action-pypi-publish@v1.13.0
25
+ - uses: astral-sh/setup-uv@v10.3.3
26
+
27
+ - run: uv publish
@@ -1,11 +1,10 @@
1
1
  exclude: '^.*\.(bin|torrent)$'
2
2
 
3
3
  repos:
4
- - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
5
- rev: v2.16.0
4
+ - repo: https://github.com/trim21/dprint-pre-commit
5
+ rev: 'v0.51.1.0'
6
6
  hooks:
7
- - id: pretty-format-yaml
8
- args: [--autofix, --indent, '2', '--preserve-quotes', --offset, '2']
7
+ - id: dprint
9
8
 
10
9
  - repo: https://github.com/pre-commit/pre-commit-hooks
11
10
  rev: v6.0.0
@@ -21,7 +20,15 @@ repos:
21
20
  args: [--fix=lf]
22
21
  - id: end-of-file-fixer
23
22
 
23
+ - repo: https://github.com/astral-sh/ruff-pre-commit
24
+ # Ruff version.
25
+ rev: v0.17.3
26
+ hooks:
27
+ # Run the linter.
28
+ - id: ruff
29
+ args: [--fix]
30
+
24
31
  - repo: https://github.com/psf/black
25
- rev: 25.12.0
32
+ rev: 26.10.1
26
33
  hooks:
27
34
  - id: black