Zum Inhalt springen

Diese Seite ist noch nicht übersetzt und wird auf Englisch angezeigt.

Elide for Python users

Switching from CPython to Elide: running Python 3.13 with the same command-line arguments, what changes, benchmarks, strengths and weaknesses.

Auf dieser Seite

Elide runs Python 3.13 programs with CPython’s command-line arguments, from the same binary that runs JavaScript, TypeScript, Java and Kotlin.

Python support is experimental in 1.6.0.

Run the same code

Add the optional Python component once:

elide setup python

Then use elide python in place of python:

elide python app.py --name Elide              # sys.argv: ['app.py', '--name', 'Elide']
elide python -c 'import sys; print(sys.version)'
elide python -m json.tool input.json
elide run app.py                              # same program, general runner

These work unchanged:

  • Scripts, -c, -m, - (standard input), and the REPL (bare elide python).
  • Interpreter flags such as -I, -E, -S, -B, -u, -O and -W; the full list is in Python with Elide.
  • The Python 3.13 standard library, including json, pathlib, sqlite3, ssl, ctypes, bz2 and lzma.
  • Packages from an existing Python 3.13 virtual environment, through VIRTUAL_ENV:
export VIRTUAL_ENV=/path/to/venv   # Elide reads $VIRTUAL_ENV/lib/python3.13/site-packages
elide python app.py

What changes

With CPythonWith Elide
python app.pyelide python app.py or elide run app.py
python -c CMD, python -m MODULEelide python -c CMD, elide python -m MODULE
Install CPythonelide setup python
pip install PACKAGENo equivalent; elide install --ecosystems=pypi exits 2.
python -m venv, source .venv/bin/activateInstall into a Python 3.13 venv with CPython’s pip; set VIRTUAL_ENV.
pytestelide python -m pytest with pytest in the venv; elide test finds no Python tests. See Python tests.
timeout 30 python app.pyelide --timeout 30s python app.py; exits 124 when the limit is exceeded.

Benchmarks

Hello-world startup with hyperfine -N -w 10 (10 warmup runs, 100 measured) on a 24-core Linux workstation:

CommandMean
elide run hello.py4.8 ± 0.3 ms
python3 hello.py6.0 ± 0.3 ms

No other Python benchmark is published for 1.6.0.

Strengths

  • bz2 and lzma work without system libbz2 or liblzma.
  • Python calls JavaScript, and JavaScript or TypeScript imports Python modules, in one process with --interop.
  • The same binary runs JavaScript, TypeScript and JVM code and builds JVM projects.

Weaknesses

  • No pip and no Python test runner.
  • Some C extension modules do not load.
  • Some edge cases differ from CPython 3.13: 93.8% of CPython core tests pass (Compatibility Matrix).
  • macOS has no native module isolation.
  • With Python installed, WebAssembly SIMD modules are rejected; see WebAssembly with Elide.

Next steps

War diese Seite hilfreich?