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.6.tar.gz (13.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.6-cp39-cp39-manylinux2010_x86_64.whl (326.5 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.12+ x86-64

opening_hours_py-0.5.6-cp38-cp38-manylinux2010_x86_64.whl (326.5 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for opening_hours_py-0.5.6.tar.gz
Algorithm Hash digest
SHA256 24487d4cfb1bb4f0fbf7b921e80f77439eebd0291a044545bbb11cabf483140c
MD5 2f04fae62dbc0b11eb830e468d25f40e
BLAKE2b-256 3fab43f7cdb22b0b90ea9ea89f3d3bf02068934406c908a90cae2858c1c12ecb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opening_hours_py-0.5.6-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 d7d3067e7bf2d02a1a7e8514258f4e966d5ad37c96ed3624b5ff2fa60850f2e2
MD5 8f17e31e97c388a5e7de8d35ca92a83a
BLAKE2b-256 ff5f5639a3065f6c77e01b53539f77bbc581ebb8917bd26b1998b67415e40567

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opening_hours_py-0.5.6-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 db8117fe0c66f9c026778f1f2dc9eee2a4c80419dba3f314158d53fdd1a7ff11
MD5 9d4d9c30e7fb3f69098b9d6c8d78cb97
BLAKE2b-256 d291295da6ac6ffa5a1ebec1f25de7d93a6a51b34f3aeef7f5d12ca7cbc7ddde

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