Skip to content

PEP 751 support#888

Merged
woodruffw merged 9 commits into
mainfrom
ww/pep-751
Apr 7, 2025
Merged

PEP 751 support#888
woodruffw merged 9 commits into
mainfrom
ww/pep-751

Conversation

@woodruffw

@woodruffw woodruffw commented Apr 2, 2025

Copy link
Copy Markdown
Member

WIP.

Some scattered thoughts:

  • Right now this adds a --locked flag to enable lockfile collection. Does this make sense? Should it happen by default instead, taking priority over pyproject.toml when present?
  • Right now this collects all pylock.*.toml files by default, not just the generic one or a particular service-specific one. Does this make sense? Should --locked take a value to control this, e.g. --locked=all for the current behavior and --locked=<service> for just pylock.<service>.toml?
  • This only checks [[packages]]. I need to do another closer read of PEP 751 to understand if there are other parts of the file we should collect from. Checked, and packages should be the only part.
  • This doesn't perform any deduplication at the moment, i.e. foo==1.2.3 will be audited multiple times if specified in multiple lockfiles or multiple times in the same file (which the PEP allows). This probably won't happen often but I should probably add that deduplication, similarly to how requirements.txt inputs are handled. This is moot, since deduplication is done at the audit layer.
  • This currently skips any package that doesn't have a version. I think this is probably the right behavior, but perhaps it should be stricter, i.e. skip if it's a non-sdist/wheel but fail/warn if an sdist or wheel is missing a version?

Signed-off-by: William Woodruff william@trailofbits.com

Signed-off-by: William Woodruff <william@trailofbits.com>
Signed-off-by: William Woodruff <william@trailofbits.com>
Signed-off-by: William Woodruff <william@trailofbits.com>
@woodruffw woodruffw added enhancement New feature or request component:dep-sources Dependency sources labels Apr 2, 2025
@woodruffw woodruffw self-assigned this Apr 2, 2025
Signed-off-by: William Woodruff <william@trailofbits.com>
Signed-off-by: William Woodruff <william@trailofbits.com>
Signed-off-by: William Woodruff <william@trailofbits.com>
Signed-off-by: William Woodruff <william@trailofbits.com>
Signed-off-by: William Woodruff <william@trailofbits.com>
@woodruffw
woodruffw marked this pull request as ready for review April 4, 2025 21:19
@woodruffw woodruffw changed the title WIP: PEP 751 support PEP 751 support Apr 4, 2025
@woodruffw
woodruffw requested a review from di April 4, 2025 21:30
Comment thread pip_audit/_dependency_source/pylock.py
Signed-off-by: William Woodruff <william@trailofbits.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:dep-sources Dependency sources enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants