Open
Description
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
- For example, if an annotation has an associated path, it can be included separately alongside as a relative path, and the base path can be included once at the top-level (see also Add an option to not include paths in annotations #1084).
- 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)
- the "via" values in a structured format
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:
- Provide a way to limit to a single hash per requirement when generating hashes #1330 ("Provide a way to limit to a single hash per requirement when generating hashes")
- Request: Compact annotations #1306 ("Compact annotations")
- pip-compile annotations should be relative to file they are in #1107 ("annotations should be relative to file they are in")
- Add an option to not include paths in annotations #1084 ("Add an option to not include paths in annotations")
- Ignore hashes for version control repositories #994 ("Ignore hashes for version control repositories")
- Allow to skip dependencies (
--no-deps
) for individual requirements #817 ("Allow to skip dependencies") - Include comments from input files in output file #391 ("Include comments from input files in output file")
- Exclude package? #333 ("Exclude package?")
- allow overriding/forcing a certain version #215 ("allow overriding/forcing a certain version")