Skip to main content

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​

SymbolRole
DateParserConstructs and indexes the pattern catalog
DateParser.parseString → datetime.datetime or None
DateParser.matchString → {values, pattern} or None
DateParser.match_allString → every matching {values, pattern}, best first
DateParser.match_typedString → DateMatch or None
DateParser.searchFirst date anywhere in the string → DateMatch (with its span) or None
DateParser.find_allEvery date in the string, left to right → list of DateMatch
DateParser.parse_manyIterable of strings → iterator of datetime.datetime or None
DateParser.parse_relativetoday, 3 days ago, через 5 дней → datetime.datetime or None
DateParser.format_date / qddate.format_datedatetime + pattern key → string
DateParser.start_session / end_sessionRestrict matching to chosen pattern keys
DateMatchTyped match result: datetime, pattern_key, language, format, raw
languages=Restrict the catalog at construction

Package layout​

  • qddate.DateParser: the parser class
  • qddate.DateMatch: typed result of match_typed()
  • qddate.format_date: module-level form of DateParser.format_date()
  • qddate.__version__: package version string
  • qddate.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: pyparsing only
  • 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.