Skip to main content

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., PIL → pillow, cv2 → opencv-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

Metadata

Release files for definder 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for definder 0.1.2
File Size Uploaded Provenance Actions
definder-0.1.2.tar.gz 10.3 kB Without provenance Details for definder-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for definder 0.1.2
File Interpreter ABI Platform Actions
definder-0.1.2-py3-none-any.whl Python 3 none any Details for definder-0.1.2-py3-none-any.whl

Total release size: 20.5 kB

Release files / definder-0.1.2.tar.gz

Download URL definder-0.1.2.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
48f4e59611a9c61886c1367c7e0696ea211daa386896481ac9b1392decf1c5eb
BLAKE2b-256 checksum
How to use checksums
48e4fc246d1620fc2b431fc435051189f80a554931d18806e4887d6c52aedd62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.15

Release files / definder-0.1.2-py3-none-any.whl

Download URL definder-0.1.2-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0dffa4d5c3dcbf9cd7dc7eda8810eb4c65a50edc089d55ecca11fb59a961d77
BLAKE2b-256 checksum
How to use checksums
44cc65404cc092886c3c6898b9f71c9982e421690f03cf5a29a736d043b45f5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.15

Security for definder 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page