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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18b995c63632f8be77814ca546cb93b0977e2991827a0f9229d97a2808795ce8
|
|
| MD5 |
0b5b60e1182a1bc294fc2962c09d8dcb
|
|
| BLAKE2b-256 |
8086fef82a37afd5c59a568fae3ebb278e277f16fcd3eb38bdda086a39424438
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
094d71f9ddf54340684ee132d713e389d09f533556f92b2e9b5f0da3ed394ae7
|
|
| MD5 |
e47bafc4f68dee839c82845b75148558
|
|
| BLAKE2b-256 |
dd6323a96ef986ca9e2ebf0a0309ed1a0e3ec0786f001d040678788bc163b421
|