Skip to content

Only enable line tracing when building with Cython tracing#660

Merged
bdraco merged 4 commits intomasterfrom
linetrace_fix
Jun 9, 2025
Merged

Only enable line tracing when building with Cython tracing#660
bdraco merged 4 commits intomasterfrom
linetrace_fix

Conversation

@bdraco
Copy link
Copy Markdown
Member

@bdraco bdraco commented Jun 9, 2025

What do these changes do?

Only enable line tracing when building with Cython tracing

This PR modifies the build backend to dynamically enable Cython line tracing only when explicitly requested via the with-cython-tracing=true config setting. Previously, having linetrace = "True" in pyproject.toml was causing build issues for users (#658) and makes our production wheels almost half as fast.

Now, line tracing is opt-in:

  • Regular builds: pip install . (no line tracing)
  • Tracing builds: pip install . --config-setting=with-cython-tracing=true (enables line tracing)

When tracing is requested, the build backend automatically adds the linetrace=True and profile=True Cython directives and sets the appropriate C compiler flags.

Are there changes in behavior for the user?

  • Regular users will no longer encounter build issues related to line tracing being enabled by default
  • Developers who need line tracing must now explicitly enable it using --config-setting=with-cython-tracing=true
  • The FROZENLIST_CYTHON_TRACING environment variable can also be used as an alternative to the config setting

Related issue number

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes

bdraco added 2 commits June 9, 2025 16:08
This PR modifies the build backend to dynamically enable Cython line tracing only when explicitly requested via the `with-cython-tracing=true` config setting. Previously, having `linetrace = "True"` in pyproject.toml was causing build issues for users (#658) and makes our production wheels almost half as fast.

Now, line tracing is opt-in:
- Regular builds: `pip install .` (no line tracing)
- Tracing builds: `pip install . --config-setting=with-cython-tracing=true` (enables line tracing)

When tracing is requested, the build backend automatically adds the `linetrace=True` and `profile=True` Cython directives and sets the appropriate C compiler flags.

<!-- Outline any notable behaviour for the end users. -->

- Regular users will no longer encounter build issues related to line tracing being enabled by default
- Developers who need line tracing must now explicitly enable it using `--config-setting=with-cython-tracing=true`
- The `YARL_CYTHON_TRACING` environment variable can also be used as an alternative to the config setting

<!-- Are there any issues opened that will be resolved by merging this change? -->
<!-- Remember to prefix with 'Fixes' if it should close the issue (e.g. 'Fixes #123'). -->

- [x] I think the code is well written
- [ ] Unit tests for the changes exist
- [ ] Documentation reflects the changes
@bdraco bdraco enabled auto-merge (squash) June 9, 2025 22:08
@codecov
Copy link
Copy Markdown

codecov bot commented Jun 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.21%. Comparing base (8c9d264) to head (9cc1241).
⚠️ Report is 23 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #660      +/-   ##
==========================================
+ Coverage   94.14%   94.21%   +0.07%     
==========================================
  Files          10       10              
  Lines         632      640       +8     
  Branches       46       46              
==========================================
+ Hits          595      603       +8     
  Misses         13       13              
  Partials       24       24              
Flag Coverage Δ
CI-GHA 94.06% <100.00%> (+0.07%) ⬆️
MyPy 73.07% <100.00%> (+0.37%) ⬆️
OS-Linux 99.60% <ø> (ø)
OS-Windows 99.60% <ø> (ø)
OS-macOS 99.20% <ø> (ø)
Py-3.10.11 99.60% <ø> (ø)
Py-3.10.17 99.60% <ø> (ø)
Py-3.11.12 99.60% <ø> (ø)
Py-3.11.9 99.60% <ø> (ø)
Py-3.12.10 99.60% <ø> (ø)
Py-3.13.3 99.60% <ø> (ø)
Py-3.13.4t 99.60% <ø> (ø)
Py-3.9.13 99.60% <ø> (ø)
Py-3.9.22 99.60% <ø> (ø)
Py-pypy7.3.16 98.41% <ø> (ø)
Py-pypy7.3.19 98.41% <ø> (ø)
VM-macos-latest 99.20% <ø> (ø)
VM-ubuntu-latest 99.60% <ø> (ø)
VM-windows-latest 99.60% <ø> (ø)
pytest 99.60% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant