Fix doctests, versions, and add better iso support#36
Merged
chetmancini merged 2 commits intomasterfrom Feb 13, 2026
Merged
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
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.
This pull request introduces improvements to version management, datetime parsing, and test coverage in the
dateutilslibrary. The main changes include making version resolution more robust by deriving the version from distribution metadata or falling back topyproject.toml, expanding the supported datetime formats to better handle timezone-aware strings, and adding comprehensive tests for these enhancements. Additionally, the build and release workflow has been updated to align with these changes.Version management improvements:
dateutils/__init__.py: Refactored version resolution to first try reading from package distribution metadata, and if unavailable (such as in a source checkout), fall back to parsing the version frompyproject.toml. Introduced helper functions_version_from_pyprojectand_resolve_version.tests/test_dateutils.py: Added tests to verify that the version is correctly derived frompyproject.toml, and that the helper functions handle errors and edge cases..bumpversion.cfg,Makefile: Updated the version bumping mechanism to usepyproject.tomlas the single source of truth, removing the old version line fromdateutils/__init__.pyand updating bumping commands accordingly. [1] [2] [3]Datetime parsing enhancements:
dateutils/dateutils.py: Expanded the supported datetime formats inparse_datetimeto include timezone-aware strings (e.g.,+02:00,-0500,Z). Updated the docstring to document these capabilities. [1] [2]tests/test_dateutils.py: Added tests to ensure correct parsing of timezone-aware datetime strings, including various offset formats and invalid cases. [1] [2]Build and workflow updates:
Makefile: Ensured the comprehensivechecktarget now includes doctests for better code quality assurance.These changes make version reporting more reliable and robust, improve datetime parsing flexibility, and strengthen the project's test suite and release workflow.