Install & Compatibility
Where this runs
tested against v0.3.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.666s · 22.4MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.4s · import 0.646s · 23MB
21MB installed
● package 21MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
ctparse
✓ from ctparse import ctparse
Direct import of main function
parse_time_expression
✓
✗ from ctparse import parse_time_expression
Wrong: no such function exists
Parse a natural language time expression with a reference timestamp.
from ctparse import ctparse
from datetime import datetime
result = ctparse('next Friday at 5pm', reference_ts=datetime.now())
if result:
print(result)
else:
print('No parse')
Errors
Common errors & fixes
ImportError: cannot import name 'parse' from 'ctparse'
Old import path from early examples or documentation.
fixUse 'from ctparse import ctparse'.
ctparse('next week') returns an empty list
Missing reference timestamp or ambiguous expression not handled by grammar.
fixPass reference_ts=datetime.now() or try a more specific expression like 'next Monday'.
TypeError: ctparse() missing 1 required positional argument: 'reference_ts'
reference_ts is required in newer versions.
fixAlways provide reference_ts parameter as a datetime object.
Upgrade
Version history
0.3.6latest on PyPI · released Nov 28, 2022
Audit
Dependencies
benedictoptionalFor handling dictionary operations
python-dateutilrequiredDate/time parsing
regexrequiredRegex operations
lark-parserrequiredParsing grammar