New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

definder

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

definder

A fast Python dependency analyzer that automatically discovers and extracts third-party imports

  • 0.1.2
  • PyPI
  • Socket score

Maintainers
1

depfinder 🔍

A Python dependency analyzer inspired by Black's implementation that automatically discovers and extracts third-party imports from your Python projects. It scans your codebase to identify external dependencies while filtering out project-internal imports.

Features ✨

  • Follows Black's approach to traverse Python files
  • Smart package name resolution (e.g., PILpillow, cv2opencv-python)
  • Filters out both standard library and project-internal imports
  • Handles common import name mismatches
  • Generates requirements.txt file
  • Parallel processing for faster scanning

⚠️ Note: The tool may occasionally fail to identify some dependencies due to complex import patterns or dynamic imports.

Installation 📦

pip install depfinder

Usage 🚀

You can use depfinder either as a module or directly as a command (like Black):

# As a command (recommended)
definder src/
definder .                    # Current directory
definder src/ tests/         # Multiple paths

# As a module
python -m definder src/
python -m definder .

Options:

definder src/ --no-save     # Don't generate requirements file
definder src/ --workers 4   # Specify number of parallel workers

How it Works 🛠️

  1. Traverses Python files using Black's file discovery approach
  2. Uses AST parsing to safely extract imports
  3. Filters out standard library and project-internal imports
  4. Maps common import aliases to their correct PyPI package names
  5. Generates a clean requirements file

Output 📝

The tool will:

  1. Show all scanned files
  2. List discovered third-party dependencies
  3. Generate a requirements.txt file (or requirements-definder.txt if the former exists)

Known Limitations 🚧

  • May not detect dependencies from dynamic imports
  • Some complex import patterns might be missed
  • Package name mapping might not cover all cases

Contributing 🤝

Found a bug or want to improve the package name mapping? Contributions are welcome! Please feel free to submit a Pull Request.

License 📄

MIT

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc