Skip to content

Python toolchain

What Elide's Python toolchain covers in 1.6.0: the optional Python component, running scripts and modules, pyproject.toml entry points, virtual environments, tests, and what is not available.

On this page

Python support is experimental in 1.6.0. Elide runs Python 3.13 with its standard library; it does not install PyPI packages, format Python, or run Python tests under elide test.

TaskCommandStatus
Add Python to an installelide setup pythonAvailable
Run a script, -c or -melide python ..., elide run app.pyAvailable
Run a pyproject.toml entry pointelide run NAMEAvailable
Use packages from a virtual environmentVIRTUAL_ENV=.venv elide python app.pyAvailable
Run unittest or pytestelide python -m unittest, elide python -m pytestAvailable
Install PyPI packageselide installNot available; use a virtual environment
Discover Python testselide testNot available
Format, LSP, elide init templateNot available

Add Python

Python is an optional component:

elide setup python

Without it, Python commands print Python support is not installed. Run 'elide setup python' to add it. and exit 2. See Python with Elide for channels and package-manager installs.

Run Python

elide python takes the same arguments as python; elide run and a bare elide app.py run .py files too:

elide python app.py --name Elide
elide python -m json.tool input.json
elide run app.py

Interpreter flags (-I, -B, -u, -W, …) are listed in Python with Elide.

Run project scripts

elide run NAME runs a [project.scripts] entry point from the pyproject.toml in the current directory. No elide.pkl is needed.

# pyproject.toml
[project]
name = "greet"
version = "0.1.0"
requires-python = ">=3.13"

[project.scripts]
greet = "greet.cli:main"
# greet/cli.py
import sys


def greeting(name: str) -> str:
    return f"Hello, {name}!"


def main() -> int:
    print(greeting(sys.argv[1] if len(sys.argv) > 1 else "world"))
    return 0
elide run greet Elide
Hello, Elide!

elide greet Elide does the same. Arguments after the name go to sys.argv, and the function’s integer return value is the exit code. A file named greet, an elide.pkl script or a package.json script of the same name wins; see Project setup.

Packages

elide install installs no PyPI packages, and elide install --ecosystems=pypi exits 2. Install packages into a Python 3.13 virtual environment with another tool and point Elide at it with VIRTUAL_ENV; see Packages and virtual environments.

Tests

Run unittest or pytest through elide python -m; see Python tests. elide test runs JavaScript, TypeScript and JUnit tests only.

Samples

elide init has no Python template.

Known limitations

  • C extensions: some C extension modules do not load.
  • pip: not bundled; elide python -m pip fails with No module named pip.
  • More: Python with Elide.

Was this page helpful?