Closed reynoldsnlp closed 1 year ago
I'm not sure handling URLs (pip install git+https://github.com/user/pkg.git
) is reasonable, but if pip
has a function for that, it would be nice.
@ncoghlan @pfmoore @pradyunsg I need to get the distribution name from whatever argument is given after pip install
, and I assume that pip internals would have a function that would do a better job than mine.
I poked around and found a regular expression for parsing whl
filenames that I implemented here but I wasn't able to find where in pip
's code a requirement specifier like my-pkg~=3.2.1
is parsed into distribution name, version, etc.
You want packaging.requirement.Requirement for things that aren't direct paths.
For filesystem paths, you either get a file or a directory. For files, there's packaging.utils functions for parsing wheel and sdist names. For directories, there's no way to know the package name without doing a build.
Converting
whl
filenames and requirement specifiers to distribution names is working, but I suspect thatpip
has more robust functions that we can import and use.