Skip to content

Rename format_full_version to _format_full_version to make it visibly private#1125

Merged
henryiii merged 3 commits intopypa:mainfrom
r266-tech:rename-format-full-version-private
Apr 9, 2026
Merged

Rename format_full_version to _format_full_version to make it visibly private#1125
henryiii merged 3 commits intopypa:mainfrom
r266-tech:rename-format-full-version-private

Conversation

@r266-tech
Copy link
Copy Markdown
Contributor

Fixes #504

Summary

The format_full_version() function in packaging/markers.py is not exposed via __all__, but its name doesn't indicate it's private. This PR renames it to _format_full_version() to make its internal nature explicit, as suggested by @brettcannon in the original issue.

Changes

  • Renamed format_full_version_format_full_version in src/packaging/markers.py
  • Updated import and test calls in tests/test_markers.py

Testing

All 2252 marker tests pass.

@henryiii
Copy link
Copy Markdown
Contributor

I can't quickly find any users of this, so I think it's safe to rename. We can always reintroduce with a deprecation warning if it breaks anything.

Linters expect the all list to be sorted, otherwise is fine, I think. (prek -a or nox -s lint locally should do it)

Copy link
Copy Markdown
Member

@brettcannon brettcannon left a comment

Choose a reason for hiding this comment

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

Please fix the linting issue.

@henryiii henryiii force-pushed the rename-format-full-version-private branch from daba1d9 to 4cc648b Compare March 27, 2026 13:55
@henryiii henryiii requested a review from brettcannon April 5, 2026 18:15
@henryiii henryiii force-pushed the rename-format-full-version-private branch from 4cc648b to fddbc95 Compare April 5, 2026 18:15
@r266-tech
Copy link
Copy Markdown
Contributor Author

The linting issue has been fixed (manually sorted imports). All CI checks are now passing — ready for re-review.

@henryiii henryiii force-pushed the rename-format-full-version-private branch from fddbc95 to c50336a Compare April 7, 2026 05:13
@henryiii henryiii mentioned this pull request Apr 7, 2026
OSC Contributor and others added 2 commits April 8, 2026 15:11
The function is not exposed in __all__ and is only used internally
by default_environment(). Renaming it with a leading underscore makes
its private nature explicit, addressing the ambiguity noted in pypa#504.
@henryiii henryiii force-pushed the rename-format-full-version-private branch from c50336a to 0b09416 Compare April 8, 2026 19:11
@henryiii henryiii merged commit 668da86 into pypa:main Apr 9, 2026
57 checks passed
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.

Document or rename markers.format_full_version()

3 participants