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()

Runner() starts the litex command from your PATH 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.7.tar.gz (3.0 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.7-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: litexpy-0.0.7.tar.gz
  • Upload date:
  • Size: 3.0 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.7.tar.gz
Algorithm Hash digest
SHA256 f2ab9a993453e4513c040ff0e31368f8c90710ffc35d83e4305a87bb7dbe3511
MD5 501bc28ee1924699a25dc59b82f2495a
BLAKE2b-256 b30feee963b0639501957e76df0e6a22deab27081e60d79bbc2ed1fad7b536d6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: litexpy-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 3.3 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 4377b2e57312500078c370563226c78433d776995cb7862d26874aa58e7478ff
MD5 32d1b6ad8c6c2d64d92f398def912f60
BLAKE2b-256 3ef037bae0c2076085d1b0d859d185b528b0dc30c0db4a6d5d44673a3b66922a

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