Johnnydep: Python Dependency Tree Viewer
Johnnydep is a Python tool designed to display the dependency tree of Python distribution packages in a clear, tree-like structure. It helps developers efficiently manage project dependencies by visualizing all required components and their version constraints. The current version is 1.20.6, and it sees active development with frequent minor releases to support new `pip` versions and fix regressions.
Common errors
-
johnnydep: command not found
cause The `johnnydep` command-line tool is not installed, or your system's PATH environment variable does not include the directory where `pip` installs scripts.fixEnsure `johnnydep` is installed by running `pip install johnnydep`. If it's installed but still not found, confirm your `pip` script directory is in your PATH. On some systems, you might need to run `python -m johnnydep` instead of just `johnnydep`. -
TypeError: 'str' object is not callable
cause This error can occur in programmatic usage if your code expects `JohnnyDist.console_scripts` (or similar entry point attributes) to be a string that can be called or split, but it is now a list.fixUpdate your code to treat `JohnnyDist.console_scripts` as a list of strings, as its behavior changed in version 1.20.0. Iterate over the list or use `','.join(my_dist.console_scripts)` if you need a string representation. -
packaging.version.InvalidVersion: Invalid version: '22.0.post0' (or similar errors during metadata parsing)
cause This specific error, or similar metadata parsing issues, can occur if an incompatible `packaging` library version is installed, particularly `packaging==22.0`, which was blacklisted by `johnnydep==1.20.1` due to a bug.fixUpgrade your `packaging` library: `pip install --upgrade packaging`. If the issue persists, ensure `johnnydep` itself is up-to-date: `pip install --upgrade johnnydep`.
Warnings
- breaking The `dist.console_scripts` attribute, used for programmatic access to console script entry points, changed its return type from a comma-separated string to a `list` of strings in version 1.20.0.
- gotcha Johnnydep has had compatibility issues with specific `pip` versions, requiring updates. For instance, v1.20.5 added support for `pip>24`, and v1.20.4 fixed a regression with `pip 23.3`.
- gotcha Version 1.20.1 blacklisted `packaging v22.0` due to an internal bug in that `packaging` release which could cause `johnnydep` to fail.
Install
-
pip install johnnydep
Imports
- JohnnyDist
from johnnydep.lib import JohnnyDist
- gen_tree
from johnnydep.lib import gen_tree
- gen_table
from johnnydep.lib import gen_table
- flatten_deps
from johnnydep.lib import flatten_deps
Quickstart
johnnydep requests