Skip to main content

Python runner for an interactive litex terminal session.

Project description

litexpy

Python runner for an interactive litex terminal session.

Links

Prerequisites

litexpy starts the local litex command in an interactive terminal session. It does not bundle the Litex executable, so install Litex first if litex is not already available in your terminal.

If you already have Litex

If litex -version works in your terminal, install only the Python package:

pip install litexpy

If you have not installed Litex

Install Litex first locally on your machine, then install litexpy.

Setup guide: https://litexlang.com/doc/Setup

Usage

Create a runner:

import litexpy

runner = litexpy.Runner()

Run Litex code and read the JSON results:

results = runner.run("1 = 1")

print(results[0]["result"])
print(results[0]["stmt"])

Run multiple input lines in the same interactive Litex session:

results = runner.run("1 = 1\n0 = 0")

Clear the Litex session:

clear_result = runner.clear()

Close the Litex process:

runner.quit()

Use a custom Litex command path or argument list:

runner = litexpy.Runner("/path/to/litex")
runner = litexpy.Runner(["/path/to/litex"])

Use the factory helper:

runner = litexpy.runner()

Read the installed package version:

print(litexpy.__version__)

litexpy exposes Runner, runner(), and __version__. Runner() starts the litex command in an interactive terminal process. run(script) sends script to that process and returns the JSON results as a list of Python dict objects. clear() is equivalent to run("clear"). quit() closes the running litex process.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

litexpy-0.0.6.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

litexpy-0.0.6-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file litexpy-0.0.6.tar.gz.

File metadata

  • Download URL: litexpy-0.0.6.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for litexpy-0.0.6.tar.gz
Algorithm Hash digest
SHA256 54bdd5f2aa2894c29e52d54977fdd277983a360b224f694a1d8b3deb1c8447d2
MD5 70fbfae21725134b13b6d0e11ac584fb
BLAKE2b-256 4a8f39c78f3ea6625a6549e871408a5c9f97c16cd85f0cb63326f4a8966e38aa

See more details on using hashes here.

File details

Details for the file litexpy-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: litexpy-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for litexpy-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 d29e262e03f3af53a1975c0cd19322b912df83422e3e3207eea043688a2f65f7
MD5 0503df6d6301bce9ea925e60b13cddb2
BLAKE2b-256 909dc4389dab5af9368310ae2250cf3ada782d1deb2b68a3aa033e7ac16e936a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page