Skip to content

Support datetime, date, time, re.Pattern and Fraction types - #1002

Merged
mauvilsa merged 2 commits into
mainfrom
datetime-pattern-fraction-types
Oct 5, 2026
Merged

mauvilsa merged 2 commits into
mainfrom
datetime-pattern-fraction-types

Conversation

@mauvilsa

@mauvilsa mauvilsa commented Oct 5, 2026

Copy link
Copy Markdown
Owner

What does this PR do?

  • Support for datetime, date and time types, parsed and serialized as ISO 8601 strings.
  • Support for re.Pattern and Fraction types.
  • Values of these types in Any arguments now dump as strings, where before a date was dumped as Unable to serialize instance ....
  • A custom register_type(datetime, ...) can still be used for formats other than ISO 8601, since it replaces the built-in registration.

Before submitting

  • Did you read the contributing guideline?
  • If you used a coding agent, did you fully understand and validate all generated code and ensure it follows the contributing guidelines?
  • Did you update the documentation? (readme and public docstrings)
  • Did you write unit tests such that there is 100% coverage on related code? (required for bug fixes and new features)
  • Did you verify that new and existing tests pass locally?
  • [n/a] If this is a bug fix, did you verify that the tests fail without the code fix?
  • Did you make sure that all changes preserve backward compatibility?
  • Did you update the CHANGELOG including a pull request link? (not for typos, docs, test updates, or minor internal changes/refactors)

@mauvilsa mauvilsa added the enhancement New feature or request label Oct 5, 2026
@greptile-apps

greptile-apps Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 3/5

[Medium risk] Adds support for five new type deserializers and serializers.

The PR is not safe to merge until pattern dumps preserve compilation behavior and handle bytes patterns.

Findings

  1. P1 Pattern flags are lost ▶
  2. P1 Bytes patterns break JSON dumps ▶

Summary

The PR adds built-in parsing and serialization for ISO-formatted datetime types, regular-expression patterns, and fractions, with documentation and tests. Pattern serialization needs attention because it loses compilation flags and cannot JSON-dump bytes patterns.

Reviews (1) · Last reviewed commit: "Support datetime, date, time, re.Pattern..."

Comment thread jsonargparse/typing.py Outdated
Comment thread jsonargparse/typing.py Outdated
@mauvilsa
mauvilsa deployed to sonarcloud October 5, 2026 05:47 — with GitHub Actions Active
@mauvilsa
mauvilsa deployed to sonarcloud October 5, 2026 06:12 — with GitHub Actions Active
@sonarqubecloud

sonarqubecloud Bot commented Oct 5, 2026

Copy link
Copy Markdown

@mauvilsa
mauvilsa merged commit d1bc15a into main Oct 5, 2026
29 of 30 checks passed
@mauvilsa
mauvilsa deleted the datetime-pattern-fraction-types branch October 5, 2026 06:15

This branch was successfully deployed

1 active deployment
sonarcloud — aa347b28 Deployed Oct 5, 2026 by mauvilsa via sonarcloud #944
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant