Skip to main content

Playwell-Py

GitHub License PyPI Version Python Version

The official synchronous Python client SDK for Playwell, a read-through caching REST API for LEGO kit metadata, cover artwork, and instruction manuals.

Features

  • Synchronous: Built on top of httpx. Works seamlessly in standard scripts, CLI tools, and desktop GUI applications.
  • Config-less Default: Connects automatically to the public instance at https://playwell.bitboard.ca, with easy overrides for self-hosted servers.
  • Memory & Disk Streaming: Load cover images and PDFs directly into RAM as raw bytes to avoid unnecessary disk I/O, or stream heavy manuals straight to disk.
  • Automatic Handshake Validation: Verifies server reachability and API version compatibility on initialization. (Can be disabled)
  • Strongly Typed: Returns clean @dataclass objects (Kit, Instruction, ServerStatus) with full IDE autocomplete and dedicated exception types.

Installation

pip install playwell

Quickstart

from playwell import Playwell, PlaywellNotFoundError

# Connects to https://playwell.bitboard.ca by default
with Playwell() as pw:
    # Check server handshake & version info
    print(f"Connected to {pw.server_status.service} v{pw.server_status.system_version}")

    try:
        # Fetch kit metadata (triggers a server-side scrape if not yet cached)
        kit = pw.get_kit("71374")
        print(f"{kit.name} ({kit.theme}) - {kit.pieces} pieces")

        # List available instruction manuals for the kit
        manuals = pw.get_kit_instructions("71374")
        for manual in manuals:
            print(f" - [{manual.id}] {manual.description} ({manual.size_mb} MB)")

        # Stream the first PDF directly to disk
        if manuals:
            saved_path = pw.download_instruction_pdf(manuals[0].id, f"./{kit.id}_manual.pdf")
            print(f"Saved manual to {saved_path}")

    except PlaywellNotFoundError:
        print("Could not find that LEGO kit ID.")

Configuration

You can point Playwell at a self-hosted server either by passing base_url directly or by setting the PLAYWELL_SERVER_URL environment variable:

import os
from playwell import Playwell

# Option 1: Explicit argument
pw = Playwell(base_url="http://localhost:5346")

# Option 2: Environment variable
os.environ["PLAYWELL_SERVER_URL"] = "http://localhost:5346"
pw = Playwell()

# Option 3: Skip startup version handshake
pw = Playwell(verify_version=False)

In-Memory Assets (Zero Disk I/O)

For GUI applications or web services that want to render artwork without creating temporary files, use the get_* binary methods to fetch raw bytes directly into RAM:

import io
from playwell import Playwell

with Playwell() as pw:
    cover_bytes = pw.get_kit_cover("71374")
    image_buffer = io.BytesIO(cover_bytes)

API Reference

Method Description Return Type
get_status() Fetches the latest server status handshake. ServerStatus
get_kit(kit_id) Fetches full metadata for a LEGO kit ID. Kit
search_kits(...) Searches cached kits by search, name, theme, or age_group. list[Kit]
get_kit_instructions(kit_id) Lists all instruction booklets for a kit ID. list[Instruction]
get_instruction(instruction_id) Fetches metadata for a standalone instruction ID. Instruction
search_instructions(description) Searches cached instruction booklets by description. list[Instruction]
get_kit_cover(kit_id) Fetches kit box artwork into RAM. bytes
download_kit_cover(kit_id, path) Streams kit box artwork directly to disk. Path
get_instruction_cover(id) Fetches booklet cover artwork into RAM. bytes
download_instruction_cover(id, path) Streams booklet cover artwork directly to disk. Path
get_instruction_pdf(id) Fetches instruction manual PDF into RAM. bytes
download_instruction_pdf(id, path) Streams instruction manual PDF directly to disk. Path
stream_instruction_pdf(id) Yields raw byte chunks for custom streaming pipelines. Iterator[bytes]

Exceptions

All SDK exceptions inherit from PlaywellError:

  • PlaywellConnectionError - Network timeout or unreachable server.
  • PlaywellVersionError - Server does not support the client's API version (v1).
  • PlaywellNotFoundError - Requested kit or instruction ID returned HTTP 404.
  • PlaywellAPIError - Unexpected 4xx or 5xx HTTP error response from the server.

License

Distributed under the GPLv3 License. See LICENSE for more information.

Support

If you liked this project, go ahead and give it a star! And if it really helped you out, consider sending me a tip.

BTC: bc1q8tmwuyxpgkuptwu3mn4ryaemp3umvwcc0e5nkk

Metadata

Release files for playwell 1.0.1

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

Source distribution (sdist)

Source distribution for playwell 1.0.1
File Size Uploaded Provenance Actions
playwell-1.0.1.tar.gz 20.5 kB With provenance Details for playwell-1.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 40.7 kB

Release files / playwell-1.0.1.tar.gz

Download URL playwell-1.0.1.tar.gz
Size 20.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f94130a210f2552f2dd3925a7e28542ffd02071c48501add3bc6b6bf3c1981ca
BLAKE2b-256 checksum
How to use checksums
59ece610d446f777c9a430532b99247bea7877dcf72608c75b812e7291b55e2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 12, 2026.

Transparency log

Release files / playwell-1.0.1-py3-none-any.whl

Download URL playwell-1.0.1-py3-none-any.whl
Size 20.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea3af0c4d6ca6d07a2154c2cf89ae5cc707d9f7ad43ae61945b6b9b316994092
BLAKE2b-256 checksum
How to use checksums
0f62dcd0da6340f23e78336d4e660bf0784d7b25cbfa4a968addb6d2972deab5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 12, 2026.

Transparency log

Security for playwell 1.0.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for playwell-1.0.1.tar.gz

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 Nov 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files Full provenance

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