Skip to main content

Playwell-Py

Playwell Version 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 & Raw Stream Assets

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, or rely on stream_* methods to return a bytes iterator:

import io
from playwell import Playwell

with Playwell() as pw:
    # Option 1. Fetch cover image bytes
    cover_bytes = pw.get_kit_cover("71374")
    
    # Option 2. Fetch cover image byte stream
    cover_stream = pw.stream_kit_cover("71374")

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
stream_kit_cover(kit_id) Yields byte chunks of kit box artwork. Iterator[bytes]
get_instruction_cover(id) Fetches booklet cover artwork into RAM. bytes
download_instruction_cover(id, path) Streams booklet cover artwork directly to disk. Path
stream_instruction_cover(id) Yields byte chunks of booklet cover artwork. bytes
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 byte chunks of instruction manual PDF. 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.1.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 playwell 1.1.0
File Size Uploaded Provenance Actions
playwell-1.1.0.tar.gz 22.5 kB With provenance Details for playwell-1.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 42.9 kB

Release files / playwell-1.1.0.tar.gz

Download URL playwell-1.1.0.tar.gz
Size 22.5 kB
Tags Source
SHA-256 checksum
How to use checksums
edf064abedd6bd51a67ade283185e5394b093cd82b073157f4804901664afcea
BLAKE2b-256 checksum
How to use checksums
0c4c790b1da15811c31cc5cbd3cd46b6398fb3c5cef00fef065aa85e86351493
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 14, 2026.

Transparency log

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

Download URL playwell-1.1.0-py3-none-any.whl
Size 20.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98812539dc59968aacbce461275a20eddc7e54fe1c6b7510f0405e3415741016
BLAKE2b-256 checksum
How to use checksums
81e3993d63d2cda969c461438c2fa6e00cb37ef5104742f8f541b1245aac1674
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 14, 2026.

Transparency log

Security for playwell 1.1.0

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.1.0.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 14, 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.1.0 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