Skip to content

pipenv requirements sub-command based on Pipfile #6130

@RicNord

Description

@RicNord

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Contributor CandidateThe issue has been identified/triaged and contributions are welcomed/encouraged.Type: Enhancement 💡This is a feature or enhancement request.good first issueIssues suitable as a newcomer to get familiar with Pipenv!

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions