Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 1.1.0 instead.
Reason given by maintainers: Unstable-ish

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.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.0.0
File Size Uploaded Provenance Actions
playwell-1.0.0.tar.gz 20.8 kB Without provenance Details for playwell-1.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 40.9 kB

Release files / playwell-1.0.0.tar.gz

Download URL playwell-1.0.0.tar.gz
Size 20.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3421c3a4ab31cefead08afa4a4b8ed336afdf2b41f68cce419097574980b4ad1
BLAKE2b-256 checksum
How to use checksums
15d30d962d4eede44187f3e706b4718be92f63ea4571be447f55dc35c11235cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.0

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

Download URL playwell-1.0.0-py3-none-any.whl
Size 20.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be6132b50b00bf1a8b7fe752d73eb0c13f49f70b2d0c42ffaa85ac116b13bdc7
BLAKE2b-256 checksum
How to use checksums
b775cf42702d7410b0edcf7a511212660f20633072089ec92e6d01bc232bcb2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.0

Security for playwell 1.0.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.0 This release

2 release files No 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