pydependencycheck 1.4.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 (65) hide show
  1. pydependencycheck-1.4.0/.github/INSTALL.md +58 -0
  2. pydependencycheck-1.4.0/.github/workflows/ci.yml +119 -0
  3. pydependencycheck-1.4.0/.github/workflows/wheels.yml +111 -0
  4. pydependencycheck-1.4.0/.gitignore +72 -0
  5. pydependencycheck-1.4.0/CONTRIBUTING.md +140 -0
  6. pydependencycheck-1.4.0/Cargo.lock +2080 -0
  7. pydependencycheck-1.4.0/Cargo.toml +56 -0
  8. pydependencycheck-1.4.0/LICENSE +22 -0
  9. pydependencycheck-1.4.0/PHASE_4_5_FEATURES.md +382 -0
  10. pydependencycheck-1.4.0/PKG-INFO +279 -0
  11. pydependencycheck-1.4.0/PROJECT_SUMMARY.md +447 -0
  12. pydependencycheck-1.4.0/README.md +224 -0
  13. pydependencycheck-1.4.0/crates/pydep-ast/Cargo.toml +19 -0
  14. pydependencycheck-1.4.0/crates/pydep-ast/src/dead_code.rs +140 -0
  15. pydependencycheck-1.4.0/crates/pydep-ast/src/errors.rs +18 -0
  16. pydependencycheck-1.4.0/crates/pydep-ast/src/imports.rs +179 -0
  17. pydependencycheck-1.4.0/crates/pydep-ast/src/lib.rs +48 -0
  18. pydependencycheck-1.4.0/crates/pydep-ast/src/usage.rs +263 -0
  19. pydependencycheck-1.4.0/crates/pydep-graph/Cargo.toml +19 -0
  20. pydependencycheck-1.4.0/crates/pydep-graph/src/analysis.rs +209 -0
  21. pydependencycheck-1.4.0/crates/pydep-graph/src/dag.rs +350 -0
  22. pydependencycheck-1.4.0/crates/pydep-graph/src/errors.rs +27 -0
  23. pydependencycheck-1.4.0/crates/pydep-graph/src/lib.rs +43 -0
  24. pydependencycheck-1.4.0/crates/pydep-graph/src/serialization.rs +90 -0
  25. pydependencycheck-1.4.0/crates/pydep-parser/Cargo.toml +19 -0
  26. pydependencycheck-1.4.0/crates/pydep-parser/src/constraint.rs +40 -0
  27. pydependencycheck-1.4.0/crates/pydep-parser/src/errors.rs +36 -0
  28. pydependencycheck-1.4.0/crates/pydep-parser/src/lib.rs +76 -0
  29. pydependencycheck-1.4.0/crates/pydep-parser/src/models.rs +97 -0
  30. pydependencycheck-1.4.0/crates/pydep-parser/src/pyproject.rs +179 -0
  31. pydependencycheck-1.4.0/crates/pydep-parser/src/requirements.rs +257 -0
  32. pydependencycheck-1.4.0/crates/pydep-parser/src/setup.rs +16 -0
  33. pydependencycheck-1.4.0/crates/pydep-security/Cargo.toml +21 -0
  34. pydependencycheck-1.4.0/crates/pydep-security/src/cache.rs +175 -0
  35. pydependencycheck-1.4.0/crates/pydep-security/src/errors.rs +24 -0
  36. pydependencycheck-1.4.0/crates/pydep-security/src/lib.rs +49 -0
  37. pydependencycheck-1.4.0/crates/pydep-security/src/osv.rs +510 -0
  38. pydependencycheck-1.4.0/crates/pydep-security/src/scoring.rs +198 -0
  39. pydependencycheck-1.4.0/docs/ROADMAP.md +313 -0
  40. pydependencycheck-1.4.0/pyproject.toml +125 -0
  41. pydependencycheck-1.4.0/python/pydependencycheck/__init__.py +16 -0
  42. pydependencycheck-1.4.0/python/pydependencycheck/cli.py +673 -0
  43. pydependencycheck-1.4.0/python/pydependencycheck/dashboard.py +280 -0
  44. pydependencycheck-1.4.0/python/pydependencycheck/git_integration.py +224 -0
  45. pydependencycheck-1.4.0/python/pydependencycheck/github_actions.py +180 -0
  46. pydependencycheck-1.4.0/python/pydependencycheck/health.py +289 -0
  47. pydependencycheck-1.4.0/python/pydependencycheck/licenses.py +257 -0
  48. pydependencycheck-1.4.0/python/pydependencycheck/remediate.py +339 -0
  49. pydependencycheck-1.4.0/python/pydependencycheck/reporters.py +216 -0
  50. pydependencycheck-1.4.0/python/pydependencycheck/sbom.py +284 -0
  51. pydependencycheck-1.4.0/python/pydependencycheck/scanner.py +465 -0
  52. pydependencycheck-1.4.0/python/pydependencycheck/storage.py +382 -0
  53. pydependencycheck-1.4.0/python/pydependencycheck/telemetry.py +341 -0
  54. pydependencycheck-1.4.0/python/pydependencycheck/vulnerabilities.py +236 -0
  55. pydependencycheck-1.4.0/test_project/requirements.txt +8 -0
  56. pydependencycheck-1.4.0/tests/test_cli.py +211 -0
  57. pydependencycheck-1.4.0/tests/test_github_actions.py +135 -0
  58. pydependencycheck-1.4.0/tests/test_health.py +127 -0
  59. pydependencycheck-1.4.0/tests/test_licenses.py +144 -0
  60. pydependencycheck-1.4.0/tests/test_remediate.py +411 -0
  61. pydependencycheck-1.4.0/tests/test_reporters.py +154 -0
  62. pydependencycheck-1.4.0/tests/test_sbom.py +120 -0
  63. pydependencycheck-1.4.0/tests/test_scanner.py +198 -0
  64. pydependencycheck-1.4.0/tests/test_storage.py +137 -0
  65. pydependencycheck-1.4.0/tests/test_telemetry.py +150 -0
@@ -0,0 +1,58 @@
1
+ # Installation Guide
2
+
3
+ ## Quick Install
4
+
5
+ ```bash
6
+ pip install pydependencycheck
7
+ ```
8
+
9
+ ## Requirements
10
+
11
+ - Python 3.10+
12
+ - macOS 10.13+, Ubuntu 20.04+, Windows 10+
13
+
14
+ ## Installation
15
+
16
+ ### Standard Install (Recommended)
17
+ Works for most users with prebuilt wheels:
18
+ ```bash
19
+ pip install pydependencycheck
20
+ ```
21
+
22
+ ### From Source (If Needed)
23
+ For ARM or custom builds:
24
+ ```bash
25
+ # Install Rust
26
+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
27
+
28
+ # Then install
29
+ pip install pydependencycheck
30
+ ```
31
+
32
+ ## Troubleshooting
33
+
34
+ ### "No wheels available for your platform"
35
+ ```bash
36
+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
37
+ pip install --force-reinstall pydependencycheck
38
+ ```
39
+
40
+ ### Python version issues
41
+ Ensure Python 3.10+:
42
+ ```bash
43
+ python --version
44
+ ```
45
+
46
+ ### Missing dependencies (Linux)
47
+ ```bash
48
+ sudo apt-get install python3-dev build-essential
49
+ ```
50
+
51
+ ## Next Steps
52
+
53
+ After installation:
54
+ 1. See [README.md](../README.md) for quick start
55
+ 2. Check [examples/](../examples/) for usage examples
56
+ 3. Read [docs/](../docs/) for full documentation
57
+
58
+ For more help, see [full installation guide](INSTALL.md).
@@ -0,0 +1,119 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, develop]
6
+ pull_request:
7
+ branches: [main, develop]
8
+
9
+ jobs:
10
+ rust-tests:
11
+ name: Rust Tests
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - name: Set up Rust
18
+ uses: dtolnay/rust-toolchain@stable
19
+ with:
20
+ targets: x86_64-unknown-linux-gnu
21
+
22
+ - name: Cache cargo registry
23
+ uses: actions/cache@v3
24
+ with:
25
+ path: ~/.cargo/registry
26
+ key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
27
+
28
+ - name: Cache cargo index
29
+ uses: actions/cache@v3
30
+ with:
31
+ path: ~/.cargo/git
32
+ key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
33
+
34
+ - name: Cache cargo build
35
+ uses: actions/cache@v3
36
+ with:
37
+ path: target
38
+ key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
39
+
40
+ - name: Run tests
41
+ run: cargo test --workspace --verbose
42
+
43
+ - name: Run doc tests
44
+ run: cargo test --doc --workspace
45
+
46
+ - name: Clippy
47
+ run: cargo clippy --workspace -- -D warnings
48
+
49
+ - name: Format check
50
+ run: cargo fmt --check
51
+
52
+ python-tests:
53
+ name: Python Tests
54
+ runs-on: ubuntu-latest
55
+
56
+ steps:
57
+ - uses: actions/checkout@v4
58
+
59
+ - name: Set up Python
60
+ uses: actions/setup-python@v4
61
+ with:
62
+ python-version: '3.11'
63
+
64
+ - name: Set up Rust
65
+ uses: dtolnay/rust-toolchain@stable
66
+
67
+ # maturin develop requires an active virtualenv/conda env to install
68
+ # into and doesn't create one itself. Put its bin/ on $GITHUB_PATH so
69
+ # every later step in this job (pip installs, maturin, pytest) uses
70
+ # it automatically.
71
+ - name: Create virtualenv
72
+ run: |
73
+ python -m venv .venv
74
+ echo "$PWD/.venv/bin" >> "$GITHUB_PATH"
75
+ echo "VIRTUAL_ENV=$PWD/.venv" >> "$GITHUB_ENV"
76
+
77
+ - name: Install maturin
78
+ run: pip install maturin
79
+
80
+ - name: Install dependencies
81
+ run: |
82
+ pip install -e .[dev]
83
+ pip install click pydantic gitpython
84
+
85
+ - name: Build extension
86
+ run: maturin develop --release
87
+
88
+ - name: Run tests
89
+ run: pytest tests/ -v --cov=pydependencycheck
90
+
91
+ - name: Upload coverage
92
+ uses: codecov/codecov-action@v3
93
+ with:
94
+ files: ./coverage.xml
95
+
96
+ lint:
97
+ name: Linting
98
+ runs-on: ubuntu-latest
99
+
100
+ steps:
101
+ - uses: actions/checkout@v4
102
+
103
+ - name: Set up Python
104
+ uses: actions/setup-python@v4
105
+ with:
106
+ python-version: '3.11'
107
+
108
+ - name: Install linting tools
109
+ run: |
110
+ pip install black ruff mypy
111
+
112
+ - name: Run black
113
+ run: black --check python/
114
+
115
+ - name: Run ruff
116
+ run: ruff check python/
117
+
118
+ - name: Run mypy
119
+ run: mypy python/pydependencycheck --ignore-missing-imports || true
@@ -0,0 +1,111 @@
1
+ name: Build & Test Wheels
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ tags: ['v*']
7
+ pull_request:
8
+ branches: [main]
9
+
10
+ jobs:
11
+ build-wheels:
12
+ name: Build wheels on ${{ matrix.os }}
13
+ runs-on: ${{ matrix.os }}
14
+ strategy:
15
+ matrix:
16
+ include:
17
+ - os: ubuntu-latest
18
+ target: x86_64
19
+
20
+ # Both macOS legs run on macos-14 (Apple Silicon). The Intel leg
21
+ # used to run natively on macos-13, but that image was queuing
22
+ # forever with zero progress -- the same "no runner capacity"
23
+ # signature the previously-retired macos-12 showed (confirmed:
24
+ # the other 3 matrix legs on the same run completed in minutes
25
+ # while this one sat queued for 25+ minutes). Rather than chase
26
+ # whichever specific macOS image happens to still be hosted,
27
+ # cross-compile the Intel wheel from Apple Silicon via
28
+ # maturin-action, which doesn't depend on an actual Intel runner
29
+ # existing.
30
+ - os: macos-14
31
+ target: aarch64-apple-darwin
32
+ - os: macos-14
33
+ target: x86_64-apple-darwin
34
+
35
+ - os: windows-latest
36
+ target: x86_64
37
+
38
+ steps:
39
+ - uses: actions/checkout@v4
40
+
41
+ - name: Set up Python
42
+ uses: actions/setup-python@v4
43
+ with:
44
+ python-version: '3.11'
45
+
46
+ # maturin-action manages its own Rust toolchain for the macOS legs;
47
+ # the Linux/Windows "native" path below calls `python -m build`
48
+ # directly and needs rustc on PATH itself.
49
+ - name: Set up Rust
50
+ if: runner.os != 'macOS'
51
+ uses: dtolnay/rust-toolchain@stable
52
+
53
+ - name: Build wheels (macOS, via maturin-action for cross-compilation)
54
+ if: runner.os == 'macOS'
55
+ uses: PyO3/maturin-action@v1
56
+ env:
57
+ PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
58
+ with:
59
+ target: ${{ matrix.target }}
60
+ args: --release --out dist
61
+
62
+ - name: Build wheels (Linux/Windows, native)
63
+ if: runner.os != 'macOS'
64
+ env:
65
+ PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
66
+ run: |
67
+ pip install --upgrade pip
68
+ pip install maturin wheel build
69
+ python -m build --wheel
70
+
71
+ - name: Install dependencies for testing
72
+ run: |
73
+ pip install pytest click pydantic gitpython rich requests
74
+
75
+ - name: Test wheels
76
+ # Skip on the cross-compiled Intel-from-ARM leg -- the wheel is
77
+ # built for a different CPU architecture than this runner, so it
78
+ # cannot actually be installed/imported here.
79
+ if: matrix.target != 'x86_64-apple-darwin'
80
+ run: |
81
+ pip install dist/*.whl
82
+ pytest tests/ -v || true
83
+
84
+ - name: Upload wheels
85
+ uses: actions/upload-artifact@v4
86
+ with:
87
+ name: wheels-${{ matrix.os }}-${{ matrix.target }}
88
+ path: dist/
89
+
90
+ publish:
91
+ name: Publish to PyPI
92
+ runs-on: ubuntu-latest
93
+ needs: build-wheels
94
+ if: startsWith(github.ref, 'refs/tags/v')
95
+
96
+ steps:
97
+ - uses: actions/checkout@v4
98
+
99
+ - uses: actions/download-artifact@v4
100
+ with:
101
+ path: dist/
102
+
103
+ - name: Flatten artifacts
104
+ run: |
105
+ find dist -type f -name "*.whl" -exec mv {} dist/ \;
106
+ find dist -type d -empty -delete
107
+
108
+ - name: Publish to PyPI
109
+ uses: pypa/gh-action-pypi-publish@release/v1
110
+ with:
111
+ password: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,72 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ pip-wheel-metadata/
20
+ share/python-wheels/
21
+ *.egg-info/
22
+ .installed.cfg
23
+ *.egg
24
+ MANIFEST
25
+ .pytest_cache/
26
+ .coverage
27
+ htmlcov/
28
+
29
+ # Virtual environments
30
+ venv/
31
+ env/
32
+ ENV/
33
+ env.bak/
34
+ venv.bak/
35
+
36
+ # IDE
37
+ .vscode/
38
+ .idea/
39
+ *.swp
40
+ *.swo
41
+ *~
42
+ .DS_Store
43
+
44
+ # Rust
45
+ target/
46
+ Cargo.lock
47
+ **/*.rs.bk
48
+
49
+ # Build artifacts
50
+ *.o
51
+ *.a
52
+ *.rlib
53
+ *.dylib
54
+ *.dll
55
+ *.exe
56
+
57
+ # Project-specific
58
+ .pydep/
59
+ .pydependencycheck.yaml.local
60
+ *.db
61
+ *.sqlite3
62
+
63
+ # OS
64
+ .DS_Store
65
+ .AppleDouble
66
+ .LSOverride
67
+ *.sublime-project
68
+ *.sublime-workspace
69
+
70
+ # Logs
71
+ *.log
72
+ logs/
@@ -0,0 +1,140 @@
1
+ # Contributing to PyDependencyCheck
2
+
3
+ Thanks for your interest in contributing! This guide covers development setup, testing, and the submission process.
4
+
5
+ ## Development Setup
6
+
7
+ ### Prerequisites
8
+ - Rust 1.75+ (`rustup update`)
9
+ - Python 3.8+ (3.10+ recommended)
10
+ - Git
11
+
12
+ ### Clone & Build
13
+
14
+ ```bash
15
+ git clone https://github.com/Mullassery/PyDependencyCheck
16
+ cd PyDependencyCheck
17
+
18
+ # Create virtual environment
19
+ python -m venv venv
20
+ source venv/bin/activate # or `venv\Scripts\activate` on Windows
21
+
22
+ # Install development dependencies
23
+ pip install -e .[dev]
24
+ pip install maturin
25
+
26
+ # Build Rust extension
27
+ maturin develop --release
28
+ ```
29
+
30
+ ### Running Tests
31
+
32
+ ```bash
33
+ # Rust tests (fast)
34
+ cargo test --workspace
35
+
36
+ # Python tests (with coverage)
37
+ pytest tests/ -v --cov=pydependencycheck
38
+
39
+ # All checks
40
+ cargo fmt
41
+ cargo clippy
42
+ black python/
43
+ ruff python/
44
+ ```
45
+
46
+ ## Project Structure
47
+
48
+ ```
49
+ PyDependencyCheck/
50
+ ├── crates/ # Rust workspace
51
+ │ ├── pydep-parser/ # Dependency file parsing
52
+ │ ├── pydep-graph/ # Graph algorithms (petgraph)
53
+ │ ├── pydep-ast/ # Code analysis (tree-sitter)
54
+ │ ├── pydep-security/ # OSV integration, scoring
55
+ │ └── pydep-py/ # PyO3 bindings
56
+ ├── python/
57
+ │ └── pydependencycheck/ # Python package
58
+ │ ├── cli.py # Click CLI
59
+ │ ├── scanner.py # Main scanner
60
+ │ ├── reporters.py # Output generators
61
+ │ ├── storage.py # SQLite layer
62
+ │ └── git_integration.py
63
+ ├── tests/ # Test files
64
+ ├── docs/ # Documentation
65
+ └── pyproject.toml # Maturin config
66
+ ```
67
+
68
+ ## Coding Standards
69
+
70
+ ### Rust
71
+ - Format: `cargo fmt`
72
+ - Lint: `cargo clippy -- -D warnings`
73
+ - Tests: Unit tests in each crate, integration tests in `tests/`
74
+
75
+ ### Python
76
+ - Format: `black python/` (line length 120)
77
+ - Lint: `ruff python/` (E, F, W, I)
78
+ - Type hints: Encouraged but not required (mypy friendly)
79
+
80
+ ## Adding a Feature
81
+
82
+ ### 1. Create an Issue
83
+ Describe what you want to build and why.
84
+
85
+ ### 2. Design Phase
86
+ - Small features: Direct to PR
87
+ - Large features: Open a Design Discussion first
88
+
89
+ ### 3. Development
90
+ - Create a feature branch: `git checkout -b feat/your-feature`
91
+ - Write tests first (TDD encouraged)
92
+ - Keep commits small and focused
93
+
94
+ ### 4. Testing
95
+ - Rust: `cargo test --workspace`
96
+ - Python: `pytest tests/ -v`
97
+ - Integration: End-to-end test with real projects
98
+
99
+ ### 5. Pull Request
100
+ - Link to the issue
101
+ - Describe changes clearly
102
+ - Ensure CI passes (GitHub Actions)
103
+ - Request review from maintainers
104
+
105
+ ## Common Tasks
106
+
107
+ ### Adding a Dependency Parser
108
+ 1. Create parser module in `crates/pydep-parser/src/`
109
+ 2. Implement `parse_xyz_file()` function
110
+ 3. Update `lib.rs` to export it
111
+ 4. Add integration test in `tests/`
112
+
113
+ ### Adding a CLI Command
114
+ 1. Add function to `python/pydependencycheck/cli.py`
115
+ 2. Decorate with `@cli.command()`
116
+ 3. Write docstring with examples
117
+ 4. Test: `pydependencycheck --help`
118
+
119
+ ### Improving Performance
120
+ 1. Profile with `cargo flamegraph` or `py-spy`
121
+ 2. Add benchmark test
122
+ 3. Document improvements in PR
123
+
124
+ ## Release Process
125
+
126
+ 1. **Version bump:** Edit `Cargo.toml` + `pyproject.toml`
127
+ 2. **Changelog:** Update `CHANGELOG.md`
128
+ 3. **Tag:** `git tag v0.1.0`
129
+ 4. **Push:** GitHub Actions builds wheels automatically
130
+ 5. **PyPI:** Artifacts published to PyPI
131
+
132
+ ## Getting Help
133
+
134
+ - **Discussions:** [GitHub Discussions](https://github.com/Mullassery/PyDependencyCheck/discussions)
135
+ - **Issues:** [Report a bug](https://github.com/Mullassery/PyDependencyCheck/issues)
136
+ - **Email:** mullassery@gmail.com
137
+
138
+ ---
139
+
140
+ **Contributor Agreement:** By submitting code, you agree it will be licensed under the Proprietary License. See LICENSE for details.