diskcache-rs 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 (62) hide show
  1. diskcache_rs-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +46 -0
  2. diskcache_rs-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +26 -0
  3. diskcache_rs-0.1.0/.github/pull_request_template.md +49 -0
  4. diskcache_rs-0.1.0/.github/workflows/benchmark.yml +117 -0
  5. diskcache_rs-0.1.0/.github/workflows/build.yml +243 -0
  6. diskcache_rs-0.1.0/.github/workflows/ci.yml +69 -0
  7. diskcache_rs-0.1.0/.github/workflows/release.yml +104 -0
  8. diskcache_rs-0.1.0/.gitignore +95 -0
  9. diskcache_rs-0.1.0/Cargo.lock +1441 -0
  10. diskcache_rs-0.1.0/Cargo.toml +48 -0
  11. diskcache_rs-0.1.0/Dockerfile.test +41 -0
  12. diskcache_rs-0.1.0/LICENSE +195 -0
  13. diskcache_rs-0.1.0/PKG-INFO +324 -0
  14. diskcache_rs-0.1.0/PROJECT_SUMMARY.md +129 -0
  15. diskcache_rs-0.1.0/README.md +292 -0
  16. diskcache_rs-0.1.0/README_zh.md +228 -0
  17. diskcache_rs-0.1.0/RELEASE.md +167 -0
  18. diskcache_rs-0.1.0/benchmarks/detailed_profiling.py +242 -0
  19. diskcache_rs-0.1.0/benchmarks/high_performance_test.py +199 -0
  20. diskcache_rs-0.1.0/benchmarks/micro_benchmark.py +272 -0
  21. diskcache_rs-0.1.0/benchmarks/performance_comparison.py +380 -0
  22. diskcache_rs-0.1.0/benchmarks/precise_benchmark.py +233 -0
  23. diskcache_rs-0.1.0/benchmarks/set_performance_analysis.py +218 -0
  24. diskcache_rs-0.1.0/docker-compose.test.yml +77 -0
  25. diskcache_rs-0.1.0/docs/PERFORMANCE_OPTIMIZATION_SUMMARY.md +135 -0
  26. diskcache_rs-0.1.0/examples/basic_usage.py +191 -0
  27. diskcache_rs-0.1.0/pyproject.toml +116 -0
  28. diskcache_rs-0.1.0/python/diskcache_rs/__init__.py +36 -0
  29. diskcache_rs-0.1.0/python/diskcache_rs/cache.py +550 -0
  30. diskcache_rs-0.1.0/python/diskcache_rs/core.py +41 -0
  31. diskcache_rs-0.1.0/python/diskcache_rs/fast_cache.py +373 -0
  32. diskcache_rs-0.1.0/python/diskcache_rs/pickle_cache.py +257 -0
  33. diskcache_rs-0.1.0/python/diskcache_rs/rust_pickle.py +71 -0
  34. diskcache_rs-0.1.0/renovate.json +6 -0
  35. diskcache_rs-0.1.0/scripts/test-docker-network.sh +66 -0
  36. diskcache_rs-0.1.0/src/cache.rs +782 -0
  37. diskcache_rs-0.1.0/src/error.rs +48 -0
  38. diskcache_rs-0.1.0/src/eviction.rs +440 -0
  39. diskcache_rs-0.1.0/src/lib.rs +45 -0
  40. diskcache_rs-0.1.0/src/memory_cache.rs +221 -0
  41. diskcache_rs-0.1.0/src/migration.rs +273 -0
  42. diskcache_rs-0.1.0/src/pickle_cache.rs +375 -0
  43. diskcache_rs-0.1.0/src/serialization.rs +271 -0
  44. diskcache_rs-0.1.0/src/storage/hybrid_backend.rs +497 -0
  45. diskcache_rs-0.1.0/src/storage/tests.rs +267 -0
  46. diskcache_rs-0.1.0/src/storage/ultra_fast_backend.rs +96 -0
  47. diskcache_rs-0.1.0/src/storage.rs +239 -0
  48. diskcache_rs-0.1.0/src/utils.rs +306 -0
  49. diskcache_rs-0.1.0/tests/__init__.py +1 -0
  50. diskcache_rs-0.1.0/tests/benchmark_official.py +256 -0
  51. diskcache_rs-0.1.0/tests/conftest.py +134 -0
  52. diskcache_rs-0.1.0/tests/test_basic_operations.py +168 -0
  53. diskcache_rs-0.1.0/tests/test_ci_benchmark.py +173 -0
  54. diskcache_rs-0.1.0/tests/test_compatibility.py +320 -0
  55. diskcache_rs-0.1.0/tests/test_cross_platform_network.py +360 -0
  56. diskcache_rs-0.1.0/tests/test_docker_network.py +321 -0
  57. diskcache_rs-0.1.0/tests/test_fast_cache.py +300 -0
  58. diskcache_rs-0.1.0/tests/test_network_filesystem.py +215 -0
  59. diskcache_rs-0.1.0/tests/test_performance.py +446 -0
  60. diskcache_rs-0.1.0/tests/test_pickle_cache.py +253 -0
  61. diskcache_rs-0.1.0/tests/test_rust_pickle_performance.py +266 -0
  62. diskcache_rs-0.1.0/uv.lock +447 -0
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: 'bug'
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
+
20
+ **Expected behavior**
21
+ A clear and concise description of what you expected to happen.
22
+
23
+ **Error message**
24
+ If applicable, add the full error message or traceback.
25
+
26
+ ```
27
+ Paste error message here
28
+ ```
29
+
30
+ **Environment (please complete the following information):**
31
+ - OS: [e.g. Windows 10, Ubuntu 20.04, macOS 12]
32
+ - Python version: [e.g. 3.9.7]
33
+ - diskcache_rs version: [e.g. 0.1.0]
34
+ - Storage type: [e.g. local disk, network drive, cloud storage]
35
+
36
+ **Network filesystem details (if applicable):**
37
+ - Type: [e.g. SMB, NFS, cloud drive]
38
+ - Provider: [e.g. OneDrive, Google Drive, AWS EFS]
39
+ - Mount point: [e.g. Z:, /mnt/network]
40
+
41
+ **Additional context**
42
+ Add any other context about the problem here.
43
+
44
+ **Comparison with python-diskcache**
45
+ Does the same operation work with the original python-diskcache? [Yes/No]
46
+ If yes, please provide the working python-diskcache code.
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: 'enhancement'
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Use case**
20
+ Describe your specific use case and how this feature would help.
21
+
22
+ **Compatibility**
23
+ Should this feature be compatible with python-diskcache? [Yes/No/Not applicable]
24
+
25
+ **Additional context**
26
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,49 @@
1
+ ## Description
2
+
3
+ Brief description of the changes in this PR.
4
+
5
+ ## Type of Change
6
+
7
+ - [ ] Bug fix (non-breaking change which fixes an issue)
8
+ - [ ] New feature (non-breaking change which adds functionality)
9
+ - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
10
+ - [ ] Documentation update
11
+ - [ ] Performance improvement
12
+ - [ ] Code refactoring
13
+
14
+ ## Testing
15
+
16
+ - [ ] Tests pass locally
17
+ - [ ] Added tests for new functionality
18
+ - [ ] Benchmarks run successfully
19
+ - [ ] Tested on network filesystem (if applicable)
20
+
21
+ ## Checklist
22
+
23
+ - [ ] My code follows the project's style guidelines
24
+ - [ ] I have performed a self-review of my own code
25
+ - [ ] I have commented my code, particularly in hard-to-understand areas
26
+ - [ ] I have made corresponding changes to the documentation
27
+ - [ ] My changes generate no new warnings
28
+ - [ ] I have added tests that prove my fix is effective or that my feature works
29
+ - [ ] New and existing unit tests pass locally with my changes
30
+ - [ ] Any dependent changes have been merged and published
31
+
32
+ ## Performance Impact
33
+
34
+ If this change affects performance, please describe:
35
+ - [ ] Performance benchmarks included
36
+ - [ ] No significant performance impact
37
+ - [ ] Performance improvement (describe)
38
+ - [ ] Performance regression (justify)
39
+
40
+ ## Breaking Changes
41
+
42
+ If this is a breaking change, please describe:
43
+ - What functionality is affected
44
+ - How users should migrate their code
45
+ - Why this breaking change is necessary
46
+
47
+ ## Additional Notes
48
+
49
+ Any additional information that reviewers should know.
@@ -0,0 +1,117 @@
1
+ name: Performance Benchmark
2
+
3
+ on:
4
+ pull_request:
5
+ paths:
6
+ - 'src/**'
7
+ - 'benchmarks/**'
8
+ - 'Cargo.toml'
9
+ - 'pyproject.toml'
10
+ push:
11
+ branches:
12
+ - main
13
+ workflow_dispatch:
14
+
15
+ permissions:
16
+ contents: read
17
+ pull-requests: write
18
+
19
+ jobs:
20
+ benchmark:
21
+ name: Performance Comparison
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+ with:
26
+ fetch-depth: 0
27
+
28
+ - uses: actions/setup-python@v5
29
+ with:
30
+ python-version: '3.11'
31
+
32
+ - name: Install Rust
33
+ uses: dtolnay/rust-toolchain@stable
34
+
35
+ - name: Install uv
36
+ uses: astral-sh/setup-uv@v4
37
+
38
+ - name: Install dependencies
39
+ run: |
40
+ uv sync --group benchmark
41
+
42
+ - name: Build extension (release mode)
43
+ run: uv pip install -e .
44
+
45
+ - name: Run performance benchmarks
46
+ run: |
47
+ uv run python benchmarks/performance_comparison.py
48
+
49
+ - name: Run pytest benchmarks
50
+ run: |
51
+ uv run python -m pytest tests/test_performance.py -v -k "benchmark" --benchmark-skip
52
+
53
+ - name: Run official benchmark comparison
54
+ run: |
55
+ uv run python tests/benchmark_official.py -n 1000
56
+
57
+ - name: Upload benchmark results
58
+ uses: actions/upload-artifact@v4
59
+ with:
60
+ name: benchmark-results-${{ github.sha }}
61
+ path: benchmark_results.json
62
+ if: always()
63
+
64
+ - name: Comment PR with benchmark results
65
+ if: github.event_name == 'pull_request'
66
+ uses: actions/github-script@v7
67
+ with:
68
+ script: |
69
+ const fs = require('fs');
70
+
71
+ try {
72
+ const results = JSON.parse(fs.readFileSync('benchmark_results.json', 'utf8'));
73
+
74
+ let comment = '## 📊 Performance Benchmark Results\n\n';
75
+ comment += '| Benchmark | python-diskcache | diskcache_rs | Winner |\n';
76
+ comment += '|-----------|------------------|--------------|--------|\n';
77
+
78
+ for (const [name, result] of Object.entries(results)) {
79
+ // Handle both old and new result formats
80
+ let dcOps, rsOps;
81
+ if (result.diskcache && result.diskcache_rs) {
82
+ // New format with nested operations
83
+ if (result.diskcache.get && result.diskcache_rs.get) {
84
+ dcOps = result.diskcache.get.ops_per_sec;
85
+ rsOps = result.diskcache_rs.get.ops_per_sec;
86
+ } else {
87
+ dcOps = result.diskcache.ops_per_sec || 0;
88
+ rsOps = result.diskcache_rs.ops_per_sec || 0;
89
+ }
90
+ } else {
91
+ continue; // Skip malformed results
92
+ }
93
+
94
+ let winner;
95
+ if (dcOps > rsOps) {
96
+ winner = `python-diskcache (${(dcOps/rsOps).toFixed(1)}x)`;
97
+ } else {
98
+ winner = `diskcache_rs (${(rsOps/dcOps).toFixed(1)}x)`;
99
+ }
100
+
101
+ comment += `| ${name} | ${dcOps.toFixed(1)} ops/s | ${rsOps.toFixed(1)} ops/s | ${winner} |\n`;
102
+ }
103
+
104
+ comment += '\n> 💡 **Note**: Performance varies based on storage type and network conditions.\n';
105
+ comment += '> diskcache_rs is optimized for network filesystems and provides better reliability.\n';
106
+
107
+ github.rest.issues.createComment({
108
+ issue_number: context.issue.number,
109
+ owner: context.repo.owner,
110
+ repo: context.repo.repo,
111
+ body: comment
112
+ });
113
+ } catch (error) {
114
+ console.error('Failed to post benchmark results:', error);
115
+ }
116
+
117
+
@@ -0,0 +1,243 @@
1
+ name: Build Wheels
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ tags:
8
+ - '*'
9
+ pull_request:
10
+ workflow_dispatch:
11
+ workflow_call:
12
+
13
+ permissions:
14
+ contents: read
15
+
16
+ jobs:
17
+ # Linux builds
18
+ linux:
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ target: [x86_64, i686]
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+ - uses: actions/setup-python@v5
26
+ with:
27
+ python-version: '3.11'
28
+ architecture: x64
29
+ - name: Build wheels
30
+ uses: PyO3/maturin-action@v1
31
+ with:
32
+ target: ${{ matrix.target }}
33
+ args: --release --out dist --find-interpreter
34
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
35
+ manylinux: auto
36
+ - name: Install built wheel
37
+ if: matrix.target == 'x86_64'
38
+ run: |
39
+ pip install diskcache_rs --find-links dist --force-reinstall
40
+ python -c "import diskcache_rs; print('diskcache_rs imported successfully')"
41
+ - name: Upload wheels
42
+ uses: actions/upload-artifact@v4
43
+ with:
44
+ name: wheels-linux-${{ matrix.target }}
45
+ path: dist
46
+
47
+ # Linux cross-compilation
48
+ linux-cross:
49
+ runs-on: ubuntu-latest
50
+ strategy:
51
+ matrix:
52
+ target: [aarch64, armv7]
53
+ steps:
54
+ - uses: actions/checkout@v4
55
+ - uses: actions/setup-python@v5
56
+ with:
57
+ python-version: '3.11'
58
+ - name: Build wheels
59
+ uses: PyO3/maturin-action@v1
60
+ with:
61
+ target: ${{ matrix.target }}
62
+ args: --release --out dist --find-interpreter
63
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
64
+ manylinux: auto
65
+ - uses: uraimo/run-on-arch-action@v3.0.1
66
+ if: matrix.target != 'ppc64le'
67
+ name: Install built wheel
68
+ with:
69
+ arch: ${{ matrix.target }}
70
+ distro: ubuntu20.04
71
+ githubToken: ${{ github.token }}
72
+ install: |
73
+ apt-get update
74
+ apt-get install -y --no-install-recommends python3 python3-pip curl
75
+ curl -LsSf https://astral.sh/uv/install.sh | sh
76
+ run: |
77
+ source $HOME/.local/bin/env
78
+ uv pip install diskcache_rs --find-links dist/ --force-reinstall --system
79
+ python3 -c "import diskcache_rs; print('diskcache_rs imported successfully')"
80
+ - name: Upload wheels
81
+ uses: actions/upload-artifact@v4
82
+ with:
83
+ name: wheels-linux-cross-${{ matrix.target }}
84
+ path: dist
85
+
86
+ # musllinux builds
87
+ musllinux:
88
+ runs-on: ubuntu-latest
89
+ strategy:
90
+ matrix:
91
+ target:
92
+ - x86_64-unknown-linux-musl
93
+ - i686-unknown-linux-musl
94
+ steps:
95
+ - uses: actions/checkout@v4
96
+ - uses: actions/setup-python@v5
97
+ with:
98
+ python-version: '3.11'
99
+ architecture: x64
100
+ - name: Build wheels
101
+ uses: PyO3/maturin-action@v1
102
+ with:
103
+ target: ${{ matrix.target }}
104
+ args: --release --out dist --find-interpreter
105
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
106
+ manylinux: musllinux_1_2
107
+ - name: Install built wheel
108
+ if: matrix.target == 'x86_64-unknown-linux-musl'
109
+ uses: addnab/docker-run-action@v3
110
+ with:
111
+ image: alpine:latest
112
+ options: -v ${{ github.workspace }}:/io -w /io
113
+ run: |
114
+ apk add py3-pip curl python3-dev
115
+ curl -LsSf https://astral.sh/uv/install.sh | sh
116
+ source $HOME/.local/bin/env
117
+ # Try to create virtual environment, fallback to --system if venv not available
118
+ if python3 -m venv /tmp/test_env 2>/dev/null; then
119
+ source /tmp/test_env/bin/activate
120
+ uv pip install diskcache_rs --find-links /io/dist/ --force-reinstall
121
+ else
122
+ echo "venv not available, using --system flag"
123
+ uv pip install diskcache_rs --find-links /io/dist/ --force-reinstall --system
124
+ fi
125
+ python3 -c "import diskcache_rs; print('diskcache_rs imported successfully')"
126
+ - name: Upload wheels
127
+ uses: actions/upload-artifact@v4
128
+ with:
129
+ name: wheels-musllinux-${{ matrix.target }}
130
+ path: dist
131
+
132
+ # musllinux cross-compilation
133
+ musllinux-cross:
134
+ runs-on: ubuntu-latest
135
+ strategy:
136
+ matrix:
137
+ platform:
138
+ - target: aarch64-unknown-linux-musl
139
+ arch: aarch64
140
+ - target: armv7-unknown-linux-musleabihf
141
+ arch: armv7
142
+ steps:
143
+ - uses: actions/checkout@v4
144
+ - uses: actions/setup-python@v5
145
+ with:
146
+ python-version: '3.11'
147
+ - name: Build wheels
148
+ uses: PyO3/maturin-action@v1
149
+ with:
150
+ target: ${{ matrix.platform.target }}
151
+ args: --release --out dist --find-interpreter
152
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
153
+ manylinux: musllinux_1_2
154
+ - uses: uraimo/run-on-arch-action@v3.0.1
155
+ name: Install built wheel
156
+ with:
157
+ arch: ${{ matrix.platform.arch }}
158
+ distro: alpine_latest
159
+ githubToken: ${{ github.token }}
160
+ install: |
161
+ apk add py3-pip curl python3-dev
162
+ curl -LsSf https://astral.sh/uv/install.sh | sh
163
+ run: |
164
+ source $HOME/.local/bin/env
165
+ # Try to create virtual environment, fallback to --system if venv not available
166
+ if python3 -m venv /tmp/test_env 2>/dev/null; then
167
+ source /tmp/test_env/bin/activate
168
+ uv pip install diskcache_rs --find-links dist/ --force-reinstall
169
+ else
170
+ echo "venv not available, using --system flag"
171
+ uv pip install diskcache_rs --find-links dist/ --force-reinstall --system
172
+ fi
173
+ python3 -c "import diskcache_rs; print('diskcache_rs imported successfully')"
174
+ - name: Upload wheels
175
+ uses: actions/upload-artifact@v4
176
+ with:
177
+ name: wheels-musllinux-cross-${{ matrix.platform.target }}
178
+ path: dist
179
+
180
+ # Windows builds
181
+ windows:
182
+ runs-on: windows-latest
183
+ strategy:
184
+ matrix:
185
+ target: [x64, x86]
186
+ steps:
187
+ - uses: actions/checkout@v4
188
+ - uses: actions/setup-python@v5
189
+ with:
190
+ python-version: '3.11'
191
+ architecture: ${{ matrix.target }}
192
+ - uses: dtolnay/rust-toolchain@stable
193
+ - name: Build wheels
194
+ uses: PyO3/maturin-action@v1
195
+ with:
196
+ target: ${{ matrix.target }}
197
+ args: --release --out dist --find-interpreter
198
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
199
+ - name: Install built wheel
200
+ run: |
201
+ pip install diskcache_rs --find-links dist --force-reinstall
202
+ python -c "import diskcache_rs; print('diskcache_rs imported successfully')"
203
+ - name: Upload wheels
204
+ uses: actions/upload-artifact@v4
205
+ with:
206
+ name: wheels-windows-${{ matrix.target }}
207
+ path: dist
208
+
209
+ # macOS builds
210
+ macos:
211
+ runs-on: macos-latest
212
+ steps:
213
+ - uses: actions/checkout@v4
214
+ - uses: actions/setup-python@v5
215
+ with:
216
+ python-version: '3.11'
217
+ architecture: x64
218
+ - uses: dtolnay/rust-toolchain@stable
219
+ - name: Build wheels - x86_64
220
+ uses: PyO3/maturin-action@v1
221
+ with:
222
+ target: x86_64
223
+ args: --release --out dist --sdist --find-interpreter
224
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
225
+ - name: Install built wheel - x86_64
226
+ run: |
227
+ pip install diskcache_rs --find-links dist --force-reinstall
228
+ python -c "import diskcache_rs; print('diskcache_rs imported successfully')"
229
+ - name: Build wheels - universal2
230
+ uses: PyO3/maturin-action@v1
231
+ with:
232
+ target: universal2-apple-darwin
233
+ args: --release --out dist --find-interpreter
234
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
235
+ - name: Install built wheel - universal2
236
+ run: |
237
+ pip install diskcache_rs --find-links dist --force-reinstall
238
+ python -c "import diskcache_rs; print('diskcache_rs imported successfully')"
239
+ - name: Upload wheels
240
+ uses: actions/upload-artifact@v4
241
+ with:
242
+ name: wheels-macos
243
+ path: dist
@@ -0,0 +1,69 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ workflow_dispatch:
9
+ workflow_call:
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ jobs:
15
+ # Code quality and testing
16
+ test:
17
+ name: Test Suite
18
+ runs-on: ${{ matrix.os }}
19
+ strategy:
20
+ matrix:
21
+ os: [ubuntu-latest, windows-latest, macos-latest]
22
+ python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+ - name: Install uv
26
+ uses: astral-sh/setup-uv@v4
27
+ with:
28
+ python-version: ${{ matrix.python-version }}
29
+ - name: Install Rust
30
+ uses: dtolnay/rust-toolchain@stable
31
+ - name: Install dependencies
32
+ run: uv sync --group test
33
+ - name: Install build dependencies
34
+ run: uv pip install maturin
35
+ - name: Build extension
36
+ run: uv run maturin develop
37
+ env:
38
+ RUST_BACKTRACE: 1
39
+ - name: Run pytest
40
+ run: uv run python -m pytest tests/ -v --tb=short -m "not docker"
41
+ env:
42
+ PYTHONUNBUFFERED: 1
43
+ - name: Run basic functionality tests
44
+ run: uv run python -c 'import diskcache_rs; print("diskcache_rs imported successfully")'
45
+
46
+ # Code formatting and linting
47
+ lint:
48
+ name: Code Quality
49
+ runs-on: ubuntu-latest
50
+ steps:
51
+ - uses: actions/checkout@v4
52
+ - name: Install uv
53
+ uses: astral-sh/setup-uv@v4
54
+ with:
55
+ python-version: "3.11"
56
+ - name: Install Rust
57
+ uses: dtolnay/rust-toolchain@stable
58
+ with:
59
+ components: rustfmt, clippy
60
+ - name: Install dependencies
61
+ run: uv sync --group dev
62
+ - name: Check Rust formatting
63
+ run: cargo fmt --all -- --check
64
+ - name: Run Clippy
65
+ run: cargo clippy --all-targets --all-features
66
+ - name: Run ruff check
67
+ run: uvx ruff check .
68
+ - name: Run ruff format check
69
+ run: uvx ruff format --check .
@@ -0,0 +1,104 @@
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
+ # Call the build workflow to build all wheels
14
+ build:
15
+ uses: ./.github/workflows/build.yml
16
+ permissions:
17
+ contents: read
18
+
19
+ # Call the CI workflow to run tests
20
+ test:
21
+ uses: ./.github/workflows/ci.yml
22
+ permissions:
23
+ contents: read
24
+
25
+ # Publish to PyPI
26
+ release:
27
+ name: Publish to PyPI
28
+ runs-on: ubuntu-latest
29
+ needs: [build, test]
30
+ permissions:
31
+ # IMPORTANT: this permission is mandatory for trusted publishing
32
+ id-token: write
33
+ # Used to upload release artifacts
34
+ contents: write
35
+ # Used to generate artifact attestation
36
+ attestations: write
37
+ environment:
38
+ name: pypi
39
+ url: https://pypi.org/p/diskcache_rs
40
+ steps:
41
+ - name: Download all artifacts
42
+ uses: actions/download-artifact@v4
43
+ with:
44
+ path: dist
45
+ merge-multiple: true
46
+
47
+ - name: List downloaded artifacts
48
+ run: |
49
+ ls -la dist/
50
+ echo "Total files: $(ls -1 dist/ | wc -l)"
51
+
52
+ - name: Generate artifact attestation
53
+ uses: actions/attest-build-provenance@v2
54
+ with:
55
+ subject-path: 'dist/*'
56
+
57
+ - name: Publish to PyPI
58
+ uses: pypa/gh-action-pypi-publish@release/v1
59
+ with:
60
+ packages-dir: dist/
61
+
62
+ # Create GitHub Release
63
+ github-release:
64
+ name: Create GitHub Release
65
+ runs-on: ubuntu-latest
66
+ needs: [release]
67
+ permissions:
68
+ contents: write
69
+ steps:
70
+ - uses: actions/checkout@v4
71
+ with:
72
+ fetch-depth: 0
73
+
74
+ - name: Generate changelog
75
+ id: changelog
76
+ run: |
77
+ # Get the latest tag
78
+ LATEST_TAG=$(git describe --tags --abbrev=0)
79
+ PREVIOUS_TAG=$(git describe --tags --abbrev=0 $LATEST_TAG^)
80
+
81
+ echo "## Changes in $LATEST_TAG" > CHANGELOG.md
82
+ echo "" >> CHANGELOG.md
83
+
84
+ # Get commits between tags
85
+ git log --pretty=format:"- %s (%h)" $PREVIOUS_TAG..$LATEST_TAG >> CHANGELOG.md
86
+
87
+ echo "changelog<<EOF" >> $GITHUB_OUTPUT
88
+ cat CHANGELOG.md >> $GITHUB_OUTPUT
89
+ echo "EOF" >> $GITHUB_OUTPUT
90
+
91
+ - name: Download all artifacts
92
+ uses: actions/download-artifact@v4
93
+ with:
94
+ path: release-artifacts
95
+ merge-multiple: true
96
+
97
+ - name: Create Release
98
+ uses: softprops/action-gh-release@v2
99
+ with:
100
+ body: ${{ steps.changelog.outputs.changelog }}
101
+ files: release-artifacts/*
102
+ draft: false
103
+ prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
104
+ generate_release_notes: true