Skip to content

Getting Started

This guide walks through the core workflow: installing a Python version, creating a project, syncing dependencies, and running code.

Pyra ships as a single binary.

Terminal window
curl -fsSL https://tlo3.com/pyra-install.sh | sh

The install script downloads the correct GitHub Release archive, verifies the published checksum, and installs pyra onto your PATH.

If you need a specific release, set PYRA_VERSION:

Terminal window
curl -fsSL https://tlo3.com/pyra-install.sh | env PYRA_VERSION=0.1.0 sh

Verify the installation:

Terminal window
pyra --version

Update Pyra later:

Terminal window
pyra self update

Pyra manages Python installations from python-build-standalone. Installed Pythons are stored centrally and shared across projects.

Search for available versions:

Terminal window
pyra python search 3.13

Install one:

Terminal window
pyra python install 3.13

List installed versions:

Terminal window
pyra python list

Create a new Python project in the current directory:

Terminal window
pyra init --python 3.13

This creates:

  • pyproject.toml — project metadata and dependency declarations
  • pylock.toml — resolved dependency state (initially empty)

The --python flag pins a managed Python version in [tool.pyra].python.

If you already have a pyproject.toml, pin a managed Python version:

Terminal window
pyra use 3.13

This writes the version to [tool.pyra].python and refreshes the centralized environment to use the selected interpreter.

A pinned Python version is required before pyra sync will run.

Add packages to your project:

Terminal window
pyra add requests
pyra add pytest --group dev

Each add edits pyproject.toml and runs the full sync pipeline — resolve, lock, reconcile.

Sync reconciles the centralized environment from pyproject.toml and pylock.toml:

Terminal window
pyra sync

The sync pipeline:

  1. Reads dependency inputs from pyproject.toml
  2. Checks whether pylock.toml is fresh
  3. Resolves and rewrites the lock if stale or missing
  4. Reconciles the environment exactly from the lock

Sync is idempotent. Running it twice with no changes is a no-op.

Terminal window
pyra sync --locked
pyra sync --frozen

Both modes fail if the lock is missing or stale, which is useful for CI where you want to catch drift.

Execute scripts and commands through the synchronized environment:

Terminal window
pyra run main.py
pyra run serve

pyra run ensures the environment is synchronized before execution. Child exit codes are propagated.

Run diagnostics without changing any state:

Terminal window
pyra doctor

Doctor reports actionable findings about interpreter state, lock freshness, and environment drift.