py-unpack

Crates.iopy-unpack
lib.rspy-unpack
version0.1.0
sourcesrc
created_at2024-04-10 20:39:28.259591
updated_at2024-04-10 20:39:28.259591
descriptionUnpack is a simple, fast and user-friendly tool to analyze python project packaging.
homepagehttps://github.com/bnkc/unpack
repositoryhttps://github.com/bnkc/unpack
max_upload_size
id1203986
size719,048
Lev Ostatnigrosh (bnkc)

documentation

README

Logos logo

Unpack

CI License: MIT

Unpack python packages from your project and more.

Unpack has a few goals:

  • To easily navigate and remove used, unused, and untracked python packages.
  • To quickly identify disk usage of packages in the above categories.
  • To view the relationship between various packages and their dependencies.

To achieve those, Unpack:

  • Collects all project imports by walking the abstract syntax tree.
  • Collects all declared dependencies from the dependency specification file.
  • Maps local environment site-packages to resolve dependencies and the imports they expose.
  • Identifies local site-package dependencies as to not accidently remove actively used dependencies of other packages.
  • Calculates package(s) size, and total disk usage.

Package States

  • -used is when the package is locally installed, one of it's aliases is actively used in the project, and a corresponding dependency is declared in pyproject.toml or requirements.txt. This state indicates a fully integrated and properly managed package.

  • -unused is when the package is locally installed, and a corresponding dependency is declared in pyproject.toml or requirements.txt, but is not actively used in the project. Caveat: This package must not be a dependency of any actively -used package to be considered unused.

  • -untracked is when the package is installed, and one of it's aliases is actively used in the project, but is not declared in pyproject.toml or requirements.txt. This highlights packages that are implicitly used but not formally declared, which may lead to inconsistencies or issues in dependency management and deployment.

Demo

 📦 Unused Packages

 package      | version      | size     
--------------+--------------+----------
 scikit-learn | ^1.4.1.post1 | 46.9 MiB 
 keras        | ^3.0.5       | 8.8 MiB  
 pydantic     | ^1.9.0       | 3.1 MiB  

 💽 Total disk space: 58.9 MiB

 Note: There might be false-positives.
       For example, unpack cannot detect usage of packages that are not imported under `[tool.poetry.*]`.
       Similarly, it can only detect declared packages in requirements.txt or pyproject.toml.
Commit count: 204

cargo fmt