Skip to content

Conversation

cottsay
Copy link
Member

@cottsay cottsay commented Sep 22, 2025

It appears that the distlib parsing function we're using here can't handle inline comments and raises a syntax error. After digging into the setuptools sources, it appears that these comments are dropped between parsing the file and parsing the individual dependencies, so we can do the same.

Needed to support syntax like this:
https://github.com/ros-infrastructure/rosdoc2/blob/d65d85509289d053a75bf69b1cfd4a9cca355cbc/setup.cfg#L56-L57

Hints for similar investigations:
https://github.com/pypa/setuptools/blob/9c4d383631d3951fcae0afd73b5d08ff5a262976/setuptools/dist.py#L399-L405
https://github.com/pypa/setuptools/blob/9c4d383631d3951fcae0afd73b5d08ff5a262976/setuptools/_reqs.py#L29
https://github.com/jaraco/jaraco.text/blob/10d49b85f8060bdfd64fa594bfd73a1356aab7e3/jaraco/text/__init__.py#L569-L581

It appears that the distlib parsing function we're using here can't
handle inline comments and raises a syntax error. After digging into the
setuptools sources, it appears that these comments are dropped between
parsing the file and parsing the individual dependencies, so we can do
the same.
@cottsay cottsay self-assigned this Sep 22, 2025
@cottsay cottsay added the bug Something isn't working label Sep 22, 2025
@cottsay cottsay added this to the 0.20.1 milestone Sep 22, 2025
@cottsay cottsay linked an issue Sep 22, 2025 that may be closed by this pull request
Copy link

codecov bot commented Sep 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.08%. Comparing base (a56aed4) to head (5e82525).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #708   +/-   ##
=======================================
  Coverage   87.08%   87.08%           
=======================================
  Files          69       69           
  Lines        4081     4082    +1     
  Branches      704      704           
=======================================
+ Hits         3554     3555    +1     
  Misses        417      417           
  Partials      110      110           

☔ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

End-of-line comments in setup.cfg are not removed during parsing
1 participant