python-package-audit


Namepython-package-audit JSON
Version 0.1.6 PyPI version JSON
download
home_pageNone
SummaryPython Package Audit is a lightweight static analysis tool designed to detect unused Python packages
upload_time2025-07-25 17:18:31
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseMIT
keywords python-package-audit package audit
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## <ins> Package Audit </ins>

Python Package Audit is a lightweight static analysis tool designed to detect unused Python packages <br>

*Warning - Ignored directories starting with "." or "_" !* <br>
*Warning - Unused package detection is not guaranteed to be accurate !* <br>
*Warning -  It is highly recommended to review the results carefully before removing any packages !* <br>

### <ins> Features </ins>

- Scans Python files to detect all imported modules
- Maps import names to actual installed PyPI packages
- Tracks both direct and transitive dependencies
- Flags packages that are installed but unused
- Provides optional JSON output for automation pipelines
- Ignores common noise (E.G. folders starting with "." or "_")
- Multithreaded for fast analysis of large projects

### <ins> Installation </ins>

You can install this package via PIP: pip install python-package-audit <br>

### <ins> Dependencies </ins>

This project requires the following Python packages:
- colorama — For colored terminal output
- pipdeptree — For analyzing package dependency trees

### <ins> Usage </ins>

python -m pkgaudit --project "/path/to/your/project-root-directory" <br>

### <ins> JSON Output </ins>

python -m pkgaudit --project "/path/to/your/project-root-directory" --json <br>

### <ins> Output - Text </ins>

```
[Installed Packages (28)]
build
certifi
charset-normalizer
colorama
docutils
id
idna
jaraco.classes
jaraco.context
jaraco.functools
keyring
markdown-it-py
mdurl
more-itertools
nh3
packaging
pipdeptree
pygments
pyproject_hooks
python-package-audit
pywin32-ctypes
readme_renderer
requests
requests-toolbelt
rfc3986
rich
twine
urllib3

[Used Packages (14)]
Package: ast, Count: 1, Resolve: None
Package: importlib, Count: 1, Resolve: None
Package: json, Count: 2, Resolve: None
Package: os, Count: 2, Resolve: None
Package: subprocess, Count: 1, Resolve: None
Package: sys, Count: 1, Resolve: None
Package: concurrent, Count: 1, Resolve: None
Package: threading, Count: 1, Resolve: None
Package: colorama, Count: 1, Resolve: colorama
Package: argparse, Count: 1, Resolve: None
Package: warnings, Count: 1, Resolve: None
Package: package_analyzer, Count: 2, Resolve: python-package-audit
Package: tempfile, Count: 1, Resolve: None
Package: unittest, Count: 2, Resolve: None

[Unused Packages (25)]
Package: mdurl, Resolve: mdurl
Package: nh3, Resolve: nh3
Package: markdown-it-py, Resolve: markdown-it-py
Package: requests-toolbelt, Resolve: requests-toolbelt
Package: jaraco.functools, Resolve: jaraco.functools
Package: id, Resolve: id
Package: twine, Resolve: twine
Package: charset-normalizer, Resolve: charset-normalizer
Package: rfc3986, Resolve: rfc3986
Package: jaraco.context, Resolve: jaraco.context
Package: pygments, Resolve: Pygments
Package: readme_renderer, Resolve: readme_renderer
Package: build, Resolve: build
Package: packaging, Resolve: packaging
Package: idna, Resolve: idna
Package: pywin32-ctypes, Resolve: pywin32-ctypes
Package: pyproject_hooks, Resolve: pyproject_hooks
Package: more-itertools, Resolve: more-itertools
Package: requests, Resolve: requests
Package: docutils, Resolve: docutils
Package: jaraco.classes, Resolve: jaraco.classes
Package: rich, Resolve: rich
Package: urllib3, Resolve: urllib3
Package: certifi, Resolve: certifi
Package: keyring, Resolve: keyring
```

### <ins> Output - JSON </ins>

```
{
    "installed_packages_count": 28,
    "used_packages_count": 14,
    "unused_packages_count": 25,
    "installed_packages": [
        "build",
        "certifi",
        "charset-normalizer",
        "colorama",
        "docutils",
        "id",
        "idna",
        "jaraco.classes",
        "jaraco.context",
        "jaraco.functools",
        "keyring",
        "markdown-it-py",
        "mdurl",
        "more-itertools",
        "nh3",
        "packaging",
        "pipdeptree",
        "pygments",
        "pyproject_hooks",
        "python-package-audit",
        "pywin32-ctypes",
        "readme_renderer",
        "requests",
        "requests-toolbelt",
        "rfc3986",
        "rich",
        "twine",
        "urllib3"
    ],
    "used_packages": {
        "argparse": {
            "count": 1,
            "resolve": null
        },
        "warnings": {
            "count": 1,
            "resolve": null
        },
        "package_analyzer": {
            "count": 2,
            "resolve": "python-package-audit"
        },
        "ast": {
            "count": 1,
            "resolve": null
        },
        "importlib": {
            "count": 1,
            "resolve": null
        },
        "json": {
            "count": 2,
            "resolve": null
        },
        "os": {
            "count": 2,
            "resolve": null
        },
        "subprocess": {
            "count": 1,
            "resolve": null
        },
        "sys": {
            "count": 1,
            "resolve": null
        },
        "concurrent": {
            "count": 1,
            "resolve": null
        },
        "threading": {
            "count": 1,
            "resolve": null
        },
        "colorama": {
            "count": 1,
            "resolve": "colorama"
        },
        "tempfile": {
            "count": 1,
            "resolve": null
        },
        "unittest": {
            "count": 2,
            "resolve": null
        }
    },
    "unused_packages": {
        "jaraco.context": {
            "resolve": "jaraco.context"
        },
        "markdown-it-py": {
            "resolve": "markdown-it-py"
        },
        "idna": {
            "resolve": "idna"
        },
        "readme_renderer": {
            "resolve": "readme_renderer"
        },
        "charset-normalizer": {
            "resolve": "charset-normalizer"
        },
        "urllib3": {
            "resolve": "urllib3"
        },
        "packaging": {
            "resolve": "packaging"
        },
        "build": {
            "resolve": "build"
        },
        "id": {
            "resolve": "id"
        },
        "rich": {
            "resolve": "rich"
        },
        "twine": {
            "resolve": "twine"
        },
        "rfc3986": {
            "resolve": "rfc3986"
        },
        "docutils": {
            "resolve": "docutils"
        },
        "pywin32-ctypes": {
            "resolve": "pywin32-ctypes"
        },
        "keyring": {
            "resolve": "keyring"
        },
        "mdurl": {
            "resolve": "mdurl"
        },
        "requests-toolbelt": {
            "resolve": "requests-toolbelt"
        },
        "jaraco.functools": {
            "resolve": "jaraco.functools"
        },
        "requests": {
            "resolve": "requests"
        },
        "certifi": {
            "resolve": "certifi"
        },
        "pygments": {
            "resolve": "Pygments"
        },
        "more-itertools": {
            "resolve": "more-itertools"
        },
        "pyproject_hooks": {
            "resolve": "pyproject_hooks"
        },
        "jaraco.classes": {
            "resolve": "jaraco.classes"
        },
        "nh3": {
            "resolve": "nh3"
        }
    },
    "errors": []
}
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "python-package-audit",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "python-package-audit, package, audit",
    "author": null,
    "author_email": "Omer Menashe <unspecified@mail.com>",
    "download_url": "https://files.pythonhosted.org/packages/97/e9/9c4fba6b81abf7f931460dc0c2151b119425c3f1a8e0687166a5a01d6a0f/python_package_audit-0.1.6.tar.gz",
    "platform": null,
    "description": "## <ins> Package Audit </ins>\r\n\r\nPython Package Audit is a lightweight static analysis tool designed to detect unused Python packages <br>\r\n\r\n*Warning - Ignored directories starting with \".\" or \"_\" !* <br>\r\n*Warning - Unused package detection is not guaranteed to be accurate !* <br>\r\n*Warning -  It is highly recommended to review the results carefully before removing any packages !* <br>\r\n\r\n### <ins> Features </ins>\r\n\r\n- Scans Python files to detect all imported modules\r\n- Maps import names to actual installed PyPI packages\r\n- Tracks both direct and transitive dependencies\r\n- Flags packages that are installed but unused\r\n- Provides optional JSON output for automation pipelines\r\n- Ignores common noise (E.G. folders starting with \".\" or \"_\")\r\n- Multithreaded for fast analysis of large projects\r\n\r\n### <ins> Installation </ins>\r\n\r\nYou can install this package via PIP: pip install python-package-audit <br>\r\n\r\n### <ins> Dependencies </ins>\r\n\r\nThis project requires the following Python packages:\r\n- colorama \u2014 For colored terminal output\r\n- pipdeptree \u2014 For analyzing package dependency trees\r\n\r\n### <ins> Usage </ins>\r\n\r\npython -m pkgaudit --project \"/path/to/your/project-root-directory\" <br>\r\n\r\n### <ins> JSON Output </ins>\r\n\r\npython -m pkgaudit --project \"/path/to/your/project-root-directory\" --json <br>\r\n\r\n### <ins> Output - Text </ins>\r\n\r\n```\r\n[Installed Packages (28)]\r\nbuild\r\ncertifi\r\ncharset-normalizer\r\ncolorama\r\ndocutils\r\nid\r\nidna\r\njaraco.classes\r\njaraco.context\r\njaraco.functools\r\nkeyring\r\nmarkdown-it-py\r\nmdurl\r\nmore-itertools\r\nnh3\r\npackaging\r\npipdeptree\r\npygments\r\npyproject_hooks\r\npython-package-audit\r\npywin32-ctypes\r\nreadme_renderer\r\nrequests\r\nrequests-toolbelt\r\nrfc3986\r\nrich\r\ntwine\r\nurllib3\r\n\r\n[Used Packages (14)]\r\nPackage: ast, Count: 1, Resolve: None\r\nPackage: importlib, Count: 1, Resolve: None\r\nPackage: json, Count: 2, Resolve: None\r\nPackage: os, Count: 2, Resolve: None\r\nPackage: subprocess, Count: 1, Resolve: None\r\nPackage: sys, Count: 1, Resolve: None\r\nPackage: concurrent, Count: 1, Resolve: None\r\nPackage: threading, Count: 1, Resolve: None\r\nPackage: colorama, Count: 1, Resolve: colorama\r\nPackage: argparse, Count: 1, Resolve: None\r\nPackage: warnings, Count: 1, Resolve: None\r\nPackage: package_analyzer, Count: 2, Resolve: python-package-audit\r\nPackage: tempfile, Count: 1, Resolve: None\r\nPackage: unittest, Count: 2, Resolve: None\r\n\r\n[Unused Packages (25)]\r\nPackage: mdurl, Resolve: mdurl\r\nPackage: nh3, Resolve: nh3\r\nPackage: markdown-it-py, Resolve: markdown-it-py\r\nPackage: requests-toolbelt, Resolve: requests-toolbelt\r\nPackage: jaraco.functools, Resolve: jaraco.functools\r\nPackage: id, Resolve: id\r\nPackage: twine, Resolve: twine\r\nPackage: charset-normalizer, Resolve: charset-normalizer\r\nPackage: rfc3986, Resolve: rfc3986\r\nPackage: jaraco.context, Resolve: jaraco.context\r\nPackage: pygments, Resolve: Pygments\r\nPackage: readme_renderer, Resolve: readme_renderer\r\nPackage: build, Resolve: build\r\nPackage: packaging, Resolve: packaging\r\nPackage: idna, Resolve: idna\r\nPackage: pywin32-ctypes, Resolve: pywin32-ctypes\r\nPackage: pyproject_hooks, Resolve: pyproject_hooks\r\nPackage: more-itertools, Resolve: more-itertools\r\nPackage: requests, Resolve: requests\r\nPackage: docutils, Resolve: docutils\r\nPackage: jaraco.classes, Resolve: jaraco.classes\r\nPackage: rich, Resolve: rich\r\nPackage: urllib3, Resolve: urllib3\r\nPackage: certifi, Resolve: certifi\r\nPackage: keyring, Resolve: keyring\r\n```\r\n\r\n### <ins> Output - JSON </ins>\r\n\r\n```\r\n{\r\n    \"installed_packages_count\": 28,\r\n    \"used_packages_count\": 14,\r\n    \"unused_packages_count\": 25,\r\n    \"installed_packages\": [\r\n        \"build\",\r\n        \"certifi\",\r\n        \"charset-normalizer\",\r\n        \"colorama\",\r\n        \"docutils\",\r\n        \"id\",\r\n        \"idna\",\r\n        \"jaraco.classes\",\r\n        \"jaraco.context\",\r\n        \"jaraco.functools\",\r\n        \"keyring\",\r\n        \"markdown-it-py\",\r\n        \"mdurl\",\r\n        \"more-itertools\",\r\n        \"nh3\",\r\n        \"packaging\",\r\n        \"pipdeptree\",\r\n        \"pygments\",\r\n        \"pyproject_hooks\",\r\n        \"python-package-audit\",\r\n        \"pywin32-ctypes\",\r\n        \"readme_renderer\",\r\n        \"requests\",\r\n        \"requests-toolbelt\",\r\n        \"rfc3986\",\r\n        \"rich\",\r\n        \"twine\",\r\n        \"urllib3\"\r\n    ],\r\n    \"used_packages\": {\r\n        \"argparse\": {\r\n            \"count\": 1,\r\n            \"resolve\": null\r\n        },\r\n        \"warnings\": {\r\n            \"count\": 1,\r\n            \"resolve\": null\r\n        },\r\n        \"package_analyzer\": {\r\n            \"count\": 2,\r\n            \"resolve\": \"python-package-audit\"\r\n        },\r\n        \"ast\": {\r\n            \"count\": 1,\r\n            \"resolve\": null\r\n        },\r\n        \"importlib\": {\r\n            \"count\": 1,\r\n            \"resolve\": null\r\n        },\r\n        \"json\": {\r\n            \"count\": 2,\r\n            \"resolve\": null\r\n        },\r\n        \"os\": {\r\n            \"count\": 2,\r\n            \"resolve\": null\r\n        },\r\n        \"subprocess\": {\r\n            \"count\": 1,\r\n            \"resolve\": null\r\n        },\r\n        \"sys\": {\r\n            \"count\": 1,\r\n            \"resolve\": null\r\n        },\r\n        \"concurrent\": {\r\n            \"count\": 1,\r\n            \"resolve\": null\r\n        },\r\n        \"threading\": {\r\n            \"count\": 1,\r\n            \"resolve\": null\r\n        },\r\n        \"colorama\": {\r\n            \"count\": 1,\r\n            \"resolve\": \"colorama\"\r\n        },\r\n        \"tempfile\": {\r\n            \"count\": 1,\r\n            \"resolve\": null\r\n        },\r\n        \"unittest\": {\r\n            \"count\": 2,\r\n            \"resolve\": null\r\n        }\r\n    },\r\n    \"unused_packages\": {\r\n        \"jaraco.context\": {\r\n            \"resolve\": \"jaraco.context\"\r\n        },\r\n        \"markdown-it-py\": {\r\n            \"resolve\": \"markdown-it-py\"\r\n        },\r\n        \"idna\": {\r\n            \"resolve\": \"idna\"\r\n        },\r\n        \"readme_renderer\": {\r\n            \"resolve\": \"readme_renderer\"\r\n        },\r\n        \"charset-normalizer\": {\r\n            \"resolve\": \"charset-normalizer\"\r\n        },\r\n        \"urllib3\": {\r\n            \"resolve\": \"urllib3\"\r\n        },\r\n        \"packaging\": {\r\n            \"resolve\": \"packaging\"\r\n        },\r\n        \"build\": {\r\n            \"resolve\": \"build\"\r\n        },\r\n        \"id\": {\r\n            \"resolve\": \"id\"\r\n        },\r\n        \"rich\": {\r\n            \"resolve\": \"rich\"\r\n        },\r\n        \"twine\": {\r\n            \"resolve\": \"twine\"\r\n        },\r\n        \"rfc3986\": {\r\n            \"resolve\": \"rfc3986\"\r\n        },\r\n        \"docutils\": {\r\n            \"resolve\": \"docutils\"\r\n        },\r\n        \"pywin32-ctypes\": {\r\n            \"resolve\": \"pywin32-ctypes\"\r\n        },\r\n        \"keyring\": {\r\n            \"resolve\": \"keyring\"\r\n        },\r\n        \"mdurl\": {\r\n            \"resolve\": \"mdurl\"\r\n        },\r\n        \"requests-toolbelt\": {\r\n            \"resolve\": \"requests-toolbelt\"\r\n        },\r\n        \"jaraco.functools\": {\r\n            \"resolve\": \"jaraco.functools\"\r\n        },\r\n        \"requests\": {\r\n            \"resolve\": \"requests\"\r\n        },\r\n        \"certifi\": {\r\n            \"resolve\": \"certifi\"\r\n        },\r\n        \"pygments\": {\r\n            \"resolve\": \"Pygments\"\r\n        },\r\n        \"more-itertools\": {\r\n            \"resolve\": \"more-itertools\"\r\n        },\r\n        \"pyproject_hooks\": {\r\n            \"resolve\": \"pyproject_hooks\"\r\n        },\r\n        \"jaraco.classes\": {\r\n            \"resolve\": \"jaraco.classes\"\r\n        },\r\n        \"nh3\": {\r\n            \"resolve\": \"nh3\"\r\n        }\r\n    },\r\n    \"errors\": []\r\n}\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python Package Audit is a lightweight static analysis tool designed to detect unused Python packages",
    "version": "0.1.6",
    "project_urls": {
        "Source": "https://github.com/iamomerm/python-package-audit"
    },
    "split_keywords": [
        "python-package-audit",
        " package",
        " audit"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1497015e6aa01a20350b3b0bb28c6e345b67f76a8b09548437436261a9e45617",
                "md5": "51893a1fa56b4813706570e4bebb82e3",
                "sha256": "5ff20d4470644280d0fc6ccb7a68f42fc4e0645a9cbfccb00017395936cff47d"
            },
            "downloads": -1,
            "filename": "python_package_audit-0.1.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "51893a1fa56b4813706570e4bebb82e3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 6952,
            "upload_time": "2025-07-25T17:18:31",
            "upload_time_iso_8601": "2025-07-25T17:18:31.020233Z",
            "url": "https://files.pythonhosted.org/packages/14/97/015e6aa01a20350b3b0bb28c6e345b67f76a8b09548437436261a9e45617/python_package_audit-0.1.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "97e99c4fba6b81abf7f931460dc0c2151b119425c3f1a8e0687166a5a01d6a0f",
                "md5": "c9a420951032ffb96b5d60b206589bcd",
                "sha256": "3a0daef2d28ad1e83777333968c8598c995ade96ffacfaf93405c5902b02de05"
            },
            "downloads": -1,
            "filename": "python_package_audit-0.1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "c9a420951032ffb96b5d60b206589bcd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 7381,
            "upload_time": "2025-07-25T17:18:31",
            "upload_time_iso_8601": "2025-07-25T17:18:31.980078Z",
            "url": "https://files.pythonhosted.org/packages/97/e9/9c4fba6b81abf7f931460dc0c2151b119425c3f1a8e0687166a5a01d6a0f/python_package_audit-0.1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-25 17:18:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "iamomerm",
    "github_project": "python-package-audit",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "python-package-audit"
}
        
Elapsed time: 1.76235s