A parser and toolkit for the opening_hours in OpenStreetMap written in Rust.
Project description
Python bindings for OSM Opening Hours
Usage
Install opening-hours-py from PyPI, for example using pip:
pip install --user opening-hours-rs
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.
Developpement
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 https://github.com/remi-dupre/opening-hours-rs.git
cd opening-hours-rs/python
# 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
python
>>> from opening_hours import OpeningHours
>>> oh = OpeningHours("24/7")
>>> oh.state()
"open"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file opening_hours_py-0.5.2.tar.gz.
File metadata
- Download URL: opening_hours_py-0.5.2.tar.gz
- Upload date:
- Size: 24.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56a8947bb5d2ef2b659bc54c7a1c3f31d02c658d288346b775ff8bf72f1e1c1a
|
|
| MD5 |
654566d1c52c785a6205b7076dd45b9f
|
|
| BLAKE2b-256 |
86053aeb8c59232696a56709b335cd1ffc581782d3098c5fbab519942068ebde
|
File details
Details for the file opening_hours_py-0.5.2-cp39-cp39-manylinux2010_x86_64.whl.
File metadata
- Download URL: opening_hours_py-0.5.2-cp39-cp39-manylinux2010_x86_64.whl
- Upload date:
- Size: 280.7 kB
- Tags: CPython 3.9, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d341a5282e2f3e38888eafbc6de2173d7bc0e7eaa5927c064ddbf9a01abc26a2
|
|
| MD5 |
a5b407570df78419183716e7ffedeaa1
|
|
| BLAKE2b-256 |
102d47e6cf39f69388a391f6a53d6597b26111c58325be8ff5eeabeed594bb01
|
File details
Details for the file opening_hours_py-0.5.2-cp38-cp38-manylinux2010_x86_64.whl.
File metadata
- Download URL: opening_hours_py-0.5.2-cp38-cp38-manylinux2010_x86_64.whl
- Upload date:
- Size: 280.7 kB
- Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a9d45b1b63ac90776d143884a96df201c3393c80835041f0f4fa87dbcad31eb
|
|
| MD5 |
2cee91a4d6321887e1258b8f6de26d64
|
|
| BLAKE2b-256 |
e78833514f5ca6c6dbe4bea40c534b06ceddb493a5ee5cf77c6f5a333f86ab6e
|