Skip to content

Support outputting pip-compile in a structured format (e.g. json) #1377

Open
@cjerdonek

Description

@cjerdonek

It would be useful if, in addition to the requirements.txt format, pip-compile also had the option of outputting the requirements and what it knows about each requirement in a standard format like json. This would give users much greater ability to create custom requirements.txt files, without having to rely on fragile parsing of pip-compile's requirements.txt output.

The structured data could include things like:

  • for each requirement:
    • the "via" values in a structured format
    • the requirement's hashes (for --generate-hashes), as well as distinguishing the "exact" hash (e.g. for Provide a way to limit to a single hash per requirement when generating hashes #1330)
    • whether the requirement is "safe" in the sense of --allow-unsafe. This would give users more control over how unsafe requirements should be handled.
    • whether the requirement is hashable or editable. This would let users e.g. split off non-hashable dependencies into a separate file that doesn't use hashes.
    • the annotation line(s) as constructed by pip-compile (for convenience, since these would also be constructible manually from other data)
    • the requirement line(s) as constructed by pip-compile (for convenience, if the user would like to include them as is)

This feature would give users a way to address a number of issues in this tracker, in the absence of a fix in pip-tools. Here is a partial list:

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureRequest for a new featurewriterRelated to results output writer component

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions