Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cjerdonek opened this issue Apr 7, 2021 · 4 comments · May be fixed by #2085
Open

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

cjerdonek opened this issue Apr 7, 2021 · 4 comments · May be fixed by #2085
Labels
feature Request for a new feature writer Related to results output writer component

Comments

@cjerdonek
Copy link

cjerdonek commented Apr 7, 2021

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:

@woodruffw
Copy link

This would potentially be useful for #1484 as well, although not strictly necessary!

For our purposes, a schema like this (at the absolute minimum) would be sufficient:

[
  {
    "name": "some-package-name",
    "version": "1.0.0",
  },
  ...
]

No particular order or other information would benefit our particular use case, but additional constraints wouldn't hurt us either!

@chaoflow
Copy link
Contributor

chaoflow commented Dec 1, 2022

  • filenames of all downloads for each version, along with hash for each filename
  • full dependency tree, what is pulled in why

Poetry has a poetry.lock. What other projects are there? Could we agree with them on for example a pyproject.lock to contain this information?

@con-f-use
Copy link

con-f-use commented Jun 1, 2023

As I said in the duplicate, I have a fork, that filthily hacks part of this. So my question is, would a proper implementation be welcome? Don't wanna put time into something, that will not be reviewed or is out of scope or that someone else is already closing in on.

@con-f-use
Copy link

@chrysle chrysle linked a pull request May 3, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Request for a new feature writer Related to results output writer component
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants