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

Usage

The package is published for Python 3.9 and above, but you should 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.

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


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.12.tar.gz (935.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

opening_hours_py-0.6.12-cp311-cp311-manylinux_2_34_x86_64.whl (367.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

opening_hours_py-0.6.12-cp310-cp310-manylinux_2_34_x86_64.whl (367.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

opening_hours_py-0.6.12-cp39-cp39-manylinux_2_34_x86_64.whl (367.4 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.34+ x86-64

File details

Details for the file opening_hours_py-0.6.12.tar.gz.

File metadata

  • Download URL: opening_hours_py-0.6.12.tar.gz
  • Upload date:
  • Size: 935.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.1.0

File hashes

Hashes for opening_hours_py-0.6.12.tar.gz
Algorithm Hash digest
SHA256 dfe16a20cf0517d9d59c5fc1ec7f782910fc61b7822cea4ba4e12c8f4546207b
MD5 bdf50c7b7fdaade36166ff92b7047803
BLAKE2b-256 8a9ff6ddc7c46e5bf7d9c1d980b4ba814b63ed151149a5ebd8c58407974d5860

See more details on using hashes here.

File details

Details for the file opening_hours_py-0.6.12-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for opening_hours_py-0.6.12-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4e318d15323083bbcf23809653994e07f2a465b0f7e975a073cafb32e850ff9c
MD5 a5ddfd13eaa23adfd336b9a45f7ead9e
BLAKE2b-256 3d33fccdf353deb9c4795ed90338a3c7e12c48a3622b2c3281f2667309cfd1a3

See more details on using hashes here.

File details

Details for the file opening_hours_py-0.6.12-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for opening_hours_py-0.6.12-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 117c4a0997dbc393ee6b9b9ae5d0831b6329711b22d172e5aaeb2214cfce70b4
MD5 764be1a41ced8fcb1fdf8d9932e94dc6
BLAKE2b-256 44305d114578f1a3b71dc488787245a65a34073d8a38bb936068a711fb3caf31

See more details on using hashes here.

File details

Details for the file opening_hours_py-0.6.12-cp39-cp39-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for opening_hours_py-0.6.12-cp39-cp39-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 54338b26a4602dac8d4b37f261a869197f63511b541687008c1afe67bba0bbdc
MD5 cfdacf71423997a91d6e80590f00ca31
BLAKE2b-256 099ba0e2794bd84b9f88fb8ffb5eec639ddf32372882ab4949ae81af09f8f32f

See more details on using hashes here.

Supported by

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