-
-
Notifications
You must be signed in to change notification settings - Fork 223
implement documentation fixups #1153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
RonnyPfannschmidt
merged 11 commits into
pypa:main
from
RonnyPfannschmidt:documentation-fixups
Jul 26, 2025
Merged
implement documentation fixups #1153
RonnyPfannschmidt
merged 11 commits into
pypa:main
from
RonnyPfannschmidt:documentation-fixups
Jul 26, 2025
+2,382
−98
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When setuptools-scm encounters a dirty working directory, it now uses the latest modification time of changed files instead of falling back to the current timestamp. This provides more meaningful version timestamps during local development. Changes: - Added get_dirty_tag_date() method to Git and Mercurial working directory classes - Enhanced timestamp logic in parsing functions to prioritize file mtimes - Updated documentation to explain new timestamp behavior - Maintains backward compatibility with clean repository behavior The logic flow is now: 1. Try to get node_date from HEAD commit 2. If that fails AND working directory is dirty, use latest file mtime 3. Only fall back to datetime.now() as last resort
Create get_latest_file_mtime() helper function in scm_workdir.py to eliminate code duplication across Git, Mercurial, and hybrid implementations. Changes: - Added get_latest_file_mtime() function to scm_workdir.py - Updated GitWorkdir.get_dirty_tag_date() to use shared helper - Updated HgWorkdir.get_dirty_tag_date() to use shared helper - Updated GitWorkdirHgClient.get_dirty_tag_date() to use shared helper - Removed duplicated mtime calculation logic from all implementations - Cleaned up unused imports (datetime/timezone in hg_git.py) This improves maintainability and ensures consistent behavior across all VCS implementations.
Break down the complex get_meta method into smaller, focused helper methods to improve readability and reduce cyclomatic complexity below the linting threshold. Changes: - Extract _get_node_info() for getting node/tags/date from hg log - Extract _get_branch_info() for getting branch/dirty status - Extract _get_node_date() for determining appropriate node date - Extract _is_initial_node() for checking empty repository state - Extract _create_initial_meta() for creating initial repository metadata - Extract _parse_tags() for filtering and processing tags - Extract _get_version_from_tags() for converting tags to versions - Extract _get_distance_based_version() for distance-based versioning - Fix type safety by properly handling None from tag_to_version Each helper method has a single responsibility and clear documentation. The main get_meta method now has a clear, linear flow that's easy to follow. Complexity reduced from 11 to under the 10 threshold.
4204f0a
to
75869c1
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes #1001
closes #1115
closes #1099
anger addressing 1022 due to errors