There’s an interesting library available, that lists s. We’ll cover just the basics here, but I encourage you to explore it in more more depth on your own.
The johnnydep library
You can simply install it with pip install johnnydep.
Then, if you want to get the list of dependencies of latest version of i.e Django library, you can call it with:
| |
and it will output:
| |
Or you can specify the library’s version as well:
| |
and it will list the dependencies for that version:
| |
List dependencies of all libraries in your project
Let’s first activate the virtualenv or your project:
| |
List dependencies of installed version of each library
Ok. Now, if you want to list the libraries of your entire project, you can call:
| |
where pip freeze lists all installed libraries with their versions (1 library per line) and the -n1 parameter of xargs command ensures that it will feed 1 line at a time to the johnnydep library. This will list the dependencies of all libraries in you project, for the versions that you use.
List dependencies of the latest version of each library
You can also list all the dependencies of the latest versions of all of the libraries from your project, by calling:
| |
The awk -F "==" '{print $1}' will split the e.g. Django==4.0.3 into Django and 4.0.3 and will pass only the first value to the johnnydep library.