Observed since 21 Oct, 11:05 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Time interval parsing utilities for multiple languages.
Time interval parsing utilities for multiple languages.
Aika provides date- and time-range parsing utilities for multiple languages. It is based on dateparser, arbitrary-dateparser, and DateRangeParser, and aims for DWIM-like convenience and usefulness.
Currently, it supports 200 language locales through dateparser, and more
specific support for English and German through arbitrary-dateparser.
Contributions for other languages are welcome.
Install the most recent version of Aika.
pip install --upgrade aika
>>> import datetime as dt
>>> from aika import TimeIntervalParser
>>>
>>> ti = TimeIntervalParser()
>>>
>>> ti.parse("Sat - Tue")
>>> (dt.datetime(2023, 8, 26, 0, 0), dt.datetime(2023, 8, 29, 23, 59, 59, 999999))
>>>
>>> ti.parse_single("1. Juli")
>>> dt.datetime(2023, 7, 1, 0, 0)
Aika understands all types of date-/time-range expressions like provided by the packages it is based upon, and works with single dates too. This section enumerates a few examples.
-1d, -1 day-1w, -1 week-1M, -1 month-1y, -1 year-3M, -3 months-3d3h5m30sBy specifying default_start_time and default_end_time arguments, the
daterange boundaries will snap to the given times when they otherwise would be
"beginning of day" (00:00) or "end of day" (23:59).
import datetime as dt
from aika import TimeIntervalParser
dr = TimeIntervalParser(
snap_hours=True,
default_start_time=dt.time(hour=9),
default_end_time=dt.time(hour=17),
)
dr.parse("Sat - Tue")
(datetime(2023, 8, 26, 9, 0), datetime(2023, 8, 29, 17, 0))
If you see an error message like locale.Error: unsupported locale setting for
code like this,
import locale
locale.setlocale(locale.LC_ALL, "de_DE.UTF-8")
you will need to generate the German locales.
apt-get update
apt-get install --yes tzdata locales
locale-gen de_DE.UTF-8
Acquire source code and install development sandbox.
git clone https://github.com/panodata/aika
cd aika
uv venv --seed --python 3.11
source .venv/bin/activate
uv pip install --editable='.[develop,docs,test]'
Run linters and software tests:
source .venv/bin/activate
poe check
Aika means "time" in the Finnish language.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.3.1 | 6 Jan 2026 | 15 |
This describes our collected data; it is not a security assessment.
Observed since 21 Oct, 11:05 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:04d1e9e1a97f5a2df3c4e2e0f7f76a2933252ee38b3a38dfd114d8d0c4209e1a