pysentry-rs 0.1.4__tar.gz → 0.2.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.

Potentially problematic release.


This version of pysentry-rs might be problematic. Click here for more details.

Files changed (48) hide show
  1. pysentry_rs-0.2.0/.pre-commit-config.yaml +57 -0
  2. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/Cargo.lock +1 -1
  3. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/Cargo.toml +1 -1
  4. pysentry_rs-0.2.0/PKG-INFO +562 -0
  5. pysentry_rs-0.2.0/README.md +535 -0
  6. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/fixtures/requirements-tests/requirements-dev.txt +1 -1
  7. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/fixtures/requirements-tests/requirements.txt +1 -1
  8. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/fixtures/requirements-tests-vulnerable/requirements.txt +1 -1
  9. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/pyproject.toml +1 -1
  10. pysentry_rs-0.2.0/python/pysentry/__init__.py +187 -0
  11. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/dependency/scanner.rs +5 -15
  12. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/main.rs +171 -110
  13. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/parsers/lock.rs +214 -171
  14. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/parsers/mod.rs +25 -27
  15. pysentry_rs-0.2.0/src/parsers/poetry_lock.rs +300 -0
  16. pysentry_rs-0.2.0/src/parsers/pyproject.rs +935 -0
  17. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/parsers/requirements.rs +7 -12
  18. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/providers/osv.rs +1 -1
  19. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/providers/pypi.rs +1 -1
  20. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/python.rs +3 -4
  21. pysentry_rs-0.1.4/PKG-INFO +0 -376
  22. pysentry_rs-0.1.4/README.md +0 -349
  23. pysentry_rs-0.1.4/python/pysentry/__init__.py +0 -161
  24. pysentry_rs-0.1.4/src/parsers/pyproject.rs +0 -387
  25. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/.github/dependabot.yml +0 -0
  26. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/.github/workflows/ci.yml +0 -0
  27. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/.github/workflows/release.yml +0 -0
  28. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/.gitignore +0 -0
  29. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/LICENSE +0 -0
  30. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/python/pysentry/__main__.py +0 -0
  31. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/cache/audit.rs +0 -0
  32. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/cache/mod.rs +0 -0
  33. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/cache/storage.rs +0 -0
  34. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/dependency/mod.rs +0 -0
  35. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/dependency/resolvers/mod.rs +0 -0
  36. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/dependency/resolvers/pip_tools.rs +0 -0
  37. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/dependency/resolvers/uv.rs +0 -0
  38. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/error.rs +0 -0
  39. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/lib.rs +0 -0
  40. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/output/mod.rs +0 -0
  41. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/output/report.rs +0 -0
  42. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/output/sarif.rs +0 -0
  43. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/providers/mod.rs +0 -0
  44. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/providers/pypa.rs +0 -0
  45. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/types.rs +0 -0
  46. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/vulnerability/database.rs +0 -0
  47. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/vulnerability/matcher.rs +0 -0
  48. {pysentry_rs-0.1.4 → pysentry_rs-0.2.0}/src/vulnerability/mod.rs +0 -0
@@ -0,0 +1,57 @@
1
+ repos:
2
+ # Rust formatting and linting
3
+ - repo: local
4
+ hooks:
5
+ # Format Rust code
6
+ - id: cargo-fmt
7
+ name: cargo fmt
8
+ entry: cargo fmt --all -- --check
9
+ language: system
10
+ files: \.rs$
11
+ pass_filenames: false
12
+
13
+ # Lint Rust code with Clippy
14
+ - id: cargo-clippy
15
+ name: cargo clippy
16
+ entry: cargo clippy --all-targets --all-features -- -D warnings
17
+ language: system
18
+ files: \.rs$
19
+ pass_filenames: false
20
+
21
+ # Check Rust compilation
22
+ - id: cargo-check
23
+ name: cargo check
24
+ entry: cargo check --all-targets --all-features
25
+ language: system
26
+ files: \.rs$
27
+ pass_filenames: false
28
+
29
+ # Run Rust tests
30
+ - id: cargo-test
31
+ name: cargo test
32
+ entry: cargo test --verbose
33
+ language: system
34
+ files: \.rs$
35
+ pass_filenames: false
36
+
37
+ - repo: local
38
+ hooks:
39
+ - id: cargo-audit
40
+ name: cargo audit
41
+ entry: cargo audit
42
+ language: system
43
+ files: Cargo\.(toml|lock)$
44
+ pass_filenames: false
45
+ stages: [manual]
46
+
47
+ # General file checks
48
+ - repo: https://github.com/pre-commit/pre-commit-hooks
49
+ rev: v5.0.0
50
+ hooks:
51
+ - id: trailing-whitespace
52
+ - id: end-of-file-fixer
53
+ - id: check-yaml
54
+ - id: check-toml
55
+ - id: check-merge-conflict
56
+ - id: check-added-large-files
57
+ args: ["--maxkb=1024"]
@@ -1067,7 +1067,7 @@ dependencies = [
1067
1067
 
1068
1068
  [[package]]
1069
1069
  name = "pysentry"
1070
- version = "0.1.4"
1070
+ version = "0.2.0"
1071
1071
  dependencies = [
1072
1072
  "anyhow",
1073
1073
  "async-trait",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "pysentry"
3
- version = "0.1.4"
3
+ version = "0.2.0"
4
4
  edition = "2021"
5
5
  rust-version = "1.79"
6
6
  description = "Security vulnerability auditing for Python packages"
@@ -0,0 +1,562 @@
1
+ Metadata-Version: 2.4
2
+ Name: pysentry-rs
3
+ Version: 0.2.0
4
+ Classifier: Development Status :: 4 - Beta
5
+ Classifier: Intended Audience :: Developers
6
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
7
+ Classifier: Programming Language :: Rust
8
+ Classifier: Programming Language :: Python :: Implementation :: CPython
9
+ Classifier: Programming Language :: Python :: 3.8
10
+ Classifier: Programming Language :: Python :: 3.9
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Topic :: Security
16
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
17
+ License-File: LICENSE
18
+ Summary: Security vulnerability auditing tool for Python packages
19
+ Author-email: nyudenkov <nyudenkov@pm.me>
20
+ License: GPL-3.0
21
+ Requires-Python: >=3.8
22
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
23
+ Project-URL: Homepage, https://github.com/nyudenkov/pysentry
24
+ Project-URL: Repository, https://github.com/nyudenkov/pysentry
25
+ Project-URL: Issues, https://github.com/nyudenkov/pysentry/issues
26
+
27
+ # 🐍 PySentry
28
+
29
+ [Help to test and improve](https://github.com/nyudenkov/pysentry/issues/12)
30
+
31
+ A fast, reliable security vulnerability scanner for Python projects, written in Rust.
32
+
33
+ ## Overview
34
+
35
+ PySentry audits Python projects for known security vulnerabilities by analyzing dependency files (`uv.lock`, `poetry.lock`, `pyproject.toml`, `requirements.txt`) and cross-referencing them against multiple vulnerability databases. It provides comprehensive reporting with support for various output formats and filtering options.
36
+
37
+ ## Key Features
38
+
39
+ - **Multiple Project Formats**: Supports `uv.lock`, `poetry.lock`, `pyproject.toml`, and `requirements.txt` files
40
+ - **External Resolver Integration**: Leverages `uv` and `pip-tools` for accurate requirements.txt constraint solving
41
+ - **Multiple Data Sources**:
42
+ - PyPA Advisory Database (default)
43
+ - PyPI JSON API
44
+ - OSV.dev (Open Source Vulnerabilities)
45
+ - **Flexible Output**: Human-readable, JSON, and SARIF formats
46
+ - **Performance Focused**:
47
+ - Written in Rust for speed
48
+ - Async/concurrent processing
49
+ - Intelligent caching system
50
+ - **Comprehensive Filtering**:
51
+ - Severity levels (low, medium, high, critical)
52
+ - Dependency scopes (main only vs all [optional, dev, prod, etc] dependencies)
53
+ - Direct vs. transitive dependencies
54
+ - **Enterprise Ready**: SARIF output for IDE/CI integration
55
+
56
+ ## Installation
57
+
58
+ Choose the installation method that works best for you:
59
+
60
+ ### ⚡ Via uvx (Recommended for occasional use)
61
+
62
+ Run directly without installing (requires [uv](https://docs.astral.sh/uv/)):
63
+
64
+ ```bash
65
+ uvx pysentry-rs /path/to/project
66
+ ```
67
+
68
+ This method:
69
+
70
+ - Runs the latest version without installation
71
+ - Automatically manages Python environment
72
+ - Perfect for CI/CD or occasional security audits
73
+ - No need to manage package versions or updates
74
+
75
+ ### 📦 From PyPI (Python Package)
76
+
77
+ For Python 3.8+ on Linux and macOS:
78
+
79
+ ```bash
80
+ pip install pysentry-rs
81
+ ```
82
+
83
+ Then use it with Python:
84
+
85
+ ```bash
86
+ python -m pysentry /path/to/project
87
+ # or directly if scripts are in PATH
88
+ pysentry-rs /path/to/project
89
+ ```
90
+
91
+ ### ⚡ From Crates.io (Rust Package)
92
+
93
+ If you have Rust installed:
94
+
95
+ ```bash
96
+ cargo install pysentry
97
+ ```
98
+
99
+ ### 💾 From GitHub Releases (Pre-built Binaries)
100
+
101
+ Download the latest release for your platform:
102
+
103
+ - **Linux x64**: `pysentry-linux-x64.tar.gz`
104
+ - **Linux x64 (musl)**: `pysentry-linux-x64-musl.tar.gz`
105
+ - **Linux ARM64**: `pysentry-linux-arm64.tar.gz`
106
+ - **macOS x64**: `pysentry-macos-x64.tar.gz`
107
+ - **macOS ARM64**: `pysentry-macos-arm64.tar.gz`
108
+ - **Windows x64**: `pysentry-windows-x64.zip`
109
+
110
+ ```bash
111
+ # Example for Linux x64
112
+ curl -L https://github.com/nyudenkov/pysentry/releases/latest/download/pysentry-linux-x64.tar.gz | tar -xz
113
+ ./pysentry-linux-x64/pysentry --help
114
+ ```
115
+
116
+ ### 🔧 From Source
117
+
118
+ ```bash
119
+ git clone https://github.com/nyudenkov/pysentry
120
+ cd pysentry
121
+ cargo build --release
122
+ ```
123
+
124
+ The binary will be available at `target/release/pysentry`.
125
+
126
+ ### Requirements
127
+
128
+ - **For uvx**: Python 3.8+ and [uv](https://docs.astral.sh/uv/) installed (Linux/macOS only)
129
+ - **For binaries**: No additional dependencies
130
+ - **For Python package**: Python 3.8+ (Linux/macOS only)
131
+ - **For Rust package and source**: Rust 1.79+
132
+
133
+ ### Platform Support
134
+
135
+ | Installation Method | Linux | macOS | Windows |
136
+ | ------------------- | ----- | ----- | ------- |
137
+ | uvx | ✅ | ✅ | ❌ |
138
+ | PyPI (pip) | ✅ | ✅ | ❌ |
139
+ | Crates.io (cargo) | ✅ | ✅ | ✅ |
140
+ | GitHub Releases | ✅ | ✅ | ✅ |
141
+ | From Source | ✅ | ✅ | ✅ |
142
+
143
+ **Note**: Windows Python wheels are not available due to compilation complexity. Windows users should use the pre-built binary from GitHub releases, install via cargo and build from source.
144
+
145
+ ### CLI Command Names
146
+
147
+ - **Rust binary**: `pysentry` (when installed via cargo or binary releases)
148
+ - **Python package**: `pysentry-rs` (when installed via pip or uvx)
149
+
150
+ Both variants support identical functionality. The resolver tools (`uv`, `pip-tools`) must be available in your current environment regardless of which PySentry variant you use.
151
+
152
+ ### Requirements.txt Support Prerequisites
153
+
154
+ To scan `requirements.txt` files, PySentry requires an external dependency resolver to convert version constraints (e.g., `flask>=2.0,<3.0`) into exact versions for vulnerability scanning.
155
+
156
+ **Install a supported resolver:**
157
+
158
+ ```bash
159
+ # uv (recommended - fastest, Rust-based)
160
+ pip install uv
161
+
162
+ # pip-tools (widely compatible, Python-based)
163
+ pip install pip-tools
164
+ ```
165
+
166
+ **Environment Requirements:**
167
+
168
+ - Resolvers must be available in your current environment
169
+ - If using virtual environments, activate your venv before running PySentry:
170
+ ```bash
171
+ source venv/bin/activate # Linux/macOS
172
+ venv\Scripts\activate # Windows
173
+ pysentry /path/to/project
174
+ ```
175
+ - Alternatively, install resolvers globally for system-wide availability
176
+
177
+ **Auto-detection:** PySentry automatically detects and prefers: `uv` > `pip-tools`. Without a resolver, only `uv.lock` and `poetry.lock` files can be scanned.
178
+
179
+ ## Quick Start
180
+
181
+ ### Basic Usage
182
+
183
+ ```bash
184
+ # Using uvx (recommended for occasional use)
185
+ uvx pysentry-rs
186
+ uvx pysentry-rs /path/to/python/project
187
+
188
+ # Using installed binary
189
+ pysentry
190
+ pysentry /path/to/python/project
191
+
192
+ # Automatically detects project type (uv.lock, poetry.lock, pyproject.toml, requirements.txt)
193
+ pysentry /path/to/project
194
+
195
+ # Force specific resolver
196
+ pysentry --resolver uv /path/to/project
197
+ pysentry --resolver pip-tools /path/to/project
198
+
199
+ # Include all dependencies (main + dev + optional)
200
+ pysentry --all
201
+
202
+ # Filter by severity (only show high and critical)
203
+ pysentry --severity high
204
+
205
+ # Output to JSON file
206
+ pysentry --format json --output audit-results.json
207
+ ```
208
+
209
+ ### Advanced Usage
210
+
211
+ ```bash
212
+ # Using uvx for comprehensive audit
213
+ uvx pysentry-rs --all --format sarif --output security-report.sarif
214
+
215
+ # Check only direct dependencies using OSV database
216
+ uvx pysentry-rs --direct-only --source osv
217
+
218
+ # Or with installed binary
219
+ pysentry --all --format sarif --output security-report.sarif
220
+ pysentry --direct-only --source osv
221
+
222
+ # Ignore specific vulnerabilities
223
+ pysentry --ignore CVE-2023-12345 --ignore GHSA-xxxx-yyyy-zzzz
224
+
225
+ # Disable caching for CI environments
226
+ pysentry --no-cache
227
+
228
+ # Verbose output for debugging
229
+ pysentry --verbose
230
+ ```
231
+
232
+ ### Advanced Requirements.txt Usage
233
+
234
+ ```bash
235
+ # Scan multiple requirements files
236
+ pysentry --requirements requirements.txt --requirements requirements-dev.txt
237
+
238
+ # Check only direct dependencies from requirements.txt
239
+ pysentry --direct-only --resolver uv
240
+
241
+ # Ensure resolver is available in your environment
242
+ source venv/bin/activate # Activate your virtual environment first
243
+ pysentry /path/to/project
244
+
245
+ # Debug requirements.txt resolution
246
+ pysentry --verbose --resolver uv /path/to/project
247
+ ```
248
+
249
+ ## Configuration
250
+
251
+ ### Command Line Options
252
+
253
+ | Option | Description | Default |
254
+ | ---------------- | ----------------------------------------------------- | ------------------- |
255
+ | `--format` | Output format: `human`, `json`, `sarif` | `human` |
256
+ | `--severity` | Minimum severity: `low`, `medium`, `high`, `critical` | `low` |
257
+ | `--source` | Vulnerability source: `pypa`, `pypi`, `osv` | `pypa` |
258
+ | `--all` | Include all dependencies (main + dev + optional) | `false` |
259
+ | `--direct-only` | Check only direct dependencies | `false` |
260
+ | `--ignore` | Vulnerability IDs to ignore (repeatable) | `[]` |
261
+ | `--output` | Output file path | `stdout` |
262
+ | `--no-cache` | Disable caching | `false` |
263
+ | `--cache-dir` | Custom cache directory | `~/.cache/pysentry` |
264
+ | `--verbose` | Enable verbose output | `false` |
265
+ | `--quiet` | Suppress non-error output | `false` |
266
+ | `--resolver` | Dependency resolver: `auto`, `uv`, `pip-tools` | `auto` |
267
+ | `--requirements` | Additional requirements files (repeatable) | `[]` |
268
+
269
+ ### Cache Management
270
+
271
+ PySentry uses an intelligent caching system to avoid redundant API calls:
272
+
273
+ - **Default Location**: `~/.cache/pysentry/` (or system temp directory)
274
+ - **TTL-based Expiration**: Separate expiration for each vulnerability source
275
+ - **Atomic Updates**: Prevents cache corruption during concurrent access
276
+ - **Custom Location**: Use `--cache-dir` to specify alternative location
277
+
278
+ To clear the cache:
279
+
280
+ ```bash
281
+ rm -rf ~/.cache/pysentry/
282
+ ```
283
+
284
+ ## Supported Project Formats
285
+
286
+ ### uv.lock Files (Recommended)
287
+
288
+ PySentry has support for `uv.lock` files:
289
+
290
+ - Exact version resolution
291
+ - Complete dependency graph analysis
292
+ - Source tracking
293
+ - Dependency classification (main, dev, optional) including transitive dependencies
294
+
295
+ ### poetry.lock Files
296
+
297
+ Full support for Poetry lock files:
298
+
299
+ - **Exact Version Resolution**: Scans exact dependency versions locked by Poetry
300
+ - **Lock-File Only Analysis**: Relies purely on the lock file structure, no pyproject.toml parsing needed
301
+ - **Complete Dependency Tree**: Analyzes all resolved dependencies including transitive ones
302
+ - **Dependency Classification**: Distinguishes between main dependencies and optional groups (dev, test, etc.)
303
+ - **Source Tracking**: Supports PyPI registry, Git repositories, local paths, and direct URLs
304
+
305
+ **Key Features:**
306
+
307
+ - No external tools required
308
+ - Fast parsing with exact version information
309
+ - Handles Poetry's dependency groups and optional dependencies
310
+ - Perfect for Poetry-managed projects with established lock files
311
+
312
+ ### requirements.txt Files (External Resolution)
313
+
314
+ Advanced support for `requirements.txt` files using external dependency resolvers:
315
+
316
+ **Key Features:**
317
+
318
+ - **Dependencies Resolution**: Converts version constraints (e.g., `flask>=2.0,<3.0`) to exact versions using mature external tools
319
+ - **Multiple Resolver Support**:
320
+ - **uv**: Rust-based resolver, extremely fast and reliable (recommended)
321
+ - **pip-tools**: Python-based resolver using `pip-compile`, widely compatible
322
+ - **Auto-detection**: Automatically detects and uses the best available resolver in your environment
323
+ - **Multiple File Support**: Combines `requirements.txt`, `requirements-dev.txt`, `requirements-test.txt`, etc.
324
+ - **Dependency Classification**: Distinguishes between direct and transitive dependencies
325
+ - **Isolated Execution**: Resolvers run in temporary directories to prevent project pollution
326
+ - **Complex Constraint Handling**: Supports version ranges, extras, environment markers, and conflict resolution
327
+
328
+ **Resolution Workflow:**
329
+
330
+ 1. Detects `requirements.txt` files in your project
331
+ 2. Auto-detects available resolver (`uv` or `pip-tools`) in current environment
332
+ 3. Resolves version constraints to exact dependency versions
333
+ 4. Scans resolved dependencies for vulnerabilities
334
+ 5. Reports findings with direct vs. transitive classification
335
+
336
+ **Environment Setup:**
337
+
338
+ ```bash
339
+ # Ensure resolver is available in your environment
340
+ source venv/bin/activate # Activate virtual environment
341
+ pip install uv # Install preferred resolver
342
+ pysentry /path/to/project # Run security scan
343
+ ```
344
+
345
+ ### pyproject.toml Files (External Resolution)
346
+
347
+ Support for projects without lock files:
348
+
349
+ - Parses version constraints from `pyproject.toml`
350
+ - **Resolver Required**: Like requirements.txt, needs external resolvers (`uv` or `pip-tools`) to convert version constraints to exact versions for accurate vulnerability scanning
351
+ - Limited dependency graph information compared to lock files
352
+ - Works with both Poetry and PEP 621 formats
353
+
354
+ ## Vulnerability Data Sources
355
+
356
+ ### PyPA Advisory Database (Default)
357
+
358
+ - Comprehensive coverage of Python ecosystem
359
+ - Community-maintained vulnerability database
360
+ - Regular updates from security researchers
361
+
362
+ ### PyPI JSON API
363
+
364
+ - Official PyPI vulnerability data
365
+ - Real-time information
366
+ - Limited to packages hosted on PyPI
367
+
368
+ ### OSV.dev
369
+
370
+ - Cross-ecosystem vulnerability database
371
+ - Google-maintained infrastructure
372
+
373
+ ## Output Formats
374
+
375
+ ### Human-Readable (Default)
376
+
377
+ Most comfortable to read.
378
+
379
+ ### JSON
380
+
381
+ ```json
382
+ {
383
+ "summary": {
384
+ "total_dependencies": 245,
385
+ "vulnerable_packages": 2,
386
+ "total_vulnerabilities": 3,
387
+ "by_severity": {
388
+ "critical": 1,
389
+ "high": 1,
390
+ "medium": 1,
391
+ "low": 0
392
+ }
393
+ },
394
+ "vulnerabilities": [...]
395
+ }
396
+ ```
397
+
398
+ ### SARIF (Static Analysis Results Interchange Format)
399
+
400
+ Compatible with GitHub Security tab, VS Code, and other security tools.
401
+
402
+ ## Performance
403
+
404
+ PySentry is designed for speed and efficiency:
405
+
406
+ - **Concurrent Processing**: Vulnerability data fetched in parallel
407
+ - **Smart Caching**: Reduces API calls and parsing overhead
408
+ - **Efficient Matching**: In-memory indexing for fast vulnerability lookups
409
+ - **Streaming**: Large databases processed without excessive memory usage
410
+
411
+ ### Requirements.txt Resolution Performance
412
+
413
+ PySentry leverages external resolvers for optimal performance:
414
+
415
+ - **uv resolver**: 2-10x faster than pip-tools, handles large dependency trees efficiently
416
+ - **pip-tools resolver**: Reliable fallback, slower but widely compatible
417
+ - **Isolated execution**: Prevents project pollution while maintaining security
418
+
419
+ ### Benchmarks
420
+
421
+ Typical performance on a project with 100+ dependencies:
422
+
423
+ - **Cold cache**: 15-30 seconds
424
+ - **Warm cache**: 2-5 seconds
425
+ - **Memory usage**: ~50MB peak
426
+
427
+ ## Development
428
+
429
+ ### Building from Source
430
+
431
+ ```bash
432
+ git clone https://github.com/nyudenkov/pysentry
433
+ cd pysentry
434
+ cargo build --release
435
+ ```
436
+
437
+ ### Running Tests
438
+
439
+ ```bash
440
+ cargo test
441
+ ```
442
+
443
+ ### Project Structure
444
+
445
+ ```
446
+ src/
447
+ ├── main.rs # CLI interface
448
+ ├── lib.rs # Library API
449
+ ├── cache/ # Caching system
450
+ ├── dependency/ # Dependency scanning
451
+ ├── output/ # Report generation
452
+ ├── parsers/ # Project file parsers
453
+ ├── providers/ # Vulnerability data sources
454
+ ├── types.rs # Core type definitions
455
+ └── vulnerability/ # Vulnerability matching
456
+ ```
457
+
458
+ ## Troubleshooting
459
+
460
+ ### Common Issues
461
+
462
+ **Error: "No lock file or pyproject.toml found"**
463
+
464
+ ```bash
465
+ # Ensure you're in a Python project directory
466
+ ls pyproject.toml uv.lock poetry.lock requirements.txt
467
+
468
+ # Or specify the path explicitly
469
+ pysentry /path/to/python/project
470
+ ```
471
+
472
+ **Error: "No dependency resolver found" or "uv resolver not available"**
473
+
474
+ ```bash
475
+ # Install a supported resolver in your environment
476
+ pip install uv # Recommended - fastest
477
+ pip install pip-tools # Alternative
478
+
479
+ # Verify resolver is available
480
+ uv --version
481
+ pip-compile --version
482
+
483
+ # If using virtual environments, ensure resolver is installed there
484
+ source venv/bin/activate
485
+ pip install uv
486
+ pysentry /path/to/project
487
+ ```
488
+
489
+ **Error: "Failed to resolve requirements"**
490
+
491
+ ```bash
492
+ # Check your requirements.txt syntax
493
+ cat requirements.txt
494
+
495
+ # Try different resolver
496
+ pysentry --resolver pip-tools # if uv fails
497
+ pysentry --resolver uv # if pip-tools fails
498
+
499
+ # Ensure you're in correct environment
500
+ which python
501
+ which uv # or which pip-compile
502
+
503
+ # Debug with verbose output
504
+ pysentry --verbose /path/to/project
505
+ ```
506
+
507
+ **Error: "Failed to fetch vulnerability data"**
508
+
509
+ ```bash
510
+ # Check network connectivity
511
+ curl -I https://osv-vulnerabilities.storage.googleapis.com/
512
+
513
+ # Try with different source
514
+ pysentry --source pypi
515
+ ```
516
+
517
+ **Slow requirements.txt resolution**
518
+
519
+ ```bash
520
+ # Use faster uv resolver instead of pip-tools
521
+ pysentry --resolver uv
522
+
523
+ # Install uv for better performance (2-10x faster)
524
+ pip install uv
525
+
526
+ # Or use uvx for isolated execution
527
+ uvx pysentry-rs --resolver uv /path/to/project
528
+ ```
529
+
530
+ **Requirements.txt files not being detected**
531
+
532
+ ```bash
533
+ # Ensure requirements.txt exists
534
+ ls requirements.txt
535
+
536
+ # Specify path explicitly
537
+ pysentry /path/to/python/project
538
+
539
+ # Include additional requirements files
540
+ pysentry --requirements requirements-dev.txt --requirements requirements-test.txt
541
+
542
+ # Check if higher-priority files exist (they take precedence)
543
+ ls uv.lock poetry.lock pyproject.toml
544
+ ```
545
+
546
+ **Performance Issues**
547
+
548
+ ```bash
549
+ # Clear cache and retry
550
+ rm -rf ~/.cache/pysentry
551
+ pysentry
552
+
553
+ # Use verbose mode to identify bottlenecks
554
+ pysentry --verbose
555
+ ```
556
+
557
+ ## Acknowledgments
558
+
559
+ - Inspired by [pip-audit](https://github.com/pypa/pip-audit) and [uv #9189 issue](https://github.com/astral-sh/uv/issues/9189)
560
+ - Originally was a command for [uv](https://github.com/astral-sh/uv)
561
+ - Vulnerability data from [PyPA](https://github.com/pypa/advisory-database), [PyPI](https://pypi.org/), and [OSV.dev](https://osv.dev/)
562
+