CLI client for PieUI.
Project description
pie
Python CLI and runtime helpers for PieUI applications.
The installed console script is pie and its entrypoint is pie.__main__:main.
Commands are grouped by area:
pie web ...
pie card ...
pie page ...
pie create ...
pie login
Setup
uv sync --python 3.14
Run commands from this repository with:
uv run pie --help
The project requires Python >=3.14.
Configuration
The CLI loads .env through python-dotenv and reads these variables:
PIE_USER_ID=default-user
PIE_PROJECT=default-project
PIE_PROJECT_SLUG=default-project
PIE_COMPONENTS_DIR=pages/components
PIE_API_KEY=dev-master-key
Notes:
PIE_COMPONENTS_DIRdefaults topages/components.PIE_PROJECTwins overPIE_PROJECT_SLUG; if both are absent, the current directory name is used.PIE_API_KEYis sent topieui-storageas thex-api-keyheader.- The storage API base URL is currently
https://cdn-pieui.swarm.ing/api.
Create A Project
Create a new project, install pieui, write the starter files, and start a dev server on port 8008:
uv run pie create my-app
Generated layout:
my-app/
web.py
pages/
main.py
components/
The command runs:
uv init my-app
uv add pieui
uv run uvicorn web:app --port 8008
Web Commands
Load a Web object from module:attribute:
uv run pie web web:web
Verify that every page has a fields attribute:
uv run pie web web:web verify
Build static JSON from page fields into build.json:
uv run pie web web:web build
Card Commands
Add
Create a Python card file in PIE_COMPONENTS_DIR.
uv run pie card add simple MyCard
uv run pie card add complex MyCard
uv run pie card add container MyCard
uv run pie card add complex-container MyCard
Optional template modifiers:
uv run pie card add simple MyCard --io
uv run pie card add simple MyCard --ajax
uv run pie card add simple MyCard --io --ajax
Names are normalized to a Python class and snake-case filename. For example:
MyCard -> MyCard -> pages/components/my_card.py
trade widget -> TradeWidget -> pages/components/trade_widget_card.py
If the target file already exists, the command prints the existing path and does not overwrite it.
List
Scan PIE_COMPONENTS_DIR recursively for Python classes inheriting Card or InputCard:
uv run pie card list
The table includes inferred card type, Ajax support, IO support, and file path.
View
Print a plain-text report for one card:
uv run pie card view MyCard
The command reads the expected file from PIE_COMPONENTS_DIR, parses the class, and prints:
Name
File
Props
Ajax
IO
Events
List Events
Print events returned by get_supported_events():
uv run pie card list-events MyCard
If the card file or events are absent, the command prints No events found for MyCard.
Add Event
This command exists in the CLI, but Python source editing is not implemented:
uv run pie card add-event MyCard alert
It exits with:
[pie] Error: add-event requires TypeScript AST editing and is not implemented
Push
Upload one local Python card file to pieui-storage through the language batch API:
uv run pie card push MyCard
For MyCard, the CLI uploads:
pages/components/my_card.py
Remote key shape:
PIE_USER_ID/PIE_PROJECT/MyCard/python/my_card.py
The file request uses:
PUT /api/components/{user_id}/{project_slug}/{component_name}/batch/python
The command also uploads component capability metadata to eventSchema:
{
"component": "MyCard",
"input": false,
"ajax": false,
"io": false
}
Flags are inferred from the Python class:
input: the class inheritsInputCard.ajax: the class declares any ofpathname,deps_names, orkwargs.io: the class declares any ofuse_socketio_support,use_centrifuge_support,use_mitt_support, orcentrifuge_channel.
PIE_USER_ID is required for storage writes. PIE_PROJECT or PIE_PROJECT_SLUG selects the project.
Pull From Another User
Download Python files for a component owned by another user into PIE_COMPONENTS_DIR:
uv run pie card pull alice/MyCard
The project slug still comes from PIE_PROJECT, PIE_PROJECT_SLUG, or the current directory name.
Remote List
List remote components for a user/project:
uv run pie card remote list
uv run pie card remote list --user alice
uv run pie card remote list --user alice --project demo
Without flags, the command uses PIE_USER_ID and PIE_PROJECT / PIE_PROJECT_SLUG.
Remote Pull
Pull a component from the configured PIE_USER_ID and project:
uv run pie card remote pull MyCard
Downloaded Python files are written under PIE_COMPONENTS_DIR.
Page Commands
Add
Create a page module under the parent directory of PIE_COMPONENTS_DIR and register it in web.py:
uv run pie page add dashboard
uv run pie page add admin/users
With the default PIE_COMPONENTS_DIR=pages/components, page files are written to pages/.
Examples:
dashboard -> pages/dashboard.py -> route "dashboard"
admin/users -> pages/admin_users.py -> route "admin/users"
web.py must exist next to the pages/ directory and contain a web = Web({...}) assignment with a literal pages dictionary.
View
Import a page module and print page details:
uv run pie page view dashboard
The report includes:
Page
Module
Path
is_typed
Form process
Ajax
Login
Start the browser login flow:
uv run pie login
The command:
- Generates a one-time code.
- Opens
https://pieui.swarm.ing/connect?code=.... - Polls
https://api-pieui.swarm.ing/api/external/credentials. - Saves the returned config to
.pie/config.json. - Appends
PIE_USER_ID,PIE_PROJECT, andPIE_API_KEYto.env.
The returned config must contain these keys:
user_id
project
api_key
Current Command Reference
pie --help
pie web MODULE:ATTR [verify|build]
pie card add {simple,complex,container,complex-container} NAME [--io] [--ajax]
pie card list
pie card push NAME
pie card pull USER/COMPONENT
pie card view NAME
pie card list-events NAME
pie card add-event NAME EVENT_NAME
pie card remote list [--user USER_ID] [--project SLUG]
pie card remote pull NAME
pie page add NAME
pie page view NAME
pie create NAME
pie login
Code Layout
pie/__main__.py CLI argument parsing and dispatch
pie/config.py environment-backed settings
pie/code/card_add.py card template generation
pie/code/card_list.py local card discovery
pie/code/card_inspect.py card view and event inspection
pie/code/card_push.py single-card upload command
pie/code/card_pull.py USER/COMPONENT pull command
pie/code/card_remote.py configured remote list/pull commands
pie/code/page_create.py page generation, web.py registration, page view
pie/code/create.py project scaffolding
pie/code/login.py PieUI login flow
pie/code/web.py Web loader and verifier
pie/code/build.py build.json generation
pie/code/services/storage.py pieui-storage API client
pie/code/services/models.py storage response models
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pieui-0.1.11.tar.gz.
File metadata
- Download URL: pieui-0.1.11.tar.gz
- Upload date:
- Size: 47.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a7a16f15d96726275a5c0b4f0caa51cebb549f26943625c56430e0906bf2b9d
|
|
| MD5 |
045bd8a597e8a9c9783a42c2d7be9b3a
|
|
| BLAKE2b-256 |
ca303a35b3c2673a57272ccf13d4b50aba3c1c5f70d8c4a253c243ea8fd992fd
|
Provenance
The following attestation bundles were made for pieui-0.1.11.tar.gz:
Publisher:
publish.yml on Swarm-AI-Labs/pie
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pieui-0.1.11.tar.gz -
Subject digest:
8a7a16f15d96726275a5c0b4f0caa51cebb549f26943625c56430e0906bf2b9d - Sigstore transparency entry: 1343370709
- Sigstore integration time:
-
Permalink:
Swarm-AI-Labs/pie@be9df80e0adf2f83c05295851b75dae166abc8cc -
Branch / Tag:
refs/tags/v0.1.11 - Owner: https://github.com/Swarm-AI-Labs
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@be9df80e0adf2f83c05295851b75dae166abc8cc -
Trigger Event:
push
-
Statement type:
File details
Details for the file pieui-0.1.11-py3-none-any.whl.
File metadata
- Download URL: pieui-0.1.11-py3-none-any.whl
- Upload date:
- Size: 76.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9391ee3f08250038a9db43a8065423fec843096fdb4299d54c8200214a5ba8c3
|
|
| MD5 |
5a48cde0693200b2de0f2791eda70b61
|
|
| BLAKE2b-256 |
f97bf19d4b42a5cfc5008875e82e23a39290d1bd8d35289db3d18bc4126ece40
|
Provenance
The following attestation bundles were made for pieui-0.1.11-py3-none-any.whl:
Publisher:
publish.yml on Swarm-AI-Labs/pie
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pieui-0.1.11-py3-none-any.whl -
Subject digest:
9391ee3f08250038a9db43a8065423fec843096fdb4299d54c8200214a5ba8c3 - Sigstore transparency entry: 1343370720
- Sigstore integration time:
-
Permalink:
Swarm-AI-Labs/pie@be9df80e0adf2f83c05295851b75dae166abc8cc -
Branch / Tag:
refs/tags/v0.1.11 - Owner: https://github.com/Swarm-AI-Labs
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@be9df80e0adf2f83c05295851b75dae166abc8cc -
Trigger Event:
push
-
Statement type: