Skip to content

Conversation

@alexander-alderman-webb
Copy link
Contributor

@alexander-alderman-webb alexander-alderman-webb commented Nov 7, 2025

Description

Normalize package identifiers according to https://peps.python.org/pep-0503/#normalized-names when getting a package version.

Fixes the huggingface-hub test suite, which fails because the identifier returned by importlib.metadata changed. To confirm

pip install "huggingface-hub==1.0.1"

and then run

>>> from importlib import metadata
>>> [dist.metadata.get("Name", None) for dist in metadata.distributions()]

in the interpreter, you should have a huggingface-hub in the list. If you instead install "huggingface-hub==1.1.2" and follow the steps above, you instead see huggingface_hub.

Issues

Reminders

@codecov
Copy link

codecov bot commented Nov 7, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
27838 1 27837 2207
View the top 1 failed test(s) by shortest run time
tests.tracing.test_decorator::test_trace_decorator_async_no_trx
Stack Traces | 0.044s run time
tests/tracing/test_decorator.py:81: in test_trace_decorator_async_no_trx
    fake_debug.assert_called_once_with(
.../hostedtoolcache/Python/3.14.0.../x64-freethreaded/lib/python3.14t/unittest/mock.py:996: in assert_called_once_with
    raise AssertionError(msg)
E   AssertionError: Expected 'mock' to be called once. Called 3 times.
E   Calls: [call('[Monitor] health check negative, downsampling with a factor of %d', 10),
E    call('Cannot create a child span for %s. Please start a Sentry transaction before calling this function.', 'time.sleep'),
E    call('Cannot create a child span for %s. Please start a Sentry transaction before calling this function.', 'test_decorator.my_async_example_function')].

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@alexander-alderman-webb alexander-alderman-webb changed the title [do not merge]: generate tox tests(huggingface): Avoid None version Nov 7, 2025
@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review November 10, 2025 07:19
@alexander-alderman-webb alexander-alderman-webb requested a review from a team as a code owner November 10, 2025 07:19
@alexander-alderman-webb alexander-alderman-webb marked this pull request as draft November 10, 2025 07:34
Comment on lines +1763 to +1766
def _replace_hyphens_dots_and_underscores_with_dashes(name):
# type: (str) -> str
# https://peps.python.org/pep-0503/#normalized-names
return re.sub(r"[-_.]+", "-", name)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Initially I changed _normalize_module_name, but I'm worried that could change the identifiers in the list set by the ModulesIntegration.

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.

2 participants