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.3.tar.gz (35.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.3-py3-none-any.whl (60.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pieui-0.1.3.tar.gz
  • Upload date:
  • Size: 35.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.3.tar.gz
Algorithm Hash digest
SHA256 3249b098aee5367803bb1aaaa0afa5470366d8c4c061294273f59a060aa68adf
MD5 774f1b9041a56c5defaedb822a001d8b
BLAKE2b-256 ae195b91c07bdebe48fdd49cd6e34e86d36a7804e4675a47601c67798632f275

See more details on using hashes here.

Provenance

The following attestation bundles were made for pieui-0.1.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: pieui-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 60.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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 58440b5601a0d14b50f0b5af6a3bb378f71785e5527a16deaead35d7e009ce33
MD5 7002ca0af1222964bf4e7f1c817d4488
BLAKE2b-256 42804e88179a1ff900bc6a4693c4a5ff4c3daddf3cc251093b7020918164ef4d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pieui-0.1.3-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