Skip to content

Add framework for enumerating installed Python files#728

Open
cottsay wants to merge 3 commits intomasterfrom
cottsay/pydist
Open

Add framework for enumerating installed Python files#728
cottsay wants to merge 3 commits intomasterfrom
cottsay/pydist

Conversation

@cottsay
Copy link
Copy Markdown
Member

@cottsay cottsay commented Mar 12, 2026

In order for colcon to consume wheels produced by PEP 517 build backends, we'll need to explicitly uninstall existing Python packages from the install space. This primarily stems from the differences in metadata representation, where the previous setuptools-only Python build mechanisms wrote .egg-link and .egg-info metadata, and wheels will use .dist-info metadata.

There should be only one metadata representation in the install space for a given package. The legacy setuptools build logic already has a special case for dealing with a switch from .egg-info to .egg-link and vice-versa. As we toss .dist-info into the mix, the need arises for a more robust solution.

This new functionality is not currently used by colcon, but will be used as part of the transition to standards-based Python build support.

Note

This looks like a lot of code. While it isn't a trivial change, all but one of the files are tests, and even that one file contains a significant amount of boilerplate for integrating with the importlib.metadata mechanisms for distribution discovery.
It's well-tested and thoroughly implemented because it will be a critical component of colcon's standards-based Python package building infrastructure.

@cottsay cottsay self-assigned this Mar 12, 2026
@cottsay cottsay added the enhancement New feature or request label Mar 12, 2026
@cottsay cottsay force-pushed the cottsay/pydist branch 2 times, most recently from a5f80e3 to 61f6e8d Compare March 12, 2026 04:03
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 12, 2026

Codecov Report

❌ Patch coverage is 93.60465% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.26%. Comparing base (d05b175) to head (98ada1b).

Files with missing lines Patch % Lines
colcon_core/python_project/distribution.py 93.60% 8 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #728      +/-   ##
==========================================
+ Coverage   87.00%   87.26%   +0.26%     
==========================================
  Files          69       70       +1     
  Lines        4093     4265     +172     
  Branches      707      752      +45     
==========================================
+ Hits         3561     3722     +161     
- Misses        421      429       +8     
- Partials      111      114       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cottsay cottsay force-pushed the cottsay/pydist branch 6 times, most recently from 8ea0acb to 0e441a9 Compare March 12, 2026 18:34
@cottsay cottsay marked this pull request as ready for review March 12, 2026 18:39
In order for colcon to consume wheels produced by PEP 517 build
backends, we'll need to explicitly uninstall existing Python packages
from the install space. This primarily stems from the differences in
metadata representation, where the previous setuptools-only Python build
mechanisms wrote `.egg-link` and `.egg-info` metadata, and wheels will
use `.dist-info` metadata.

There should be only one metadata representation in the install space
for a given package. The legacy setuptools build logic already has a
special case for dealing with a switch from `.egg-info` to `.egg-link`
and vice-versa. As we toss `.dist-info` into the mix, the need arises
for a more robust solution.

This new functionality is not currently used by colcon, but will be used
as part of the transition to standards-based Python build support.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

1 participant