Skip to main content

Freerouting Python Client

PyPI version License: MIT Python Versions

This library provides a convenient Python interface for interacting with the Freerouting API (api.freerouting.app). It allows you to manage routing sessions, enqueue jobs, upload designs, download results, stream progress, and monitor jobs programmatically.

Note: This client is currently in Alpha. The API and client library interface may change in future versions.

Links

Installation

You can install the library directly from PyPI:

pip install freerouting-client

For development:

pip install -e ".[dev]"

Getting Started

You'll need an API key from the Freerouting website to use the hosted cloud API.

from freerouting import FreeroutingClient
import os

api_key = os.environ.get("FREEROUTING_API_KEY")
if not api_key:
    raise ValueError("Please set the FREEROUTING_API_KEY environment variable.")

client = FreeroutingClient(api_key=api_key)

status = client.get_system_status()
print(f"API Status: {status.get('status', 'Unknown')}")

Local / self-hosted Freerouting

When running Freerouting locally with authentication disabled, omit the API key and point the client at your local server:

client = FreeroutingClient(
    base_url="http://127.0.0.1:37864",
    version="v1",
)

Example: Running a Full Routing Job

from freerouting import FreeroutingClient, FreeroutingError

client = FreeroutingClient(api_key=os.environ["FREEROUTING_API_KEY"])

output_data = client.run_routing_job(
    name="My Python Client Test Job",
    dsn_file_path="path/to/my_board.dsn",
    settings={"max_passes": 5},
    poll_interval=10,
    output_path="routed_output.ses",
)

print(f"Output filename: {output_data.get('filename')}")

API Coverage

Area Methods
System get_system_status(), get_environment()
Sessions create_session(), list_sessions(), get_session(), get_session_logs(), monitor_session()
Jobs enqueue_job(), list_jobs(), list_all_jobs(), get_job(), update_job_settings(), start_job(), cancel_job()
Input / output upload_input(), upload_input_json(), download_output(), download_output_json(), get_job_drc()
Logs & streaming get_job_logs(), stream_job_logs(), stream_job_output(), stream_job_output_json()
Workflow run_routing_job()

KiCad JSON workflow

For the KiCad IPC bridge workflow, upload raw JSON and download JSON output:

import json

with open("board.json", encoding="utf-8") as f:
    board = json.load(f)

job = client.enqueue_job("KiCad JSON test")
client.upload_input_json(job["id"], board)
client.start_job(job["id"])

# Poll with get_job(job["id"]) or stream progress:
for update in client.stream_job_output_json(job["id"]):
    print(update.get("statistics", {}))

result = client.download_output_json(job["id"], output_path="board_routed.json")

DRC report

drc = client.get_job_drc(job_id)
print(len(drc.get("violations", [])))

Error Handling

The client raises typed exceptions:

  • FreeroutingAuthError — invalid or missing credentials (HTTP 401/403)
  • FreeroutingAPIError — other non-success API responses
  • FreeroutingError — network failures and workflow errors

Contributing

Contributions to the Freerouting Python Client are welcome. Please refer to the main Freerouting Contribution Guide for general guidelines and open an issue or pull request in this repository (freerouting-python-client).

License

This project is licensed under the MIT License — see the LICENSE file for details.

Support the Main Freerouting Project

Developing and maintaining Freerouting requires significant effort. If you find the tool useful, please consider supporting its development.

Sponsor @andrasfuchs on GitHub Sponsors

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

freerouting_client-2.3.0.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

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

freerouting_client-2.3.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file freerouting_client-2.3.0.tar.gz.

File metadata

  • Download URL: freerouting_client-2.3.0.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for freerouting_client-2.3.0.tar.gz
Algorithm Hash digest
SHA256 3462592cfbc1e075d554b301d77d26c43e8e00e308378091e4cc023e587ab3d6
MD5 df5304920fa4b05817b4e5a21fc79848
BLAKE2b-256 f4fbfa591646c1e82d73cfaee8f5dd1933fffbfa5bde266268dfed06fa0e51db

See more details on using hashes here.

File details

Details for the file freerouting_client-2.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for freerouting_client-2.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ed69f19763525e745ebb7a8f64847cc5e6425e4d7139cf7a15f390401357d841
MD5 6814b02c5aef27e9fd8eaea611b5c584
BLAKE2b-256 17d69a7e0a631665e1f0e6fabade8b3de11a2918a45504527e5103845d0b004f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.3.0 This release

2 files

2.1.1

2 files

2.1.0

2 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