Closed KennyChenBasis closed 1 year ago
Thanks, I checked the specs on package name normalization. https://peps.python.org/pep-0503/#normalized-names
I'd like to normalize the options that accept package names in pip-licenses
as well.
@KennyChenBasis We have shipped version 4.3.1, which fix this issue. https://pypi.org/project/pip-licenses/4.3.1/
Please check if it works as you expect using v4.3.1.
pip install pip-licenses=="4.3.1"
Looks like it works; thanks for the timely response and fix!
How do we list the licenses from requirements.txt?
pip-licenses -p requirements.txt
returns an empty list in venv even though those libraries are installed in venv.
pip-licenses -p requirements.txt
yields no results as there is no package requirements.txt
. From the description of the -p
parameter:
only include selected packages in output
So you would have to pass your desired packages by their name explicitly or find a Shell-specific way to extract the package names from your requirements file automatically.
pip
treats-
and_
as equivalent, butpip-licenses
differentiates between the two when using the-p
flag. Havingpip-licenses
also treat-
and_
as equivalent makes it easier to work with.In my particular use case, I have a venv that contains packages from a
requirements.txt
and also additional packages that I don't want licenses of. I then passed the packages in therequirements.txt
topip-licenses -p
and was surprised when the license fortyping-extensions
wasn't found. However, passingtyping_extensions
instead topip-licenses
works.requirements.txt
in this form can be created from, e.g.pipenv requirements
.