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

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


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.5.4.tar.gz (26.1 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.5.4-cp39-cp39-manylinux2010_x86_64.whl (298.3 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.12+ x86-64

opening_hours_py-0.5.4-cp38-cp38-manylinux2010_x86_64.whl (298.3 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for opening_hours_py-0.5.4.tar.gz
Algorithm Hash digest
SHA256 173a54fbfa29db243ee6ebe22f5e490739b360404aab263da7b6fdafe23b8b4c
MD5 72f174fc2200fcb8eb2d1b0a07c6c18f
BLAKE2b-256 47d9a777bc2edf37add2129078fef6fcf04e6fb643c8c2cbadd8849755516777

See more details on using hashes here.

File details

Details for the file opening_hours_py-0.5.4-cp39-cp39-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for opening_hours_py-0.5.4-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 429388e05a563107b1f234dd04a0f7b5c903e18987d9edcd17889ca13d1b751a
MD5 c5a77434badf9f7d35e330c53cebfd77
BLAKE2b-256 b0ef0364a0d0db1d1edbf173792a08ec7b40d1603125965b82b38a79bec44376

See more details on using hashes here.

File details

Details for the file opening_hours_py-0.5.4-cp38-cp38-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for opening_hours_py-0.5.4-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 d28874309f70562d948dcddcb56fd508035477f23210106f2a22321e405797d2
MD5 a263eef555fb5f09af5e6c87b594e646
BLAKE2b-256 77db6a91d2cf878c8ab9b4fe23c9f714bd00f272882738fe16c4674b12fb67ee

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