Skip to main content

CLI client for PieUI Storage.

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.1.tar.gz (36.8 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.1-py3-none-any.whl (61.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pieui-0.1.1.tar.gz
  • Upload date:
  • Size: 36.8 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.1.tar.gz
Algorithm Hash digest
SHA256 9755d2131bb48481e106c66422711541342bcdb3c485f019ffe2fae261c1e983
MD5 284b2313f5101f074ba683f42c4ba9c5
BLAKE2b-256 acbc059bec0ff1284776205c7c5de0bcc5d2bc6aa06366345829ff99d1b78dcc

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pieui-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 61.9 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6309fd47d5382e1155946cf870d870dcb6381387011f4cdd4282a8521e8672d4
MD5 5a14538d495e14056c49a3d101e07f76
BLAKE2b-256 57a7548ff5add4cbb0249ec2c8edb5b0c2ddf4a9ab52ff9d8d7fcb0835aeac9c

See more details on using hashes here.

Provenance

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