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

Separate and clearly document direct/transitive vendored dependencies with the help of pip-tools #4351

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

abravalheri
Copy link
Contributor

@abravalheri abravalheri commented May 9, 2024

The work in this PR was extracted from #4330.

Motivation

Right now it is a bit tricky to deal with the vendored packages:

  • The developer either have to manually pin down all the direct and transitive dependencies in vendored.txt or
  • There will be dependencies installed in the _vendor folder that are not listed in the vendored.txt file.
    • This makes it is hard to guess why they are there and to track the dependency chain...
    • It also make it possible for pkg_resources and setuptools to have different versions of the same vendored dependency. This is probably not nice for OS-level repackaging.

Summary of changes

The most relevant commit of this PR is b5e91c8.

It modifies tool/vendored so that:

  1. Transitive dependencies are automatically documented
    (so we don't loose track of what needs what).
    • This is done via pip-compile and vendored.in (direct dependencies)
      ==> vendored.txt. See 1a31ed1 and 20df694.
  2. Instead of a case-by-case import rewrite, all vendored imports are rewritten at once
    • Case-by-case workarounds were kept (e.g. intentionally delayed imports)
  3. Sync versions of vendored packages in pkg_resources and setuptools
    so that it is easier for "de-vendoring" (this is done via --constraint in pip).

I also added a base_python to the tox environment intended to match the lowest version of Python supported by setuptools, so that dependency markers are solved for a more general case.

The remaining of the changes are collateral.

No attempt to remove extern was made.

If reviewing this PR I recommend checking commit-by-commit to avoid the big blob of automatic changes related to running tox -e vendor.

Closes

Pull Request Checklist

@abravalheri abravalheri force-pushed the vendorized branch 3 times, most recently from 95863d3 to 25bbb00 Compare May 10, 2024 14:44
@abravalheri abravalheri marked this pull request as ready for review May 10, 2024 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant