API overview
qddate exposes a small public surface. Import DateParser, DateMatch and
format_date from the top-level package; pattern tables live in
qddate.patterns.
from qddate import DateMatch, DateParser, format_date
import qddate
qddate.__version__
Classes and methods
| Symbol | Role |
|---|---|
DateParser | Constructs and indexes the pattern catalog |
DateParser.parse | String → datetime.datetime or None |
DateParser.match | String → {values, pattern} or None |
DateParser.match_all | String → every matching {values, pattern}, best first |
DateParser.match_typed | String → DateMatch or None |
DateParser.search | First date anywhere in the string → DateMatch (with its span) or None |
DateParser.find_all | Every date in the string, left to right → list of DateMatch |
DateParser.parse_many | Iterable of strings → iterator of datetime.datetime or None |
DateParser.parse_relative | today, 3 days ago, через 5 дней → datetime.datetime or None |
DateParser.format_date / qddate.format_date | datetime + pattern key → string |
DateParser.start_session / end_session | Restrict matching to chosen pattern keys |
DateMatch | Typed match result: datetime, pattern_key, language, format, raw |
languages= | Restrict the catalog at construction |
Package layout
qddate.DateParser: the parser classqddate.DateMatch: typed result ofmatch_typed()qddate.format_date: module-level form ofDateParser.format_date()qddate.__version__: package version stringqddate.patterns: pattern tables,ALL_PATTERNS,SUPPORTED_LANGUAGES,get_patterns_for_languages,LANGUAGE_ALIASES,DATE_LABELS
Internal helpers (qddate.dirty, filter indexes, generated variant keys) may
change without a major version bump.
Runtime contract
- Python 3.10–3.14, CPython and PyPy (CI tests CPython)
- Runtime dependency:
pyparsingonly - Import does not read extra files or call the network
- Import does not change process-wide pyparsing settings (packrat stays off)
Authoritative behavioral specs live in openspec/specs/ in the repository.
This site describes the same contract for humans.