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.5.tar.gz (34.3 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.5-cp39-cp39-manylinux2010_x86_64.whl (299.9 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.12+ x86-64

opening_hours_py-0.5.5-cp38-cp38-manylinux2010_x86_64.whl (299.9 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for opening_hours_py-0.5.5.tar.gz
Algorithm Hash digest
SHA256 df07eee11757ddd4d8cc9c67b4ee6273d7fff6fdb939a03cca069cb90047076f
MD5 890a66dfa6bb986cdc87f7fcc1eb4b7a
BLAKE2b-256 37dde7d45b239ffe47800579ac2a8e240d2ddd0c65f8fb18e78403b683fabac2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opening_hours_py-0.5.5-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 35c74064c368d7b124c28c6b8db351c763ec7a0659c297c36a79fb3884af16ba
MD5 1b8a1b22db3336e739cf726ec96cf738
BLAKE2b-256 1555ca474d93fdf2c77984957bae48b82222bffc6176f1d32c334ef15e8a6806

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opening_hours_py-0.5.5-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 7c7571879a5615f28543a1d9bfd986d3bc8b6f243567785efe2036ef55955d4b
MD5 65eddea13fec9f3340979eb07184ee95
BLAKE2b-256 e46012fa1d90ae4d2634c5f212790af02d4fee82ead31d05de2b377348ad8479

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