pysentry-rs 0.3.13__cp310-cp310-manylinux_2_28_aarch64.whl
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.
- pysentry/__init__.py +24 -0
- pysentry/_internal.cpython-310-aarch64-linux-gnu.so +0 -0
- pysentry_rs-0.3.13.dist-info/METADATA +939 -0
- pysentry_rs-0.3.13.dist-info/RECORD +7 -0
- pysentry_rs-0.3.13.dist-info/WHEEL +4 -0
- pysentry_rs-0.3.13.dist-info/entry_points.txt +2 -0
- pysentry_rs-0.3.13.dist-info/licenses/LICENSE +674 -0
|
@@ -0,0 +1,939 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pysentry-rs
|
|
3
|
+
Version: 0.3.13
|
|
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.9
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Topic :: Security
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Summary: Security vulnerability auditing tool for Python packages
|
|
18
|
+
Author-email: nyudenkov <nyudenkov@pm.me>
|
|
19
|
+
License: GPL-3.0
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
22
|
+
Project-URL: Homepage, https://github.com/nyudenkov/pysentry
|
|
23
|
+
Project-URL: Repository, https://github.com/nyudenkov/pysentry
|
|
24
|
+
Project-URL: Issues, https://github.com/nyudenkov/pysentry/issues
|
|
25
|
+
|
|
26
|
+
# 🐍 PySentry
|
|
27
|
+
|
|
28
|
+
[](https://google.github.io/osv.dev/)
|
|
29
|
+
[](https://pepy.tech/projects/pysentry-rs)
|
|
30
|
+
|
|
31
|
+
[Help to test and improve](https://github.com/nyudenkov/pysentry/issues/12) | [Latest PySentry - pip-audit benchmark](benchmarks/results/latest.md)
|
|
32
|
+
|
|
33
|
+
Please, send feedback to nikita@pysentry.com
|
|
34
|
+
|
|
35
|
+
A fast, reliable security vulnerability scanner for Python projects, written in Rust.
|
|
36
|
+
|
|
37
|
+
## Overview
|
|
38
|
+
|
|
39
|
+
PySentry audits Python projects for known security vulnerabilities by analyzing dependency files (`uv.lock`, `poetry.lock`, `Pipfile.lock`, `pylock.toml`, `pyproject.toml`, `Pipfile`, `requirements.txt`) and cross-referencing them against multiple vulnerability databases. It provides comprehensive reporting with support for various output formats and filtering options.
|
|
40
|
+
|
|
41
|
+
## Key Features
|
|
42
|
+
|
|
43
|
+
- **Multiple Project Formats**: Supports `uv.lock`, `poetry.lock`, `Pipfile.lock`, `pylock.toml`, `pyproject.toml`, `Pipfile`, and `requirements.txt` files
|
|
44
|
+
- **External Resolver Integration**: Leverages `uv` and `pip-tools` for accurate requirements.txt constraint solving
|
|
45
|
+
- **Multiple Data Sources** (all sources used by default):
|
|
46
|
+
- PyPA Advisory Database
|
|
47
|
+
- PyPI JSON API
|
|
48
|
+
- OSV.dev (Open Source Vulnerabilities)
|
|
49
|
+
- **Flexible Output for different workflows**: Human-readable, JSON, SARIF, and Markdown formats
|
|
50
|
+
- **Performance Focused**:
|
|
51
|
+
- Written in Rust for speed
|
|
52
|
+
- Async/concurrent processing
|
|
53
|
+
- Multi-tier intelligent caching (vulnerability data + resolved dependencies)
|
|
54
|
+
- **Comprehensive Filtering**:
|
|
55
|
+
- Severity levels (low, medium, high, critical)
|
|
56
|
+
- Dependency scopes (main only vs all [optional, dev, prod, etc] dependencies)
|
|
57
|
+
- Direct vs. transitive dependencies
|
|
58
|
+
- **Enterprise Ready**: SARIF output for IDE/CI integration
|
|
59
|
+
|
|
60
|
+
## Installation
|
|
61
|
+
|
|
62
|
+
Choose the installation method that works best for you:
|
|
63
|
+
|
|
64
|
+
### ⚡ Via uvx (Recommended for occasional use)
|
|
65
|
+
|
|
66
|
+
Run directly without installing (requires [uv](https://docs.astral.sh/uv/)):
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
uvx pysentry-rs /path/to/project
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
This method:
|
|
73
|
+
|
|
74
|
+
- Runs the latest version without installation
|
|
75
|
+
- Automatically manages Python environment
|
|
76
|
+
- Perfect for CI/CD or occasional security audits
|
|
77
|
+
- No need to manage package versions or updates
|
|
78
|
+
|
|
79
|
+
### 📦 From PyPI (Python Package)
|
|
80
|
+
|
|
81
|
+
For Python 3.9-3.14 on Linux, macOS, and Windows:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
pip install pysentry-rs
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Then use it with Python:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
python -m pysentry /path/to/project
|
|
91
|
+
# or directly if scripts are in PATH
|
|
92
|
+
pysentry-rs /path/to/project
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### ⚡ From Crates.io (Rust Package)
|
|
96
|
+
|
|
97
|
+
If you have Rust installed:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
cargo install pysentry
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 💾 From GitHub Releases (Pre-built Binaries)
|
|
104
|
+
|
|
105
|
+
Download the latest release for your platform:
|
|
106
|
+
|
|
107
|
+
- **Linux x64**: `pysentry-linux-x64.tar.gz`
|
|
108
|
+
- **Linux x64 (musl)**: `pysentry-linux-x64-musl.tar.gz`
|
|
109
|
+
- **Linux ARM64**: `pysentry-linux-arm64.tar.gz`
|
|
110
|
+
- **macOS x64**: `pysentry-macos-x64.tar.gz`
|
|
111
|
+
- **macOS ARM64**: `pysentry-macos-arm64.tar.gz`
|
|
112
|
+
- **Windows x64**: `pysentry-windows-x64.zip`
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Example for Linux x64
|
|
116
|
+
curl -L https://github.com/nyudenkov/pysentry/releases/latest/download/pysentry-linux-x64.tar.gz | tar -xz
|
|
117
|
+
./pysentry-linux-x64/pysentry --help
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### 🔧 From Source
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
git clone https://github.com/nyudenkov/pysentry
|
|
124
|
+
cd pysentry
|
|
125
|
+
cargo build --release
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The binary will be available at `target/release/pysentry`.
|
|
129
|
+
|
|
130
|
+
### Requirements
|
|
131
|
+
|
|
132
|
+
- **For uvx**: Python 3.9-3.14 and [uv](https://docs.astral.sh/uv/) installed
|
|
133
|
+
- **For binaries**: No additional dependencies
|
|
134
|
+
- **For Python package**: Python 3.9-3.14
|
|
135
|
+
- **For Rust package and source**: Rust 1.79+
|
|
136
|
+
|
|
137
|
+
### Platform Support
|
|
138
|
+
|
|
139
|
+
| Installation Method | Linux (x64) | Linux (ARM64) | macOS (x64) | macOS (ARM64) | Windows (x64) |
|
|
140
|
+
| ------------------- | ----------- | ------------- | ----------- | ------------- | ------------- |
|
|
141
|
+
| uvx | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
142
|
+
| PyPI (pip) | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
143
|
+
| Crates.io (cargo) | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
144
|
+
| GitHub Releases | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
145
|
+
| From Source | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
146
|
+
|
|
147
|
+
**Supported Python Versions**: 3.9, 3.10, 3.11, 3.12, 3.13, 3.14
|
|
148
|
+
**Supported Architectures**: x86_64 (x64), ARM64 (aarch64)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
### CLI Command Names
|
|
152
|
+
|
|
153
|
+
- **Rust binary**: `pysentry` (when installed via cargo or binary releases)
|
|
154
|
+
- **Python package**: `pysentry-rs` (when installed via pip or uvx)
|
|
155
|
+
|
|
156
|
+
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.
|
|
157
|
+
|
|
158
|
+
### Requirements.txt Support Prerequisites
|
|
159
|
+
|
|
160
|
+
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.
|
|
161
|
+
|
|
162
|
+
**Install a supported resolver:**
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
# uv (recommended - fastest, Rust-based)
|
|
166
|
+
pip install uv
|
|
167
|
+
|
|
168
|
+
# pip-tools (widely compatible, Python-based)
|
|
169
|
+
pip install pip-tools
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Environment Requirements:**
|
|
173
|
+
|
|
174
|
+
- Resolvers must be available in your current environment
|
|
175
|
+
- If using virtual environments, activate your venv before running PySentry:
|
|
176
|
+
```bash
|
|
177
|
+
source venv/bin/activate # Linux/macOS
|
|
178
|
+
venv\Scripts\activate # Windows
|
|
179
|
+
pysentry /path/to/project
|
|
180
|
+
```
|
|
181
|
+
- Alternatively, install resolvers globally for system-wide availability
|
|
182
|
+
|
|
183
|
+
**Auto-detection:** PySentry automatically detects and prefers: `uv` > `pip-tools`. Without a resolver, only `uv.lock` and `poetry.lock` files can be scanned.
|
|
184
|
+
|
|
185
|
+
## Quick Start
|
|
186
|
+
|
|
187
|
+
### Basic Usage
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
# Using uvx (recommended for occasional use)
|
|
191
|
+
uvx pysentry-rs
|
|
192
|
+
uvx pysentry-rs /path/to/python/project
|
|
193
|
+
|
|
194
|
+
# Using installed binary
|
|
195
|
+
pysentry
|
|
196
|
+
pysentry /path/to/python/project
|
|
197
|
+
|
|
198
|
+
# Automatically detects project type (uv.lock, poetry.lock, Pipfile.lock, pyproject.toml, Pipfile, requirements.txt)
|
|
199
|
+
pysentry /path/to/project
|
|
200
|
+
|
|
201
|
+
# Force specific resolver
|
|
202
|
+
pysentry --resolver uv /path/to/project
|
|
203
|
+
pysentry --resolver pip-tools /path/to/project
|
|
204
|
+
|
|
205
|
+
# Exclude extra dependencies (only check main dependencies)
|
|
206
|
+
pysentry --exclude-extra
|
|
207
|
+
|
|
208
|
+
# Filter by severity (only show high and critical)
|
|
209
|
+
pysentry --severity high
|
|
210
|
+
|
|
211
|
+
# Output to JSON file
|
|
212
|
+
pysentry --format json --output audit-results.json
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Advanced Usage
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
# Using uvx for comprehensive audit (extras included by default)
|
|
219
|
+
uvx pysentry-rs --format sarif --output security-report.sarif
|
|
220
|
+
|
|
221
|
+
# Use specific vulnerability sources (all sources used by default)
|
|
222
|
+
uvx pysentry-rs --sources pypa /path/to/project
|
|
223
|
+
uvx pysentry-rs --sources pypa --sources osv /path/to/project
|
|
224
|
+
|
|
225
|
+
# Generate markdown report
|
|
226
|
+
uvx pysentry-rs --format markdown --output security-report.md
|
|
227
|
+
|
|
228
|
+
# Control CI exit codes - only fail on critical vulnerabilities
|
|
229
|
+
uvx pysentry-rs --fail-on critical
|
|
230
|
+
|
|
231
|
+
# Or with installed binary (extras included by default)
|
|
232
|
+
pysentry --format sarif --output security-report.sarif
|
|
233
|
+
pysentry --sources pypa,osv --direct-only
|
|
234
|
+
pysentry --format markdown --output security-report.md
|
|
235
|
+
|
|
236
|
+
# Ignore specific vulnerabilities
|
|
237
|
+
pysentry --ignore CVE-2023-12345 --ignore GHSA-xxxx-yyyy-zzzz
|
|
238
|
+
|
|
239
|
+
# Ignore unfixable vulnerabilities (only while they have no fix available)
|
|
240
|
+
pysentry --ignore-while-no-fix CVE-2025-8869
|
|
241
|
+
|
|
242
|
+
# Disable caching for CI environments
|
|
243
|
+
pysentry --no-cache
|
|
244
|
+
|
|
245
|
+
# Verbose output for debugging
|
|
246
|
+
pysentry --verbose
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Advanced Requirements.txt Usage
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
# Scan multiple requirements files
|
|
253
|
+
pysentry --requirements requirements.txt --requirements requirements-dev.txt
|
|
254
|
+
|
|
255
|
+
# Check only direct dependencies from requirements.txt
|
|
256
|
+
pysentry --direct-only --resolver uv
|
|
257
|
+
|
|
258
|
+
# Ensure resolver is available in your environment
|
|
259
|
+
source venv/bin/activate # Activate your virtual environment first
|
|
260
|
+
pysentry /path/to/project
|
|
261
|
+
|
|
262
|
+
# Debug requirements.txt resolution
|
|
263
|
+
pysentry --verbose --resolver uv /path/to/project
|
|
264
|
+
|
|
265
|
+
# Use longer resolution cache TTL (48 hours)
|
|
266
|
+
pysentry --resolution-cache-ttl 48 /path/to/project
|
|
267
|
+
|
|
268
|
+
# Clear resolution cache before scanning
|
|
269
|
+
pysentry --clear-resolution-cache /path/to/project
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### CI/CD Integration Examples
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
# Development environment - only fail on critical vulnerabilities
|
|
276
|
+
pysentry --fail-on critical --format json --output security-report.json
|
|
277
|
+
|
|
278
|
+
# Staging environment - fail on high+ vulnerabilities
|
|
279
|
+
pysentry --fail-on high --sources pypa,osv --format sarif --output security.sarif
|
|
280
|
+
|
|
281
|
+
# Production deployment - strict security (fail on medium+, default)
|
|
282
|
+
pysentry --sources pypa,pypi,osv --format json --output prod-security.json
|
|
283
|
+
|
|
284
|
+
# Generate markdown report for GitHub issues/PRs
|
|
285
|
+
pysentry --format markdown --output SECURITY-REPORT.md
|
|
286
|
+
|
|
287
|
+
# Comprehensive audit with all sources and full reporting (extras included by default)
|
|
288
|
+
pysentry --sources pypa,pypi,osv --format json --fail-on low
|
|
289
|
+
|
|
290
|
+
# CI environment with fresh resolution cache
|
|
291
|
+
pysentry --clear-resolution-cache --sources pypa,osv --format sarif
|
|
292
|
+
|
|
293
|
+
# CI with resolution cache disabled
|
|
294
|
+
pysentry --no-resolution-cache --format json --output security-report.json
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
## Pre-commit Integration
|
|
298
|
+
|
|
299
|
+
PySentry integrates seamlessly with [pre-commit](https://pre-commit.com/) to automatically scan for vulnerabilities before commits.
|
|
300
|
+
|
|
301
|
+
### Setup
|
|
302
|
+
|
|
303
|
+
Add PySentry to your `.pre-commit-config.yaml`:
|
|
304
|
+
|
|
305
|
+
```yaml
|
|
306
|
+
repos:
|
|
307
|
+
- repo: https://github.com/pysentry/pysentry-pre-commit
|
|
308
|
+
rev: v0.3.13
|
|
309
|
+
hooks:
|
|
310
|
+
- id: pysentry # default pysentry settings
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Advanced Configuration
|
|
314
|
+
|
|
315
|
+
```yaml
|
|
316
|
+
repos:
|
|
317
|
+
- repo: https://github.com/pysentry/pysentry-pre-commit
|
|
318
|
+
rev: v0.3.13
|
|
319
|
+
hooks:
|
|
320
|
+
- id: pysentry
|
|
321
|
+
args: ["--sources", "pypa,osv", "--fail-on", "high"]
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### Installation Requirements
|
|
325
|
+
|
|
326
|
+
Pre-commit will automatically install PySentry, uv and pip-tools via PyPI.
|
|
327
|
+
|
|
328
|
+
## Configuration
|
|
329
|
+
|
|
330
|
+
PySentry supports TOML-based configuration files for persistent settings management. Configuration files follow a hierarchical discovery pattern:
|
|
331
|
+
|
|
332
|
+
1. **Project-level** (in current or parent directories, walking up to `.git` root):
|
|
333
|
+
- `.pysentry.toml` (highest priority)
|
|
334
|
+
- `pyproject.toml` `[tool.pysentry]` section (lower priority, convenient for existing Python projects)
|
|
335
|
+
2. **User-level**: `~/.config/pysentry/config.toml` (Linux/macOS)
|
|
336
|
+
3. **System-level**: `/etc/pysentry/config.toml` (Unix systems)
|
|
337
|
+
|
|
338
|
+
**Priority**: When both `.pysentry.toml` and `pyproject.toml` exist in the same directory, `.pysentry.toml` takes precedence. This allows you to override `pyproject.toml` settings when needed.
|
|
339
|
+
|
|
340
|
+
### Configuration File Example (.pysentry.toml)
|
|
341
|
+
|
|
342
|
+
```toml
|
|
343
|
+
version = 1
|
|
344
|
+
|
|
345
|
+
[defaults]
|
|
346
|
+
format = "json"
|
|
347
|
+
severity = "medium"
|
|
348
|
+
fail_on = "high"
|
|
349
|
+
scope = "all"
|
|
350
|
+
direct_only = false
|
|
351
|
+
|
|
352
|
+
[sources]
|
|
353
|
+
enabled = ["pypa", "osv"]
|
|
354
|
+
|
|
355
|
+
[resolver]
|
|
356
|
+
type = "uv"
|
|
357
|
+
fallback = "pip-tools"
|
|
358
|
+
|
|
359
|
+
[cache]
|
|
360
|
+
enabled = true
|
|
361
|
+
resolution_ttl = 48
|
|
362
|
+
vulnerability_ttl = 72
|
|
363
|
+
|
|
364
|
+
[output]
|
|
365
|
+
quiet = false
|
|
366
|
+
verbose = false
|
|
367
|
+
color = "auto"
|
|
368
|
+
|
|
369
|
+
[ignore]
|
|
370
|
+
ids = ["CVE-2023-12345", "GHSA-xxxx-yyyy-zzzz"]
|
|
371
|
+
while_no_fix = ["CVE-2025-8869"]
|
|
372
|
+
|
|
373
|
+
[http]
|
|
374
|
+
timeout = 120
|
|
375
|
+
connect_timeout = 30
|
|
376
|
+
max_retries = 3
|
|
377
|
+
retry_initial_backoff = 1
|
|
378
|
+
retry_max_backoff = 60
|
|
379
|
+
show_progress = true
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### pyproject.toml Configuration
|
|
383
|
+
|
|
384
|
+
You can configure PySentry directly in your `pyproject.toml` using the `[tool.pysentry]` section:
|
|
385
|
+
|
|
386
|
+
```toml
|
|
387
|
+
[project]
|
|
388
|
+
name = "my-project"
|
|
389
|
+
version = "1.0.0"
|
|
390
|
+
|
|
391
|
+
[tool.pysentry]
|
|
392
|
+
version = 1
|
|
393
|
+
|
|
394
|
+
[tool.pysentry.defaults]
|
|
395
|
+
format = "json"
|
|
396
|
+
severity = "medium"
|
|
397
|
+
fail_on = "high"
|
|
398
|
+
scope = "main"
|
|
399
|
+
direct_only = false
|
|
400
|
+
|
|
401
|
+
[tool.pysentry.sources]
|
|
402
|
+
enabled = ["pypa", "osv"]
|
|
403
|
+
|
|
404
|
+
[tool.pysentry.resolver]
|
|
405
|
+
type = "uv"
|
|
406
|
+
fallback = "pip-tools"
|
|
407
|
+
|
|
408
|
+
[tool.pysentry.cache]
|
|
409
|
+
enabled = true
|
|
410
|
+
resolution_ttl = 48
|
|
411
|
+
vulnerability_ttl = 72
|
|
412
|
+
|
|
413
|
+
[tool.pysentry.output]
|
|
414
|
+
quiet = false
|
|
415
|
+
verbose = false
|
|
416
|
+
color = "auto"
|
|
417
|
+
|
|
418
|
+
[tool.pysentry.ignore]
|
|
419
|
+
ids = ["CVE-2023-12345"]
|
|
420
|
+
while_no_fix = ["CVE-2025-8869"]
|
|
421
|
+
|
|
422
|
+
[tool.pysentry.http]
|
|
423
|
+
timeout = 120
|
|
424
|
+
connect_timeout = 30
|
|
425
|
+
max_retries = 3
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
**Benefits of pyproject.toml configuration:**
|
|
429
|
+
- Keep all project configuration in a single file
|
|
430
|
+
- No additional config files to manage
|
|
431
|
+
- Works seamlessly with existing Python project tooling
|
|
432
|
+
- Graceful fallback: Invalid `[tool.pysentry]` sections log a warning and continue to next configuration source
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
### Environment Variables
|
|
436
|
+
|
|
437
|
+
| Variable | Description | Example |
|
|
438
|
+
| -------------------- | --------------------------------------------------------------------------- | ------------------------------------------- |
|
|
439
|
+
| `PYSENTRY_CONFIG` | Override config file path (supports `.pysentry.toml` or `pyproject.toml`) | `PYSENTRY_CONFIG=/path/to/pyproject.toml` |
|
|
440
|
+
| `PYSENTRY_NO_CONFIG` | Disable all config file loading | `PYSENTRY_NO_CONFIG=1` |
|
|
441
|
+
|
|
442
|
+
### Command Line Options
|
|
443
|
+
|
|
444
|
+
| Option | Description | Default |
|
|
445
|
+
| -------------------------- | --------------------------------------------------------- | ----------------- |
|
|
446
|
+
| `--format` | Output format: `human`, `json`, `sarif`, `markdown` | `human` |
|
|
447
|
+
| `--severity` | Minimum severity: `low`, `medium`, `high`, `critical` | `low` |
|
|
448
|
+
| `--fail-on` | Fail (exit non-zero) on vulnerabilities ≥ severity | `medium` |
|
|
449
|
+
| `--sources` | Vulnerability sources: `pypa`, `pypi`, `osv` (multiple) | `pypa,pypi,osv` |
|
|
450
|
+
| `--exclude-extra` | Exclude extra dependencies (dev, optional, etc) | `false` |
|
|
451
|
+
| `--direct-only` | Check only direct dependencies | `false` |
|
|
452
|
+
| `--detailed` | Show full vulnerability descriptions instead of truncated | `false` |
|
|
453
|
+
| `--ignore` | Vulnerability IDs to ignore (repeatable) | `[]` |
|
|
454
|
+
| `--ignore-while-no-fix` | Ignore vulnerabilities only while no fix is available | `[]` |
|
|
455
|
+
| `--output` | Output file path | `stdout` |
|
|
456
|
+
| `--no-cache` | Disable all caching | `false` |
|
|
457
|
+
| `--cache-dir` | Custom cache directory | Platform-specific |
|
|
458
|
+
| `--resolution-cache-ttl` | Resolution cache TTL in hours | `24` |
|
|
459
|
+
| `--no-resolution-cache` | Disable resolution caching only | `false` |
|
|
460
|
+
| `--clear-resolution-cache` | Clear resolution cache on startup | `false` |
|
|
461
|
+
| `--verbose` | Enable verbose output | `false` |
|
|
462
|
+
| `--quiet` | Suppress non-error output | `false` |
|
|
463
|
+
| `--resolver` | Dependency resolver: `auto`, `uv`, `pip-tools` | `auto` |
|
|
464
|
+
| `--requirements` | Additional requirements files (repeatable) | `[]` |
|
|
465
|
+
|
|
466
|
+
### Cache Management
|
|
467
|
+
|
|
468
|
+
PySentry uses an intelligent multi-tier caching system for optimal performance:
|
|
469
|
+
|
|
470
|
+
#### Vulnerability Data Cache
|
|
471
|
+
|
|
472
|
+
- **Location**: `{CACHE_DIR}/pysentry/vulnerability-db/`
|
|
473
|
+
- **Purpose**: Caches vulnerability databases from PyPA, PyPI, OSV
|
|
474
|
+
- **TTL**: 24 hours (configurable per source)
|
|
475
|
+
- **Benefits**: Avoids redundant API calls and downloads
|
|
476
|
+
|
|
477
|
+
#### Resolution Cache
|
|
478
|
+
|
|
479
|
+
- **Location**: `{CACHE_DIR}/pysentry/dependency-resolution/`
|
|
480
|
+
- **Purpose**: Caches resolved dependencies from `uv`/`pip-tools`
|
|
481
|
+
- **TTL**: 24 hours (configurable via `--resolution-cache-ttl`)
|
|
482
|
+
- **Benefits**: Dramatically speeds up repeated scans of requirements.txt files
|
|
483
|
+
- **Cache Key**: Based on requirements content, resolver version, Python version, platform
|
|
484
|
+
|
|
485
|
+
#### Platform-Specific Cache Locations
|
|
486
|
+
|
|
487
|
+
- **Linux**: `~/.cache/pysentry/`
|
|
488
|
+
- **macOS**: `~/Library/Caches/pysentry/`
|
|
489
|
+
- **Windows**: `%LOCALAPPDATA%\pysentry\`
|
|
490
|
+
|
|
491
|
+
**Finding Your Cache Location**: Run with `--verbose` to see the actual cache directory path being used.
|
|
492
|
+
|
|
493
|
+
#### Cache Features
|
|
494
|
+
|
|
495
|
+
- **Atomic Updates**: Prevents cache corruption during concurrent access
|
|
496
|
+
- **Custom Location**: Use `--cache-dir` to specify alternative location
|
|
497
|
+
- **Selective Clearing**: Control caching behavior per cache type
|
|
498
|
+
- **Content-based Invalidation**: Automatic cache invalidation on content changes
|
|
499
|
+
|
|
500
|
+
#### Cache Control Examples
|
|
501
|
+
|
|
502
|
+
```bash
|
|
503
|
+
# Disable all caching
|
|
504
|
+
pysentry --no-cache
|
|
505
|
+
|
|
506
|
+
# Disable only resolution caching (keep vulnerability cache)
|
|
507
|
+
pysentry --no-resolution-cache
|
|
508
|
+
|
|
509
|
+
# Set resolution cache TTL to 48 hours
|
|
510
|
+
pysentry --resolution-cache-ttl 48
|
|
511
|
+
|
|
512
|
+
# Clear resolution cache on startup (useful for CI)
|
|
513
|
+
pysentry --clear-resolution-cache
|
|
514
|
+
|
|
515
|
+
# Custom cache directory
|
|
516
|
+
pysentry --cache-dir /tmp/my-pysentry-cache
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
To manually clear all caches:
|
|
520
|
+
|
|
521
|
+
```bash
|
|
522
|
+
# Linux
|
|
523
|
+
rm -rf ~/.cache/pysentry/
|
|
524
|
+
|
|
525
|
+
# macOS
|
|
526
|
+
rm -rf ~/Library/Caches/pysentry/
|
|
527
|
+
|
|
528
|
+
# Windows (PowerShell)
|
|
529
|
+
Remove-Item -Recurse -Force "$env:LOCALAPPDATA\pysentry"
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
To clear only resolution cache:
|
|
533
|
+
|
|
534
|
+
```bash
|
|
535
|
+
# Linux
|
|
536
|
+
rm -rf ~/.cache/pysentry/dependency-resolution/
|
|
537
|
+
|
|
538
|
+
# macOS
|
|
539
|
+
rm -rf ~/Library/Caches/pysentry/dependency-resolution/
|
|
540
|
+
|
|
541
|
+
# Windows (PowerShell)
|
|
542
|
+
Remove-Item -Recurse -Force "$env:LOCALAPPDATA\pysentry\dependency-resolution"
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
## Supported Project Formats
|
|
546
|
+
|
|
547
|
+
### uv.lock Files (Recommended)
|
|
548
|
+
|
|
549
|
+
PySentry has support for `uv.lock` files:
|
|
550
|
+
|
|
551
|
+
- Exact version resolution
|
|
552
|
+
- Complete dependency graph analysis
|
|
553
|
+
- Source tracking
|
|
554
|
+
- Dependency classification (main, dev, optional) including transitive dependencies
|
|
555
|
+
|
|
556
|
+
### poetry.lock Files
|
|
557
|
+
|
|
558
|
+
Full support for Poetry lock files:
|
|
559
|
+
|
|
560
|
+
- **Exact Version Resolution**: Scans exact dependency versions locked by Poetry
|
|
561
|
+
- **Lock-File Only Analysis**: Relies purely on the lock file structure, no pyproject.toml parsing needed
|
|
562
|
+
- **Complete Dependency Tree**: Analyzes all resolved dependencies including transitive ones
|
|
563
|
+
- **Dependency Classification**: Distinguishes between main dependencies and optional groups (dev, test, etc.)
|
|
564
|
+
- **Source Tracking**: Supports PyPI registry, Git repositories, local paths, and direct URLs
|
|
565
|
+
|
|
566
|
+
**Key Features:**
|
|
567
|
+
|
|
568
|
+
- No external tools required
|
|
569
|
+
- Fast parsing with exact version information
|
|
570
|
+
- Handles Poetry's dependency groups and optional dependencies
|
|
571
|
+
- Perfect for Poetry-managed projects with established lock files
|
|
572
|
+
|
|
573
|
+
### Pipfile.lock Files
|
|
574
|
+
|
|
575
|
+
Full support for Pipenv lock files with exact version resolution:
|
|
576
|
+
|
|
577
|
+
- **Exact Version Resolution**: Scans exact dependency versions locked by Pipenv
|
|
578
|
+
- **Lock-File Only Analysis**: Relies purely on the lock file structure, no Pipfile parsing needed
|
|
579
|
+
- **Complete Dependency Tree**: Analyzes all resolved dependencies including transitive ones
|
|
580
|
+
- **Dependency Classification**: Distinguishes between default dependencies and development groups
|
|
581
|
+
|
|
582
|
+
**Key Features:**
|
|
583
|
+
|
|
584
|
+
- No external tools required
|
|
585
|
+
- Fast parsing with exact version information
|
|
586
|
+
- Handles Pipenv's dependency groups (default and develop)
|
|
587
|
+
- Perfect for Pipenv-managed projects with established lock files
|
|
588
|
+
|
|
589
|
+
### Pipfile Files (External Resolution)
|
|
590
|
+
|
|
591
|
+
Support for Pipfile specification files using external dependency resolvers:
|
|
592
|
+
|
|
593
|
+
**Key Features:**
|
|
594
|
+
|
|
595
|
+
- **Dependencies Resolution**: Converts version constraints from Pipfile to exact versions using mature external tools
|
|
596
|
+
- **Multiple Resolver Support**:
|
|
597
|
+
- **uv**: Rust-based resolver, extremely fast and reliable (recommended)
|
|
598
|
+
- **pip-tools**: Python-based resolver using `pip-compile`, widely compatible
|
|
599
|
+
- **Auto-detection**: Automatically detects and uses the best available resolver in your environment
|
|
600
|
+
- **Dependency Groups**: Supports both default packages and dev-packages sections
|
|
601
|
+
- **Complex Constraint Handling**: Supports version ranges, Git dependencies, and environment markers
|
|
602
|
+
|
|
603
|
+
**Resolution Workflow:**
|
|
604
|
+
|
|
605
|
+
1. Detects `Pipfile` in your project (when `Pipfile.lock` is not present)
|
|
606
|
+
2. Auto-detects available resolver (`uv` or `pip-tools`) in current environment
|
|
607
|
+
3. Resolves version constraints to exact dependency versions
|
|
608
|
+
4. Scans resolved dependencies for vulnerabilities
|
|
609
|
+
5. Reports findings with dependency group classification
|
|
610
|
+
|
|
611
|
+
**Note**: When both `Pipfile` and `Pipfile.lock` are present, PySentry prioritizes the lock file for better accuracy. Consider using `pipenv lock` to generate a lock file for the most precise vulnerability scanning.
|
|
612
|
+
|
|
613
|
+
### requirements.txt Files (External Resolution)
|
|
614
|
+
|
|
615
|
+
Advanced support for `requirements.txt` files using external dependency resolvers:
|
|
616
|
+
|
|
617
|
+
**Key Features:**
|
|
618
|
+
|
|
619
|
+
- **Dependencies Resolution**: Converts version constraints (e.g., `flask>=2.0,<3.0`) to exact versions using mature external tools
|
|
620
|
+
- **Multiple Resolver Support**:
|
|
621
|
+
- **uv**: Rust-based resolver, extremely fast and reliable (recommended)
|
|
622
|
+
- **pip-tools**: Python-based resolver using `pip-compile`, widely compatible
|
|
623
|
+
- **Auto-detection**: Automatically detects and uses the best available resolver in your environment
|
|
624
|
+
- **Multiple File Support**: Combines `requirements.txt`, `requirements-dev.txt`, `requirements-test.txt`, etc.
|
|
625
|
+
- **Dependency Classification**: Distinguishes between direct and transitive dependencies
|
|
626
|
+
- **Isolated Execution**: Resolvers run in temporary directories to prevent project pollution
|
|
627
|
+
- **Complex Constraint Handling**: Supports version ranges, extras, environment markers, and conflict resolution
|
|
628
|
+
|
|
629
|
+
**Resolution Workflow:**
|
|
630
|
+
|
|
631
|
+
1. Detects `requirements.txt` files in your project
|
|
632
|
+
2. Auto-detects available resolver (`uv` or `pip-tools`) in current environment
|
|
633
|
+
3. Resolves version constraints to exact dependency versions
|
|
634
|
+
4. Scans resolved dependencies for vulnerabilities
|
|
635
|
+
5. Reports findings with direct vs. transitive classification
|
|
636
|
+
|
|
637
|
+
**Environment Setup:**
|
|
638
|
+
|
|
639
|
+
```bash
|
|
640
|
+
# Ensure resolver is available in your environment
|
|
641
|
+
source venv/bin/activate # Activate virtual environment
|
|
642
|
+
pip install uv # Install preferred resolver
|
|
643
|
+
pysentry /path/to/project # Run security scan
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
### pyproject.toml Files (External Resolution)
|
|
647
|
+
|
|
648
|
+
Support for projects without lock files:
|
|
649
|
+
|
|
650
|
+
- Parses version constraints from `pyproject.toml`
|
|
651
|
+
- **Resolver Required**: Like requirements.txt, needs external resolvers (`uv` or `pip-tools`) to convert version constraints to exact versions for accurate vulnerability scanning
|
|
652
|
+
- Limited dependency graph information compared to lock files
|
|
653
|
+
- Works with both Poetry and PEP 621 formats
|
|
654
|
+
|
|
655
|
+
## Vulnerability Data Sources
|
|
656
|
+
|
|
657
|
+
PySentry uses all three vulnerability sources by default for comprehensive coverage.
|
|
658
|
+
|
|
659
|
+
### PyPA Advisory Database
|
|
660
|
+
|
|
661
|
+
- Comprehensive coverage of Python ecosystem
|
|
662
|
+
- Community-maintained vulnerability database
|
|
663
|
+
- Regular updates from security researchers
|
|
664
|
+
|
|
665
|
+
### PyPI JSON API
|
|
666
|
+
|
|
667
|
+
- Official PyPI vulnerability data
|
|
668
|
+
- Real-time information
|
|
669
|
+
- Limited to packages hosted on PyPI
|
|
670
|
+
|
|
671
|
+
### OSV.dev
|
|
672
|
+
|
|
673
|
+
- Cross-ecosystem vulnerability database
|
|
674
|
+
- Google-maintained infrastructure
|
|
675
|
+
|
|
676
|
+
## Output Formats
|
|
677
|
+
|
|
678
|
+
### Human-Readable (Default)
|
|
679
|
+
|
|
680
|
+
Most comfortable to read.
|
|
681
|
+
|
|
682
|
+
### Markdown
|
|
683
|
+
|
|
684
|
+
GitHub-friendly format with structured sections and severity indicators. Perfect for documentation, GitHub issues, and security reports.
|
|
685
|
+
|
|
686
|
+
### JSON
|
|
687
|
+
|
|
688
|
+
```json
|
|
689
|
+
{
|
|
690
|
+
"summary": {
|
|
691
|
+
"total_dependencies": 245,
|
|
692
|
+
"vulnerable_packages": 2,
|
|
693
|
+
"total_vulnerabilities": 3,
|
|
694
|
+
"by_severity": {
|
|
695
|
+
"critical": 1,
|
|
696
|
+
"high": 1,
|
|
697
|
+
"medium": 1,
|
|
698
|
+
"low": 0
|
|
699
|
+
}
|
|
700
|
+
},
|
|
701
|
+
"vulnerabilities": [...]
|
|
702
|
+
}
|
|
703
|
+
```
|
|
704
|
+
|
|
705
|
+
### SARIF (Static Analysis Results Interchange Format)
|
|
706
|
+
|
|
707
|
+
Compatible with GitHub Security tab, VS Code, and other security tools.
|
|
708
|
+
|
|
709
|
+
## Performance
|
|
710
|
+
|
|
711
|
+
PySentry is designed for speed and efficiency:
|
|
712
|
+
|
|
713
|
+
- **Concurrent Processing**: Vulnerability data fetched in parallel from multiple sources
|
|
714
|
+
- **Multi-tier Caching**: Intelligent caching for both vulnerability data and resolved dependencies
|
|
715
|
+
- **Efficient Matching**: In-memory indexing for fast vulnerability lookups
|
|
716
|
+
- **Streaming**: Large databases processed without excessive memory usage
|
|
717
|
+
|
|
718
|
+
### Resolution Cache Performance
|
|
719
|
+
|
|
720
|
+
The resolution cache provides dramatic performance improvements for requirements.txt files:
|
|
721
|
+
|
|
722
|
+
- **First scan**: Standard resolution time using `uv` or `pip-tools`
|
|
723
|
+
- **Subsequent scans**: Near-instantaneous when cache is fresh (>90% time savings)
|
|
724
|
+
- **Cache invalidation**: Automatic when requirements content, resolver, or environment changes
|
|
725
|
+
- **Content-aware**: Different cache entries for different Python versions and platforms
|
|
726
|
+
|
|
727
|
+
### Requirements.txt Resolution Performance
|
|
728
|
+
|
|
729
|
+
PySentry leverages external resolvers with intelligent caching:
|
|
730
|
+
|
|
731
|
+
- **uv resolver**: 2-10x faster than pip-tools, handles large dependency trees efficiently
|
|
732
|
+
- **pip-tools resolver**: Reliable fallback, slower but widely compatible
|
|
733
|
+
- **Isolated execution**: Prevents project pollution while maintaining security
|
|
734
|
+
- **Resolution caching**: Eliminates repeated resolver calls for unchanged requirements
|
|
735
|
+
|
|
736
|
+
## Development
|
|
737
|
+
|
|
738
|
+
### Building from Source
|
|
739
|
+
|
|
740
|
+
```bash
|
|
741
|
+
git clone https://github.com/nyudenkov/pysentry
|
|
742
|
+
cd pysentry
|
|
743
|
+
cargo build --release
|
|
744
|
+
```
|
|
745
|
+
|
|
746
|
+
### Running Tests
|
|
747
|
+
|
|
748
|
+
```bash
|
|
749
|
+
cargo test
|
|
750
|
+
```
|
|
751
|
+
|
|
752
|
+
### Project Structure
|
|
753
|
+
|
|
754
|
+
```
|
|
755
|
+
src/
|
|
756
|
+
├── main.rs # CLI interface
|
|
757
|
+
├── lib.rs # Library API
|
|
758
|
+
├── cache/ # Caching system
|
|
759
|
+
├── dependency/ # Dependency scanning
|
|
760
|
+
├── output/ # Report generation
|
|
761
|
+
├── parsers/ # Project file parsers
|
|
762
|
+
├── providers/ # Vulnerability data sources
|
|
763
|
+
├── types.rs # Core type definitions
|
|
764
|
+
└── vulnerability/ # Vulnerability matching
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
## Troubleshooting
|
|
768
|
+
|
|
769
|
+
### Common Issues
|
|
770
|
+
|
|
771
|
+
**Error: "No lock file or pyproject.toml found"**
|
|
772
|
+
|
|
773
|
+
```bash
|
|
774
|
+
# Ensure you're in a Python project directory
|
|
775
|
+
ls pyproject.toml uv.lock poetry.lock requirements.txt
|
|
776
|
+
|
|
777
|
+
# Or specify the path explicitly
|
|
778
|
+
pysentry /path/to/python/project
|
|
779
|
+
```
|
|
780
|
+
|
|
781
|
+
**Error: "No dependency resolver found" or "uv resolver not available"**
|
|
782
|
+
|
|
783
|
+
```bash
|
|
784
|
+
# Install a supported resolver in your environment
|
|
785
|
+
pip install uv # Recommended - fastest
|
|
786
|
+
pip install pip-tools # Alternative
|
|
787
|
+
|
|
788
|
+
# Verify resolver is available
|
|
789
|
+
uv --version
|
|
790
|
+
pip-compile --version
|
|
791
|
+
|
|
792
|
+
# If using virtual environments, ensure resolver is installed there
|
|
793
|
+
source venv/bin/activate
|
|
794
|
+
pip install uv
|
|
795
|
+
pysentry /path/to/project
|
|
796
|
+
```
|
|
797
|
+
|
|
798
|
+
**Error: "Failed to resolve requirements"**
|
|
799
|
+
|
|
800
|
+
```bash
|
|
801
|
+
# Check your requirements.txt syntax
|
|
802
|
+
cat requirements.txt
|
|
803
|
+
|
|
804
|
+
# Try different resolver
|
|
805
|
+
pysentry --resolver pip-tools # if uv fails
|
|
806
|
+
pysentry --resolver uv # if pip-tools fails
|
|
807
|
+
|
|
808
|
+
# Ensure you're in correct environment
|
|
809
|
+
which python
|
|
810
|
+
which uv # or which pip-compile
|
|
811
|
+
|
|
812
|
+
# Debug with verbose output
|
|
813
|
+
pysentry --verbose /path/to/project
|
|
814
|
+
```
|
|
815
|
+
|
|
816
|
+
**Error: "Failed to fetch vulnerability data"**
|
|
817
|
+
|
|
818
|
+
```bash
|
|
819
|
+
# Check network connectivity
|
|
820
|
+
curl -I https://osv-vulnerabilities.storage.googleapis.com/
|
|
821
|
+
|
|
822
|
+
# Try with different or multiple sources
|
|
823
|
+
pysentry --sources pypi
|
|
824
|
+
pysentry --sources pypa,osv
|
|
825
|
+
|
|
826
|
+
# For slow or unstable networks, increase timeout and retries
|
|
827
|
+
# Create/edit .pysentry.toml in your project:
|
|
828
|
+
```
|
|
829
|
+
|
|
830
|
+
```toml
|
|
831
|
+
[http]
|
|
832
|
+
timeout = 300 # 5 minute timeout
|
|
833
|
+
max_retries = 5 # More retry attempts
|
|
834
|
+
retry_max_backoff = 120 # Longer backoff delays
|
|
835
|
+
```
|
|
836
|
+
|
|
837
|
+
```bash
|
|
838
|
+
# Then run again
|
|
839
|
+
pysentry
|
|
840
|
+
```
|
|
841
|
+
|
|
842
|
+
**Network timeout errors:**
|
|
843
|
+
|
|
844
|
+
PySentry includes automatic retry with exponential backoff for network issues. If you still experience timeouts:
|
|
845
|
+
|
|
846
|
+
```bash
|
|
847
|
+
# Increase timeout values in config
|
|
848
|
+
pysentry config init --output .pysentry.toml
|
|
849
|
+
# Edit .pysentry.toml and adjust [http] section
|
|
850
|
+
```
|
|
851
|
+
|
|
852
|
+
**Rate limiting (HTTP 429 errors):**
|
|
853
|
+
|
|
854
|
+
PySentry automatically handles rate limiting. If rate limits persist:
|
|
855
|
+
|
|
856
|
+
```toml
|
|
857
|
+
[http]
|
|
858
|
+
max_retries = 5 # More attempts
|
|
859
|
+
retry_initial_backoff = 5 # Longer initial wait
|
|
860
|
+
retry_max_backoff = 300 # Up to 5 minute backoff
|
|
861
|
+
```
|
|
862
|
+
|
|
863
|
+
**Slow requirements.txt resolution**
|
|
864
|
+
|
|
865
|
+
```bash
|
|
866
|
+
# Use faster uv resolver instead of pip-tools
|
|
867
|
+
pysentry --resolver uv
|
|
868
|
+
|
|
869
|
+
# Install uv for better performance (2-10x faster)
|
|
870
|
+
pip install uv
|
|
871
|
+
|
|
872
|
+
# Or use uvx for isolated execution
|
|
873
|
+
uvx pysentry-rs --resolver uv /path/to/project
|
|
874
|
+
```
|
|
875
|
+
|
|
876
|
+
**Requirements.txt files not being detected**
|
|
877
|
+
|
|
878
|
+
```bash
|
|
879
|
+
# Ensure requirements.txt exists
|
|
880
|
+
ls requirements.txt
|
|
881
|
+
|
|
882
|
+
# Specify path explicitly
|
|
883
|
+
pysentry /path/to/python/project
|
|
884
|
+
|
|
885
|
+
# Include additional requirements files
|
|
886
|
+
pysentry --requirements requirements-dev.txt --requirements requirements-test.txt
|
|
887
|
+
|
|
888
|
+
# Check if higher-priority files exist (they take precedence)
|
|
889
|
+
ls uv.lock poetry.lock Pipfile.lock pyproject.toml Pipfile requirements.txt
|
|
890
|
+
```
|
|
891
|
+
|
|
892
|
+
**Performance Issues**
|
|
893
|
+
|
|
894
|
+
```bash
|
|
895
|
+
# Clear all caches and retry
|
|
896
|
+
rm -rf ~/.cache/pysentry # Linux
|
|
897
|
+
rm -rf ~/Library/Caches/pysentry # macOS
|
|
898
|
+
pysentry
|
|
899
|
+
|
|
900
|
+
# Clear only resolution cache (if vulnerability cache is working)
|
|
901
|
+
rm -rf ~/.cache/pysentry/dependency-resolution/ # Linux
|
|
902
|
+
rm -rf ~/Library/Caches/pysentry/dependency-resolution/ # macOS
|
|
903
|
+
pysentry
|
|
904
|
+
|
|
905
|
+
# Clear resolution cache via CLI
|
|
906
|
+
pysentry --clear-resolution-cache
|
|
907
|
+
|
|
908
|
+
# Use verbose mode to identify bottlenecks
|
|
909
|
+
pysentry --verbose
|
|
910
|
+
|
|
911
|
+
# Disable caching to isolate issues
|
|
912
|
+
pysentry --no-cache
|
|
913
|
+
```
|
|
914
|
+
|
|
915
|
+
**Resolution Cache Issues**
|
|
916
|
+
|
|
917
|
+
```bash
|
|
918
|
+
# Clear stale resolution cache after environment changes
|
|
919
|
+
pysentry --clear-resolution-cache
|
|
920
|
+
|
|
921
|
+
# Disable resolution cache if causing issues
|
|
922
|
+
pysentry --no-resolution-cache
|
|
923
|
+
|
|
924
|
+
# Extend cache TTL for stable environments
|
|
925
|
+
pysentry --resolution-cache-ttl 168 # 1 week
|
|
926
|
+
|
|
927
|
+
# Check cache usage with verbose output
|
|
928
|
+
pysentry --verbose # Shows cache hits/misses
|
|
929
|
+
|
|
930
|
+
# Force fresh resolution (ignores cache)
|
|
931
|
+
pysentry --clear-resolution-cache --no-resolution-cache
|
|
932
|
+
```
|
|
933
|
+
|
|
934
|
+
## Acknowledgments
|
|
935
|
+
|
|
936
|
+
- Inspired by [pip-audit](https://github.com/pypa/pip-audit) and [uv #9189 issue](https://github.com/astral-sh/uv/issues/9189)
|
|
937
|
+
- Originally was a command for [uv](https://github.com/astral-sh/uv)
|
|
938
|
+
- Vulnerability data from [PyPA](https://github.com/pypa/advisory-database), [PyPI](https://pypi.org/), and [OSV.dev](https://osv.dev/)
|
|
939
|
+
|