Skip to main content

Python package for Litex core

Project description

Pylitex

This is a Python api library for Litex core, which aims to help Python users to interact with Litex core.

installation

This reuqires Litex core and Python(version >= 3.12), you could install Litex core follow the Installation.

After Litex core installation, you could install litex for your python environment:

# change your Python env to which your are using
# then run following commands
pip install pylitex

usage

Import pylitex as you installed.

import pylitex

run fill code

# run full code
result = pylitex.run("code...")

# run full codes with multi-process
results = pylitex.run_batch(["code1...", "code2..."], 2)

run continuous codes

# run continuous codes in one litex env
litex_runner = pylitex.Runner()
result1 = litex_runner.run("code1...")
result2 = litex_runner.run("code2...")
litex_runner.close()

# run continuous code in litex multi-process pool
litex_pool = pylitex.RunnerPool()
litex_pool.inject_code({id: "id1", code: "code1..."})
litex_pool.inject_code({id: "id2", code: "code2..."})
litex_pool.inject_code({id: "id1", code: "code3..."})
litex_pool.inject_code({id: "id1", code: "code4..."})
litex_pool.inject_code({id: "id2", code: "code5..."})
results = litex_pool.get_results()
litex_pool.close()

return type

For pylitex.run() and pylitex.Runner().run(), the return type is a python dict like (Call it pylitexResult):

{"truely": boolean, "payload": str, "msg": str}

For pylitex.run_batch(), the return type is a python list[pylitexResult] like:

[
    {"truely": boolean, "payload": str, "msg": str},
    {"truely": boolean, "payload": str, "msg": str},
    ...
]

For pylitex.RunnerPool().get_results(), the return type is a python dict[list[pylitexResult]] like:

{
    "id1": [
        {"truely": boolean, "payload": str, "msg": str},
        {"truely": boolean, "payload": str, "msg": str},
        {"truely": boolean, "payload": str, "msg": str},
        ...
    ],
    "id2": [
        {"truely": boolean, "payload": str, "msg": str},
        {"truely": boolean, "payload": str, "msg": str},
        ...
    ],
    ...
}

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

pylitex-0.1.10.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

pylitex-0.1.10-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file pylitex-0.1.10.tar.gz.

File metadata

  • Download URL: pylitex-0.1.10.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for pylitex-0.1.10.tar.gz
Algorithm Hash digest
SHA256 432995a86756da0d6811847cf42d73294c54cc16be227e8e2e3e659ac8eae317
MD5 c01f5fdde06b25ee83e07c5e504f4b41
BLAKE2b-256 30bfed6e9746d0658d183eecca41c988a99422015eece13d3b80f2975793c221

See more details on using hashes here.

File details

Details for the file pylitex-0.1.10-py3-none-any.whl.

File metadata

  • Download URL: pylitex-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for pylitex-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 d70446efc0419712fbc5aca3dd4f23828852116d3cf042819f62e160e4db407a
MD5 c7114de9a34f5e629f283f5819f16bd8
BLAKE2b-256 691f231a8ab7b32608de2f620e0ab05396667d171dae9ac59b9f74edcb9e7085

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