definder


Namedefinder JSON
Version 0.1.2 PyPI version JSON
download
home_pageNone
SummaryA fast Python dependency analyzer that automatically discovers and extracts third-party imports
upload_time2025-01-08 06:16:31
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseMIT
keywords analyzer dependency imports requirements
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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 📦

```bash
pip install depfinder
```

## Usage 🚀

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

```bash
# 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:
```bash
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](LICENSE)
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "definder",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "analyzer, dependency, imports, requirements",
    "author": null,
    "author_email": "linkedlist771 <213193509seu@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/48/e4/fc246d1620fc2b431fc435051189f80a554931d18806e4887d6c52aedd62/definder-0.1.2.tar.gz",
    "platform": null,
    "description": "# depfinder \ud83d\udd0d\n\nA 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.\n\n## Features \u2728\n\n- Follows Black's approach to traverse Python files\n- Smart package name resolution (e.g., `PIL` \u2192 `pillow`, `cv2` \u2192 `opencv-python`)\n- Filters out both standard library and project-internal imports\n- Handles common import name mismatches\n- Generates `requirements.txt` file\n- Parallel processing for faster scanning\n\n\u26a0\ufe0f Note: The tool may occasionally fail to identify some dependencies due to complex import patterns or dynamic imports.\n\n## Installation \ud83d\udce6\n\n```bash\npip install depfinder\n```\n\n## Usage \ud83d\ude80\n\nYou can use depfinder either as a module or directly as a command (like Black):\n\n```bash\n# As a command (recommended)\ndefinder src/\ndefinder .                    # Current directory\ndefinder src/ tests/         # Multiple paths\n\n# As a module\npython -m definder src/\npython -m definder .\n```\n\nOptions:\n```bash\ndefinder src/ --no-save     # Don't generate requirements file\ndefinder src/ --workers 4   # Specify number of parallel workers\n```\n\n## How it Works \ud83d\udee0\ufe0f\n\n1. Traverses Python files using Black's file discovery approach\n2. Uses AST parsing to safely extract imports\n3. Filters out standard library and project-internal imports\n4. Maps common import aliases to their correct PyPI package names\n5. Generates a clean requirements file\n\n## Output \ud83d\udcdd\n\nThe tool will:\n1. Show all scanned files\n2. List discovered third-party dependencies\n3. Generate a `requirements.txt` file (or `requirements-definder.txt` if the former exists)\n\n## Known Limitations \ud83d\udea7\n\n- May not detect dependencies from dynamic imports\n- Some complex import patterns might be missed\n- Package name mapping might not cover all cases\n\n## Contributing \ud83e\udd1d\n\nFound a bug or want to improve the package name mapping? Contributions are welcome! Please feel free to submit a Pull Request.\n\n## License \ud83d\udcc4\n\n[MIT](LICENSE)",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A fast Python dependency analyzer that automatically discovers and extracts third-party imports",
    "version": "0.1.2",
    "project_urls": {
        "Homepage": "https://github.com/linkedlist771/definder",
        "Repository": "https://github.com/linkedlist771/definder.git"
    },
    "split_keywords": [
        "analyzer",
        " dependency",
        " imports",
        " requirements"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "44cc65404cc092886c3c6898b9f71c9982e421690f03cf5a29a736d043b45f5c",
                "md5": "d2b12b51ce9fc37ab65bc9eb439f1fe0",
                "sha256": "a0dffa4d5c3dcbf9cd7dc7eda8810eb4c65a50edc089d55ecca11fb59a961d77"
            },
            "downloads": -1,
            "filename": "definder-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d2b12b51ce9fc37ab65bc9eb439f1fe0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 10175,
            "upload_time": "2025-01-08T06:16:28",
            "upload_time_iso_8601": "2025-01-08T06:16:28.707600Z",
            "url": "https://files.pythonhosted.org/packages/44/cc/65404cc092886c3c6898b9f71c9982e421690f03cf5a29a736d043b45f5c/definder-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "48e4fc246d1620fc2b431fc435051189f80a554931d18806e4887d6c52aedd62",
                "md5": "f1e9a781c2f6d247acd056125f99b88b",
                "sha256": "48f4e59611a9c61886c1367c7e0696ea211daa386896481ac9b1392decf1c5eb"
            },
            "downloads": -1,
            "filename": "definder-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "f1e9a781c2f6d247acd056125f99b88b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 10293,
            "upload_time": "2025-01-08T06:16:31",
            "upload_time_iso_8601": "2025-01-08T06:16:31.368737Z",
            "url": "https://files.pythonhosted.org/packages/48/e4/fc246d1620fc2b431fc435051189f80a554931d18806e4887d6c52aedd62/definder-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-08 06:16:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "linkedlist771",
    "github_project": "definder",
    "github_not_found": true,
    "lcname": "definder"
}
        
Elapsed time: 0.53436s