Skip to main content

A parser and toolkit for the opening_hours in OpenStreetMap written in Rust.

Project description

Python bindings for OSM Opening Hours

PyPI Doc


The package is published for Python 3.7 and above, but you might be able to install it with older version of Python if you install the Rust toolchain.

Install opening-hours-py from PyPI, for example using pip:

pip install --user opening-hours-py

Then, the main object that you will interact with will be OpeningHours:

from opening_hours import OpeningHours

oh = OpeningHours("Mo-Fr 10:00-18:00; Sa-Su 10:00-12:00")
print("Current status is", oh.state())
print("This will change at", oh.next_change())

The API is very similar to Rust API but you can find a Python specific documentation here.


To build the library by yourself you will require a recent version of Rust, rustup is usually the recommanded tool to manage the installation.

Then you can use poetry to install Python dependancies and run maturin (the building tool used to create the binding) from a virtualenv.

git clone
cd opening-hours-rs

# Install Python dependancies
poetry install

# Enter the virtualenv
poetry shell

# Build developpement bindings, add `--release` for an optimized version
maturin develop

# Now the library is available as long as you don't leave the virtualenv
>>> from opening_hours import OpeningHours
>>> oh = OpeningHours("24/7")
>>> oh.state()

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opening_hours_py-0.6.17.tar.gz (936.8 kB view hashes)

Uploaded source

Built Distributions

opening_hours_py-0.6.17-cp311-none-win32.whl (258.0 kB view hashes)

Uploaded cp311

opening_hours_py-0.6.17-cp310-none-win32.whl (258.0 kB view hashes)

Uploaded cp310

opening_hours_py-0.6.17-cp39-none-win32.whl (258.2 kB view hashes)

Uploaded cp39

opening_hours_py-0.6.17-cp38-none-win32.whl (257.7 kB view hashes)

Uploaded cp38

opening_hours_py-0.6.17-cp37-none-win32.whl (257.8 kB view hashes)

Uploaded cp37

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page