What is WebComPy
WebComPy is a Python frontend framework for PyScript with the following features.
- Component-based declarative rendering
- Automatic DOM refreshing
- Built-in router
- CLI tools (Project scaffolding, Dev server, Static Site Generator)
- Dependency management with lock file sync
Get started with uv (Recommended)
Create a new project and set up dependencies using uv. Add browser dependencies to in : Configure with : Generate the lock file and start the dev server:
mkdir webcompy-project && cd webcompy-project
uv init
uv add "webcompy @ git+https://github.com/kniwase/WebComPy.git#subdirectory=packages/webcompy"
uv add "webcompy-server @ git+https://github.com/kniwase/WebComPy.git#subdirectory=packages/webcompy-server"
uv add "webcompy-cli @ git+https://github.com/kniwase/WebComPy.git#subdirectory=packages/webcompy-cli"
uv run python -m webcompy init[project.optional-dependencies]pyproject.toml[project.optional-dependencies]
browser = ["numpy", "matplotlib"]webcompy_config.pyLockfileSyncConfig# webcompy_config.py
import app.app as app_module
from webcompy_cli.config import WebComPyBuildConfig, LockfileSyncConfig
config = WebComPyBuildConfig(
app_module,
dependencies=None,
dependencies_from="browser",
lockfile_sync_config=LockfileSyncConfig(sync_group="browser"),
)uv run python -m webcompy lock
uv run python -m webcompy start --devGet started with Poetry
If you prefer Poetry, use the following setup: Add browser dependencies to in (same as the uv setup above).
Then configure as shown above, and run: Note: uses or , not . Use to compare versions with .
poetry new webcompy-project && cd webcompy-project
poetry add "git+https://github.com/kniwase/WebComPy.git#subdirectory=packages/webcompy"
poetry add "git+https://github.com/kniwase/WebComPy.git#subdirectory=packages/webcompy-server"
poetry add "git+https://github.com/kniwase/WebComPy.git#subdirectory=packages/webcompy-cli"
poetry run python -m webcompy init[project.optional-dependencies]pyproject.tomlThen configure
webcompy_config.pypoetry run python -m webcompy lock
poetry run python -m webcompy start --devwebcompy lock --installuv pippippoetry installwebcompy lock --syncpyproject.tomlLock File Commands
| Command | Description |
|---|---|
webcompy lock | Generate or update the lock file |
webcompy lock --export | Export lock file dependencies to requirements.txt |
webcompy lock --sync | Compare lock file with pyproject.toml / requirements.txt |
webcompy lock --install | Export and install lock file dependencies |