Skip to main content

pyrailworks

Python client library for the Public RO Railworks API (https://railworks.paddez.com/docs).

Provides queryable access to Iarnród Éireann's (Irish Rail) planned engineering works, station days, change logs, and iCalendar feeds.

Installation

pip install pyrailworks

Quick Start

Synchronous Client

from pyrailworks import RailworksClient, LineName

with RailworksClient() as client:
    # 1. Health check
    health = client.get_health()
    print("Upstream checked at:", health.source.checked_at)

    # 2. List stations
    stations = client.list_stations()
    print(f"Total stations: {len(stations)}")

    # 3. Check affected days for a station
    days_resp = client.get_station_days("WBROK")
    for day in days_resp.days:
        print(f"Station {days_resp.station.name} affected on {day.date}: {day.effect.value}")

    # 4. List active notices on a line
    notices = client.list_notices(line=LineName.DART, status="active")
    for notice in notices.notices:
        print(f"Notice {notice.id}: {notice.heading} ({notice.starts_on} to {notice.ends_on})")

    # 5. Follow changes with automatic cursor traversal
    for event in client.iter_changes():
        print(f"Change event: {event.type.value} on notice {event.notice_id}")

Asynchronous Client

import asyncio
from pyrailworks import AsyncRailworksClient

async def main():
    async with AsyncRailworksClient() as client:
        health = await client.get_health()
        print("Backend stale:", health.source.stale)

        async for event in client.iter_changes():
            print("Notice changed:", event.notice_id)

asyncio.run(main())

Compatibility

The Railworks API only makes additive changes within /v1: new fields, endpoints and query parameters, and new enum values. pyrailworks is built to keep working through all of them:

  • Unknown fields are ignored.

  • Unknown enum values (a new effect kind, change-event type or status) parse as an UNKNOWN member that keeps the raw value, still compares equal to the string, and has is_known == False:

    for event in client.iter_changes():
        if not event.type.is_known:
            log.info("new event type %s: consider upgrading pyrailworks", event.type.value)
    
  • Requests identify the client version (User-Agent: pyrailworks/<version>), so the API can see which versions are in use before retiring anything.

A breaking change would ship as /v2, alongside /v1, with Deprecation and Sunset headers on what's being retired. The railworks repository runs this package's integration tests against every change to the API, and a nightly job here runs them against the live API and opens an issue if they fail.

Features

  • Both Sync & Async: RailworksClient and AsyncRailworksClient powered by httpx.
  • Strict Data Validation: Pydantic v2 data models for type safety, validation, and auto-completion.
  • Problem Details Handling: Full support for RFC 9457 errors with specific exceptions (BadRequestError, NotFoundError, StationsLoadingError).
  • Change Log Streaming: Helper generators (iter_changes()) handling opaque cursor pagination.
  • Calendar Feeds: Raw iCalendar text download via get_calendar_feed().

Metadata

Release files for pyrailworks 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyrailworks 0.2.0
File Size Uploaded
pyrailworks-0.2.0.tar.gz 16.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyrailworks 0.2.0
File Interpreter ABI Platform
pyrailworks-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 25.9 kB

Release files / pyrailworks-0.2.0.tar.gz

Download URL pyrailworks-0.2.0.tar.gz
Size 16.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b72886d31bfdb8e0e2c749a3ba612ada83ffc4763b0919ab56c3512fea14f876
BLAKE2b-256 checksum
How to use checksums
e717ac308b9613501eb89d98a1112d45357ecccf9896486261ffb4f5b1c03b71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Release files / pyrailworks-0.2.0-py3-none-any.whl

Download URL pyrailworks-0.2.0-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8c603c03cc4ddb9312a3be02b23c8a4e3d0703f9f4a60f3474e029147d403997
BLAKE2b-256 checksum
How to use checksums
78b28f1eeaddbbdc2571d09022fdd1c92768689328b113088dd6ac08184d2ca7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page