๐ฅท The ultimate Python dependency ninja - automate, secure, and modernize your requirements
Project description
PyNinja ๐ฅท
The Ultimate Python Dependency Ninja - Silently strike outdated dependencies, eliminate security vulnerabilities, and modernize your Python projects with stealth and precision! ๐ฅทโก
PyNinja is a powerful, community-driven tool that revolutionizes Python dependency management. It combines security scanning, intelligent modernization, performance optimization, and automated updates into one sleek package.
๐ Why PyNinja?
- ๐ Security First: Real-time vulnerability scanning with OSV database integration
- ๐ Smart Modernization: Automatically detects and suggests modern alternatives to legacy packages
- โก Performance Focused: Recommends faster, more efficient package alternatives
- ๐ค CI/CD Ready: Generates GitHub Actions workflows and PR descriptions
- ๐ฏ Multi-Format Support: Works with
requirements.txt,pyproject.toml,Pipfile, and more - ๐ง Intelligent Analysis: ML-inspired scoring for compatibility and community health
- ๐จ Beautiful CLI: Rich terminal interface with progress bars and interactive prompts
โก Quick Start
Installation
# Install PyNinja
pip install pyninja
# Or with all optional features
pip install pyninja[all]
Basic Usage
# Analyze your project (auto-detects requirements files)
pyninja
# Security-focused scan with auto-fixes
pyninja --security-first --auto-fix
# Interactive mode with modern alternatives
pyninja --interactive --modernize --performance
# Generate GitHub PR for updates
pyninja --github-pr --export-report security_report.json
๐ฏ Features Overview
๐ Smart Analysis
- Multi-format detection: Automatically finds and parses requirements files
- Dependency tree mapping: Visualizes complex dependency relationships
- Compatibility scoring: Analyzes Python version compatibility
- Community health metrics: Evaluates package maintenance quality
๐ก๏ธ Security & Safety
- Real-time vulnerability scanning using OSV database
- Automated security patches with version recommendations
- License compatibility checking for compliance
- Deprecation warnings for unmaintained packages
๐ Modernization Engine
- Python 2 โ 3 migration assistance
- Legacy package replacement suggestions
- Performance optimization recommendations
- Modern alternative discovery (httpx vs requests, orjson vs json, etc.)
๐ค Automation & CI/CD
- GitHub Actions integration with workflow generation
- Automated PR creation with detailed change descriptions
- Docker optimization suggestions
- Dry-run capabilities for safe testing
๐ Usage Examples
Basic Dependency Analysis
# Analyze current directory
pyninja
# Specify custom requirements file
pyninja --file custom-requirements.txt
# Target specific Python version
pyninja --python-version 3.11
Security-Focused Scanning
# Security scan with immediate fixes
pyninja --security-first --auto-fix
# Strict mode (exit with error if vulnerabilities found)
pyninja --strict --security-first
# Export detailed security report
pyninja --export-report security_audit.json
Modernization & Performance
# Full modernization analysis
pyninja --modernize --performance
# Interactive mode with choices
pyninja --interactive --modernize
# Preview changes without applying
pyninja --dry-run --modernize --output updated_requirements.txt
CI/CD Integration
# Generate GitHub workflow
pyninja --github-pr --auto-fix
# Clear cache and run fresh analysis
pyninja --cache-clear --export-report ci_report.json
๐จ Beautiful Output
PyNinja provides rich, colorful terminal output:
๐ PyNinja v1.0.0 - The Ultimate Python Dependency Ninja
๐ฆ Found 25 packages to analyze
โโ Summary โโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโ
โ Total Packages โ 25 โ
โ Packages with Updates โ 12 โ
โ Security Vulnerabilities โ 3 โ
โ Deprecated Packages โ 2 โ
โ Compatibility Score โ 0.92/1.0โ
โ Community Score โ 0.88/1.0โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโ
๐จ Security Vulnerabilities
โข requests (2.25.1) - 2 vulnerabilities
โข pillow (8.0.0) - 1 vulnerability
๐
Outdated Packages
โข numpy: 1.20.0 โ 1.24.3
โข pandas: 1.3.0 โ 2.0.1
โข django: 3.2.0 โ 4.2.1
๐ Modernization Opportunities
โข json: Consider orjson for 2-3x faster JSON processing
โข requests: Use httpx for async HTTP requests
๐ง Configuration
PyNinja supports various configuration options:
Command Line Options
Options:
-f, --file PATH Requirements file path
-o, --output PATH Output file for updated requirements
--format [requirements.txt|pyproject.toml|pipfile]
--auto-fix Automatically apply fixes
--strict Exit with error if issues found
--security-first Prioritize security updates
--modernize Suggest modern alternatives
--performance Focus on performance improvements
--python-version TEXT Target Python version
--github-pr Generate GitHub PR description
--dry-run Preview changes without applying
--interactive Interactive mode with prompts
--cache-clear Clear cache before running
--export-report PATH Export detailed JSON report
--help Show this message and exit
Configuration File
Create a .pyninja.toml file in your project root:
[pyninja]
security_first = true
modernize = true
performance = false
target_python = "3.11"
auto_fix = false
strict_mode = false
[pyninja.exclude]
packages = ["legacy-package", "internal-tool"]
[pyninja.alternatives]
"old-package" = "new-package"
๐ Supported Formats
PyNinja works with multiple dependency formats:
- requirements.txt - Traditional pip requirements
- pyproject.toml - Modern Python packaging (PEP 621)
- Pipfile - Pipenv format
- poetry.lock - Poetry dependencies
- setup.py - Legacy setuptools (read-only)
๐ค GitHub Integration
Generate automated dependency update workflows:
pyninja --github-pr
This creates:
github_pr_description.md- PR description template.github/workflows/dependencies.yml- GitHub Actions workflow- Detailed change analysis and security impact assessment
๐ Migration Examples
Python 2 to 3 Migration
# Before
mysql-python==1.2.5
pycrypto==2.6.1
unittest2==1.1.0
# After PyNinja analysis
PyMySQL>=3.1.0
pycryptodome>=3.17.0
# unittest2 removed (built into Python 3)
Performance Modernization
# Before
requests==2.28.0
json # built-in module
# After PyNinja suggestions
httpx>=0.24.0 # async support
orjson>=3.8.0 # 2-3x faster JSON
๐ Advanced Features
Vulnerability Database Integration
- OSV (Google) - Default, comprehensive vulnerability data
- GitHub Advisory - GitHub's security advisory database
- Snyk - Commercial vulnerability intelligence
Performance Optimization
- Binary wheel preferences for faster installs
- Compiled alternative suggestions (e.g., orjson, uvloop)
- Memory usage optimization recommendations
- Container-specific optimizations
Community Health Scoring
- Recent update activity
- Maintainer responsiveness
- GitHub stars and forks
- Documentation quality
- Test coverage indicators
๐งช Testing & Development
# Install development dependencies
pip install pyninja[dev]
# Run tests
pytest
# Code formatting
black pyninja/
isort pyninja/
# Type checking
mypy pyninja/
๐ค Contributing
We welcome contributions! Here's how to get started:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and add tests
- Run the test suite:
pytest - Submit a pull request
Development Setup
git clone https://github.com/pyninja-dev/pyninja.git
cd pyninja
pip install -e .[dev]
pre-commit install
๐ฎ Roadmap
- Machine Learning integration for smarter recommendations
- Multi-language support (Node.js, Go, Rust dependencies)
- IDE plugins (VS Code, PyCharm)
- Enterprise features (SAML, audit logs, policy enforcement)
- Cloud integrations (AWS, GCP, Azure)
- Supply chain analysis and SBOM generation
๐ Documentation
- Full Documentation: pyninja.dev/docs
- API Reference: pyninja.dev/api
- Examples: github.com/pyninja-dev/examples
- Blog: pyninja.dev/blog
๐ Support
- GitHub Issues: Report bugs or request features
- Discussions: Community discussions
- Discord: Join our community
- Email: community@pyninja.dev
๐ License
PyNinja is released under the MIT License.
๐ Acknowledgments
- OSV for comprehensive vulnerability data
- PyPI for package metadata
- Rich for beautiful terminal interfaces
- Click for excellent CLI framework
- Community contributors who make PyNinja awesome
โญ Star History
Made with โค๏ธ by the PyNinja Community
Website โข Documentation โข GitHub โข PyPI
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 Distributions
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 pyninja_tool-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pyninja_tool-1.0.0-py3-none-any.whl
- Upload date:
- Size: 22.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d547bea92ba86d5e05866e99bbf643047e3e284930f798d67de32305491a542c
|
|
| MD5 |
36646d8ee797c1d995eaf1d5dc161145
|
|
| BLAKE2b-256 |
028810bb9dbbf419e1ea5aa803ab1a6448abbfdb03ebc59d99be8555eab4ed3b
|