System Dependency Checker for Python Projects
Project description
sysdep - System Dependency Checker for Python
sysdep is a cross-platform tool to manage and verify non-Python system dependencies required by Python applications. It fills the gap between Python package management and system-level dependencies.
Problem
While Python package managers like pip, Poetry, or Pipenv handle Python modules well, there's no unified way to:
- Declare system dependencies (like FFmpeg, ImageMagick, or platform libraries)
- Verify if those dependencies are installed on a user's system
- Guide users through installation of missing dependencies
Features
- Declarative Dependencies: Specify system requirements in a clear, structured format
- Cross-Platform Support: Works on Linux, macOS, and Windows
- Automatic Detection: Scans for common tools and libraries
- Installation Guidance: Suggests installation commands for missing dependencies
- CI Integration: Easy to integrate with CI/CD pipelines
- Development Tool: Checks dependencies during development or installation
- Code Annotations: Scan Python code for special comments that declare dependencies
- Progress Bars: Visual feedback for long-running operations
Installation
# Basic installation
pip install sysdep
# Install with UI enhancements (progress bars)
pip install "sysdep[ui]"
Install with UI enhancements
pip install "sysdep[ui]"
## Quick Start
### Create a dependency manifest
Create a file named `system_requirements.txt` in your project:
Media processing tools
executable: ffmpeg >= 4.2.0 executable: imagemagick
Libraries
library: libssl >= 1.1.0
### Check dependencies
```bash
# Check dependencies from manifest file
sysdep check -f system_requirements.txt
# Scan Python files for dependency annotations
sysdep check -d ./my_package
# Output in JSON format
sysdep check -f system_requirements.txt --json
Install missing dependencies
sysdep install -f system_requirements.txt
Generate manifest
# Generate from code annotations
sysdep generate ./my_package -o system_requirements.txt
# Generate from Python dependencies (requirements.txt, pyproject.toml, setup.py)
sysdep generate ./ --from-python-deps -o system_requirements.txt
# Map Python packages to system dependencies
sysdep map numpy pillow opencv-python
# Map packages from requirements.txt
sysdep map --file requirements.txt
Dependency Declaration
Manifest File
The system_requirements.txt file uses a simple format:
# Comments start with hash
dependency_type: name [>= version]
Available dependency types:
executable: Command-line tools found in PATHlibrary: Shared libraries/DLLs
Automatic Generation from Python Dependencies
sysdep can automatically generate system requirements from your Python dependencies:
sysdep generate ./ --from-python-deps
This will:
- Scan your project for
requirements.txt,pyproject.toml, andsetup.pyfiles - Extract Python package dependencies
- Map those packages to known system dependencies
- Generate a
system_requirements.txtfile
Supported mappings include (but not limited to):
pillow→ libjpeg, libpngopencv-python→ opencv librariesmoviepy,pydub→ ffmpegnumpy,scipy→ BLAS, LAPACKpsycopg2→ libpqlxml→ libxml2, libxslttensorflow,pytorch→ CUDA libraries- And many more!
Code Annotations
You can declare dependencies directly in your Python code using special comments:
# sysdep: ffmpeg >= 4.2.0
import subprocess
def process_video(input_file, output_file):
# requires-system: imagemagick
subprocess.run(['ffmpeg', '-i', input_file, output_file])
Integration with Setuptools
sysdep integrates with setuptools to automatically check dependencies during package installation:
# setup.py
from setuptools import setup, find_packages
from sysdep.setuptools_integration import setup_integration
setup_kwargs = {
'name': 'my-package',
'version': '0.1.0',
# Other setup parameters...
}
# Integrate sysdep with setuptools
setup_integration(setup_kwargs)
# Run setup
setup(**setup_kwargs)
This adds a sysdep command to setuptools and modifies the install and develop commands to check dependencies first.
# Check dependencies
python setup.py sysdep
# Install package and check dependencies
python setup.py install
# Use strict mode to fail if dependencies are missing
python setup.py sysdep --strict
API Usage
from sysdep import check_dependencies
from sysdep.parsers.code_scanner import DependencyScanner
# Check dependencies from manifest file
results = check_dependencies('system_requirements.txt')
if not results['all_installed']:
print("Missing dependencies:")
for dep in results['missing']:
print(f"- {dep['name']}")
# Scan for dependencies in code
scanner = DependencyScanner()
dependencies = scanner.scan_directory('./my_package')
License
MIT License
Copyright (c) 2024-2025 Latiful Mousom
See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sysdep-0.1.3.tar.gz.
File metadata
- Download URL: sysdep-0.1.3.tar.gz
- Upload date:
- Size: 27.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d4c8857a0873875691d846c3437847618c939f8e737ddea347131a443879092
|
|
| MD5 |
a9f103a8a3f5b37b2e63551b8f8861fe
|
|
| BLAKE2b-256 |
95ca0d193fb730f2064b8b84dabf6fab71104d2f1c41180473b9025e95fcbc97
|
File details
Details for the file sysdep-0.1.3-py3-none-any.whl.
File metadata
- Download URL: sysdep-0.1.3-py3-none-any.whl
- Upload date:
- Size: 32.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5efc69b692c8ae3c4791cc02a946ac5e113edf73a3b4307778c86ce7500ac85d
|
|
| MD5 |
f2fc069c55d42616da8749125dfb872b
|
|
| BLAKE2b-256 |
a4e730ae2c388bf3ba47e064916249e00f7e8e5d900185401aadd61963e64758
|