Skip to main content

๐Ÿฅท The ultimate Python dependency ninja - automate, secure, and modernize your requirements

Project description

PyNinja ๐Ÿฅท

PyPI version Python versions License: MIT Downloads Code style: black

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:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes and add tests
  4. Run the test suite: pytest
  5. 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

๐Ÿ†˜ Support

๐Ÿ“œ 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

Star History Chart


Made with โค๏ธ by the PyNinja Community

Website โ€ข Documentation โ€ข GitHub โ€ข PyPI

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyninja_tool-1.0.0-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

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

Hashes for pyninja_tool-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d547bea92ba86d5e05866e99bbf643047e3e284930f798d67de32305491a542c
MD5 36646d8ee797c1d995eaf1d5dc161145
BLAKE2b-256 028810bb9dbbf419e1ea5aa803ab1a6448abbfdb03ebc59d99be8555eab4ed3b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page