Skip to content

Conversation

@akx
Copy link
Member

@akx akx commented Dec 30, 2025

This PR adds support for adding additional per-extractor keywords in addition to the default set.

Fixes #1224
Fixes #71 (yes, you read that right, a double-digit issue that had still been open)

@akx akx added this to the Babel 2.18 milestone Dec 30, 2025
@akx akx requested a review from Copilot December 30, 2025 10:17
@codecov
Copy link

codecov bot commented Dec 30, 2025

Codecov Report

❌ Patch coverage is 89.28571% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.05%. Comparing base (12a14b6) to head (62141d9).

Files with missing lines Patch % Lines
babel/messages/frontend.py 86.36% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1243      +/-   ##
==========================================
- Coverage   92.07%   92.05%   -0.03%     
==========================================
  Files          27       27              
  Lines        4692     4717      +25     
==========================================
+ Hits         4320     4342      +22     
- Misses        372      375       +3     
Flag Coverage Δ
macos-14-3.10 91.09% <89.28%> (-0.02%) ⬇️
macos-14-3.11 91.03% <89.28%> (-0.02%) ⬇️
macos-14-3.12 91.24% <89.28%> (-0.02%) ⬇️
macos-14-3.13 91.24% <89.28%> (-0.02%) ⬇️
macos-14-3.14 91.22% <89.28%> (-0.02%) ⬇️
macos-14-3.8 90.96% <89.28%> (-0.02%) ⬇️
macos-14-3.9 91.02% <89.28%> (-0.02%) ⬇️
macos-14-pypy3.10 91.09% <89.28%> (-0.02%) ⬇️
ubuntu-24.04-3.10 91.11% <89.28%> (-0.02%) ⬇️
ubuntu-24.04-3.11 91.05% <89.28%> (-0.02%) ⬇️
ubuntu-24.04-3.12 91.26% <89.28%> (-0.02%) ⬇️
ubuntu-24.04-3.13 91.26% <89.28%> (-0.02%) ⬇️
ubuntu-24.04-3.14 91.24% <89.28%> (-0.02%) ⬇️
ubuntu-24.04-3.8 90.98% <89.28%> (-0.02%) ⬇️
ubuntu-24.04-3.9 91.04% <89.28%> (-0.02%) ⬇️
ubuntu-24.04-pypy3.10 91.11% <89.28%> (-0.02%) ⬇️
windows-2022-3.10 91.10% <89.28%> (-0.02%) ⬇️
windows-2022-3.11 91.04% <89.28%> (-0.02%) ⬇️
windows-2022-3.12 91.25% <89.28%> (-0.02%) ⬇️
windows-2022-3.13 91.25% <89.28%> (-0.02%) ⬇️
windows-2022-3.14 91.23% <89.28%> (-0.02%) ⬇️
windows-2022-3.8 91.08% <89.28%> (-0.02%) ⬇️
windows-2022-3.9 91.03% <89.28%> (-0.02%) ⬇️
windows-2022-pypy3.10 91.10% <89.28%> (-0.02%) ⬇️

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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for specifying per-extractor keywords and auto_comments in mapping configuration files (both .cfg and .toml formats), fixing long-standing issues #1224 and #71 where keywords and comment tags specified in configuration files were being ignored.

Key changes:

  • Keywords and comment tags from mapping files are now parsed and merged with global settings during extraction
  • Both .cfg (INI-style) and .toml configuration formats are supported for these options
  • Per-file options override/merge with global command-line options appropriately

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
babel/messages/extract.py Adds logic to merge per-file keywords and comment tags with global settings before extraction
babel/messages/frontend.py Implements parsing of keywords and add_comments options from both CFG and TOML config formats
tests/messages/test_toml_config.py Adds unit tests for parsing keywords and add_comments from TOML configurations
tests/messages/frontend/test_extract.py Adds integration tests for end-to-end extraction with keywords and comments from config files
tests/messages/data/project/issue_1224_test.py Test fixture with translatable strings and special comments for validation
tests/messages/data/mapping_with_keywords_and_comments.toml TOML config file test fixture with keywords and add_comments options
tests/messages/data/mapping_with_keywords.cfg CFG config file test fixture with keywords option

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@akx akx requested a review from Copilot December 30, 2025 11:47
@akx akx marked this pull request as ready for review December 30, 2025 11:47
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

extract: keywords treated correctly as CLI args, but incorrect in pybabel.cfg babel.cfg keywords?

2 participants