Skip to content

Conversation

@akx
Copy link
Member

@akx akx commented Dec 25, 2025

Fixes #1237

Closes #1238 (supersedes it)

@akx
Copy link
Member Author

akx commented Dec 25, 2025

WDYT @bartfeenstra?

@akx akx requested a review from Copilot December 25, 2025 15:47
@akx akx added this to the Babel 2.18 milestone Dec 25, 2025
@codecov
Copy link

codecov bot commented Dec 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.05%. Comparing base (c5fb390) to head (8809d57).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1242   +/-   ##
=======================================
  Coverage   92.05%   92.05%           
=======================================
  Files          27       27           
  Lines        4680     4682    +2     
=======================================
+ Hits         4308     4310    +2     
  Misses        372      372           
Flag Coverage Δ
macos-14-3.10 91.09% <100.00%> (+<0.01%) ⬆️
macos-14-3.11 91.02% <100.00%> (+<0.01%) ⬆️
macos-14-3.12 91.24% <100.00%> (+<0.01%) ⬆️
macos-14-3.13 91.24% <100.00%> (+<0.01%) ⬆️
macos-14-3.14 91.22% <100.00%> (+<0.01%) ⬆️
macos-14-3.8 90.95% <100.00%> (+<0.01%) ⬆️
macos-14-3.9 91.02% <100.00%> (+<0.01%) ⬆️
macos-14-pypy3.10 91.09% <100.00%> (+<0.01%) ⬆️
ubuntu-24.04-3.10 91.11% <100.00%> (+<0.01%) ⬆️
ubuntu-24.04-3.11 91.05% <100.00%> (+<0.01%) ⬆️
ubuntu-24.04-3.12 91.26% <100.00%> (+<0.01%) ⬆️
ubuntu-24.04-3.13 91.26% <100.00%> (+<0.01%) ⬆️
ubuntu-24.04-3.14 91.24% <100.00%> (+<0.01%) ⬆️
ubuntu-24.04-3.8 90.98% <100.00%> (+<0.01%) ⬆️
ubuntu-24.04-3.9 91.04% <100.00%> (+<0.01%) ⬆️
ubuntu-24.04-pypy3.10 91.11% <100.00%> (+<0.01%) ⬆️
windows-2022-3.10 91.10% <100.00%> (+<0.01%) ⬆️
windows-2022-3.11 91.04% <100.00%> (+<0.01%) ⬆️
windows-2022-3.12 91.25% <100.00%> (+<0.01%) ⬆️
windows-2022-3.13 91.25% <100.00%> (+<0.01%) ⬆️
windows-2022-3.14 91.23% <100.00%> (+<0.01%) ⬆️
windows-2022-3.8 91.07% <100.00%> (+<0.01%) ⬆️
windows-2022-3.9 91.03% <100.00%> (+<0.01%) ⬆️
windows-2022-pypy3.10 91.10% <100.00%> (+<0.01%) ⬆️

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 a new public API function babel.core.get_cldr_version() that returns the Unicode CLDR version used by the Babel installation. The implementation extracts the version from the CLDR DTD file during the import process and makes it accessible at runtime.

Key changes:

  • Adds get_cldr_version() function to return CLDR version as a string
  • Extracts CLDR version from ldml.dtd file during CLDR data import
  • Updates type definitions to include cldr_version as a valid global key

Reviewed changes

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

File Description
babel/core.py Adds the get_cldr_version() function and updates the _GLOBAL_KEY type alias to include "cldr_version"
scripts/import_cldr.py Extracts CLDR version from DTD file using regex and stores it in global data
docs/api/core.rst Adds documentation reference for the new function
tests/test_core.py Adds test to verify the function returns the expected CLDR version "47"

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

@akx akx force-pushed the declare-cldr-version branch from 2b0260b to cb4fcf2 Compare December 25, 2025 15:56
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 4 out of 4 changed files in this pull request and generated 1 comment.


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

@akx akx marked this pull request as ready for review December 25, 2025 16:02
def get_cldr_version() -> str:
"""Return the Unicode CLDR version used by this Babel installation.
Generally, you should be able to assume that the return value of this

Choose a reason for hiding this comment

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

What other values can it have?

Copy link
Member Author

Choose a reason for hiding this comment

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

Honestly, I'm pre-planning for a downstream distro to do something weird here like "27+deb1". 😀

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.

Declare the CLDR version

3 participants