Skip to content

Fix doctests, versions, and add better iso support#36

Merged
chetmancini merged 2 commits intomasterfrom
chetmancini/version-source
Feb 13, 2026
Merged

Fix doctests, versions, and add better iso support#36
chetmancini merged 2 commits intomasterfrom
chetmancini/version-source

Conversation

@chetmancini
Copy link
Copy Markdown
Owner

This pull request introduces improvements to version management, datetime parsing, and test coverage in the dateutils library. The main changes include making version resolution more robust by deriving the version from distribution metadata or falling back to pyproject.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 from pyproject.toml. Introduced helper functions _version_from_pyproject and _resolve_version.
  • tests/test_dateutils.py: Added tests to verify that the version is correctly derived from pyproject.toml, and that the helper functions handle errors and edge cases.
  • .bumpversion.cfg, Makefile: Updated the version bumping mechanism to use pyproject.toml as the single source of truth, removing the old version line from dateutils/__init__.py and updating bumping commands accordingly. [1] [2] [3]

Datetime parsing enhancements:

  • dateutils/dateutils.py: Expanded the supported datetime formats in parse_datetime to 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 comprehensive check target 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.

@chetmancini chetmancini merged commit 8c97762 into master Feb 13, 2026
6 checks passed
@chetmancini chetmancini deleted the chetmancini/version-source branch February 13, 2026 15:41
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.

1 participant