pypa / pipenv

Python Development Workflow for Humans.

Home Page:https://pipenv.pypa.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pipenv requirements sub-command based on Pipfile

RicNord opened this issue · comments

Is your feature request related to a problem? Please describe.

I develop both projects which purpose is applications (where I want to pin all dependencies) and libraries (were I do not want to pin my dependencies, since it has to be in an environment with other packages selected by the developer whom also want to use my library, without causing a conflict).

It would be fantastic if I could use pipenv for both of these purposes. And the only feature missing from pipenv is currently the ability to generate a requierments.txt file with only the root of the dependency tree. That can be referenced as a list of dependencies when building my package python -m build and various CI and development workflows. So to clarify: what I would like to do is generate a file based on the content of the Pipfile, not the Pipfile.lock.

Example:

#Pipfile
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
requests = "*"
pydantic = "==1.10.14"

[style]
ruff = "<=0.3.5"

Draft of desired output:

$ pipenv requirements --NEW_OPTION
requests
pydantic==1.10.14

$ pipenv requirements --NEW_OPTION --categories style
ruff<=0.3.5

I need to have the option of installing packages from a requirements.txt file. And with this new proposed feature I do not need to maintain the package dependencies in more than one place when changes happens and risk them being out of sync with each-other. I can simply have this command being ran in a pipeline or similar and fellow developers/CI-runners whom might not have pipenv installed can also use my project.

I also use these requirements.txt files for dynamic specification of requirements in setuptools.

Describe the solution you'd like

I would like an additional flag added to the pipenv requirements sub-command that reads from the Pipfile, not the Pipfile.lock and only takes the root packages of the dependency tree into account.

Describe alternatives you've considered

Developing a new application to support this scenario. With help of pkg_resources, however the API is "deprecated". And I would like to avoid introducing additional dependencies.

pip does not support anything similar as well.

Additional context

N/A

@matteius @RicNord Hi there! May I deep dive on this issue if you don't mind? Have a great day:)

@sanspareilsmyn feel free to open a pull request with the request feature