Skip to main content

Python utility to generate working timetables from general schedule data.

Project description

Jikoku

Flexible and extendable Python utility for generating working timetables from general schedule data.

Basic Usage Example

from jikoku.models import Stop, Service
from jikoku.scheduler import schedule
from datetime import time, timedelta

# Define a simple service and return service
starts = time(hour=8)
ends = time(hour=9, minute=30)

first = Service("a_service", starts, ends, [Stop("Teufort", starts), Stop("Badlands",ends)])
first_return = Service( "a_return_service",starts , ends, [Stop("Badlands", starts), Stop("Teufort", ends)])

# Copy those services throughout the day
all_services = [first + timedelta(hours=i) for i in range(4)] + ([first_return + timedelta(hours=i) for i in range(4)])

# Schedule the services
generated_schedule = schedule(all_services)
print(generated_schedule)
"""prints the following:

train-ZT4bwn
        09:00:00 - 10:30:00: Teufort => Badlands
        11:00:00 - 12:30:00: Badlands => Teufort
train-eP9nMb
        08:00:00 - 09:30:00: Badlands => Teufort
        10:00:00 - 11:30:00: Teufort => Badlands
train-hVGMEI
        08:00:00 - 09:30:00: Teufort => Badlands
        10:00:00 - 11:30:00: Badlands => Teufort
train-jzVbxj
        09:00:00 - 10:30:00: Badlands => Teufort
        11:00:00 - 12:30:00: Teufort => Badlands
"""

Have a look at the documentation for more examples, including real word schedules from JR & SNCF!

Installation

Jikoku is available on PyPI. Install via using (preferably in a virtual environment) via:

pip install jikoku

Contributing

Pull requests, feature requests or other ideas always welcome. To get a local development environment setup, you will need Poetry installed. Then:

git clone https://github.com/TakeoIschiFan/Jikoku
cd Jikoku
poetry install

Note: use `poetry install --with docs if you want to compile the documentation website

To get logging working, add a .env file in the root directory which contains the following variables

PYTHONPATH="jikoku:tests"
DEBUG="true"

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

jikoku-0.0.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

jikoku-0.0.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file jikoku-0.0.1.tar.gz.

File metadata

  • Download URL: jikoku-0.0.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Linux/6.1.51-1-MANJARO

File hashes

Hashes for jikoku-0.0.1.tar.gz
Algorithm Hash digest
SHA256 18b995c63632f8be77814ca546cb93b0977e2991827a0f9229d97a2808795ce8
MD5 0b5b60e1182a1bc294fc2962c09d8dcb
BLAKE2b-256 8086fef82a37afd5c59a568fae3ebb278e277f16fcd3eb38bdda086a39424438

See more details on using hashes here.

File details

Details for the file jikoku-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: jikoku-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Linux/6.1.51-1-MANJARO

File hashes

Hashes for jikoku-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 094d71f9ddf54340684ee132d713e389d09f533556f92b2e9b5f0da3ed394ae7
MD5 e47bafc4f68dee839c82845b75148558
BLAKE2b-256 dd6323a96ef986ca9e2ebf0a0309ed1a0e3ec0786f001d040678788bc163b421

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