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.7.tar.gz (935.8 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.7-cp311-cp311-manylinux_2_34_x86_64.whl (367.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

opening_hours_py-0.6.7-cp39-cp39-manylinux_2_34_x86_64.whl (368.1 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.34+ x86-64

File details

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

File metadata

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

File hashes

Hashes for opening_hours_py-0.6.7.tar.gz
Algorithm Hash digest
SHA256 2c24a34bff77972d56f894aae7003686df40942c7e021430aa157f61421229eb
MD5 fdd8bf1a9c64cba5279ac960aff9eff0
BLAKE2b-256 9eab159c3f49396c138f2301052a6fe178b1515a6064108bec0f971c33480b9f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opening_hours_py-0.6.7-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 c97ba6dcf2247262dfc897663daa08ae981af43e9c11d3966c237ac0587e3a95
MD5 be366922bd0c719965fd40beef506809
BLAKE2b-256 0772766dbc97872f7734aac71d7f7c2a87674b52e334c03e855bbbe308fa345d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opening_hours_py-0.6.7-cp39-cp39-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 9cdb609e9d654d421aec6f2a5e8f6c86b7068c2fe07b7818c42a5760009a670f
MD5 e07d98ced2330281e58288c32441214f
BLAKE2b-256 dd5213f80f2529f513710a5b710d1f2feedf46e1eab66e18ce97a38a331686dc

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