Skip to main content

CLI client for PieUI.

Project description

pie

Python CLI for Pie components.

The command surface follows the TypeScript pieui CLI:

init
add
remove
list
push
pull
remote-remove
list-events
add-event
postbuild

Remote commands call the pieui-storage API:

push
pull
remote-remove

Setup

uv sync --python 3.14
cp .env.example .env

Do not pin the project to 3.14.0b1: current pydantic/pydantic-settings break on that beta. uv sync --python 3.14 creates a managed CPython 3.14.0 environment.

Config

The CLI reads .env with the PIE_ prefix:

PIE_API_BASE_URL=http://localhost:8000/api
PIE_USER_ID=default-user
PIE_PROJECT_SLUG=default-project
PIE_COMPONENTS_DIR=piecomponents
PIE_TIMEOUT_SECONDS=30
PIE_API_KEY=dev-master-key

PIE_API_BASE_URL must point to the API prefix of pieui-storage, for example:

PIE_API_BASE_URL=http://localhost:8000/api

PIE_API_KEY is sent to pieui-storage as the x-api-key header. The local API default is dev-master-key.

Commands

init

Initialize the piecomponents directory:

uv run pie init
uv run pie init --out-dir packages/app
uv run pie init -o packages/app

add

Create a local Python component project under piecomponents/<ComponentName>:

uv run pie add MyCustomCard
uv run pie add simple MySimpleCard
uv run pie add complex MyComplexCard
uv run pie add simple-container MySimpleContainerCard
uv run pie add complex-container MyContainerCard

If the type is omitted, complex-container is used, matching the TypeScript CLI.

The generated template is a minimal piedemo web project:

piecomponents/MyCustomCard/
  pyproject.toml
  web.py
  pages/
    main.py

web.py registers MainPage on the root route: {"": MainPage()}. pages/main.py also contains MainCard, where component events are declared.

remove

Remove a local component directory:

uv run pie remove MyCustomCard

list

List local components:

uv run pie list
uv run pie list simple
uv run pie list complex-container --src-dir app
uv run pie list complex-container -s app

Accepted filters:

all
simple
complex
simple-container
complex-container

push

Upload piecomponents/<ComponentName> to pieui-storage.

The storage API stores files under:

PIE_USER_ID/PIE_PROJECT_SLUG/<ComponentName>/python/*

Command:

uv run pie push MyCustomCard

pull

Download Python files from pieui-storage into piecomponents/<ComponentName>:

uv run pie pull MyCustomCard

remote-remove

Delete the remote component from pieui-storage:

uv run pie remote-remove MyCustomCard

list-events

List events declared by MainCard.get_supported_events():

uv run pie list-events MyCustomCard
uv run pie list-events MyCustomCard --src-dir app

add-event

Add a card event method and update get_supported_events():

uv run pie add-event MyCustomCard alert
uv run pie add-event MyCustomCard alert --src-dir app

For alert, the command adds:

def create_alert_event(self, data: dict | None = None):
    return self.create_event("alert", data or {})

def get_supported_events(self):
    return [
        "alert",
    ]

postbuild

Generate a manifest file:

uv run pie postbuild
uv run pie postbuild --append --out-dir dist
uv run pie postbuild --src-dir src --out-dir public

Project Layout

pie/cli.py               CLI argument handling and command dispatch
pie/config.py            pydantic-settings config loaded from .env
pie/models.py            pydantic response models
pie/services/storage.py  pieui-storage API client

Project details


Download files

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

Source Distribution

pieui-0.1.9.tar.gz (45.2 kB view details)

Uploaded Source

Built Distribution

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

pieui-0.1.9-py3-none-any.whl (73.3 kB view details)

Uploaded Python 3

File details

Details for the file pieui-0.1.9.tar.gz.

File metadata

  • Download URL: pieui-0.1.9.tar.gz
  • Upload date:
  • Size: 45.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pieui-0.1.9.tar.gz
Algorithm Hash digest
SHA256 11f952f547c76d644fc4f0cefcdda74aefa1724859ac4b0e4d3fac3bd73d84c6
MD5 f841befe22bdf6053b30be7a203b3031
BLAKE2b-256 d05370b373d7024fa1578f9f594f4e13b6c20b533cb689a5451d947c6e9ef2da

See more details on using hashes here.

Provenance

The following attestation bundles were made for pieui-0.1.9.tar.gz:

Publisher: publish.yml on Swarm-AI-Labs/pie

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pieui-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: pieui-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 73.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pieui-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 d955bc37b35b9ec4c18c3e7cc1831bb3d1ffb9e4ba7d1aadef8a153e907287b2
MD5 a2dc1a064ce0580584c7efe4ca8ad99f
BLAKE2b-256 7f6072ba345a32eacfd0713a62a047dde8394f2771306abbb6c3a956afb38616

See more details on using hashes here.

Provenance

The following attestation bundles were made for pieui-0.1.9-py3-none-any.whl:

Publisher: publish.yml on Swarm-AI-Labs/pie

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page