di / pip-api

An unofficial, importable pip API
https://pypi.org/p/pip-api
Apache License 2.0
110 stars 15 forks source link

Feature Request: `parse_pipfile` function #47

Open malikoth opened 4 years ago

malikoth commented 4 years ago

With adoption increasing for Pipfile based dependency declaration, it would be great if this library could parse a Pipfile as well. Nice thing is that since a Pipfile doesn't support nested files like requirements.txt does, and the format of the file is just TOML, it should be a fairly short function that just reuses a lot of the existing functionality.

If this seems reasonable scope for this project, I'll happily submit a PR with it. :)

di commented 4 years ago

Hi @malikoth, thanks for the feature request.

The purpose of this package to providing a drop-in replacement for existing uses of pip's internal API by wrapping command-line calls to pip. To my knowledge, pip doesn't currently support parsing a Pipfile so there is no equivalent function or class one could import from pip which provides this functionality, so there's nothing for us to replace or wrap.

I think if pip ever begins supporting installing from a Pipfile, there probably would be a need for something like pip_api.parse_pipfile, but until then there's not much to do here I think.

If you just want to be able to parse a Pipfile, I think this project is probably the wrong place for that functionality, and maybe https://pypi.org/project/pipfile/ would make more sense.

malikoth commented 4 years ago

Fair enough. I'd been thinking that parse_requirements was more of a feature of this project than a wrapper around pip itself; my bad.

That being said, the Pipfile project does say

Pip Integration (eventual) ++++++++++++++++++++++++++ pip_ will grow a new command line options, -p / --pipfile to install the versions as specified in a Pipfile, similar to its existing -r / --requirement argument for installing requirements.txt files.

In that hypothetical eventual future, maybe we will be adding this in the future. :)

di commented 4 years ago

Yep! I expect pip to gain this support eventually, so I'll leave this issue open until then.

malikoth commented 4 years ago

Or feel free to close, and reopen when / if appropriate.