Facilitate tree-sitter-epics parsing in python
Project description
PY-TREE-SITTER-EPICS
Based on Tree sitter , tree-sitter-epics and Py-tree-sitter, this module is used to serialize any EPICS files into a Python object usable in a script.
⚠️ For now it is only developped for EPICS CA database but it will support more files in the future.
Installation
The module is available on Pypi. This package currently only works with Python >3.10. The library dependencis is tree-sitter-epics
pip3 install py-tree-sitter-epics
You may need to use this line
pip3 install py-tree-sitter-epics --break-system-packages
Using
This example show how to use the module. It is parsing a file building a python object containing all the fields, infos and links to finally displaying all those infos.
from py_tree_sitter_epics import epicsdb
with Path.open("/tmp/myExample.db") as file:
code = file.read()
#build the parser
db_parser = epicsdb.DbParser()
#parse the code
db_parser.parse(code)
#build record list from the parser
record_list = db_parser.build_records_list()
for record in reccord_list:
#print a complete result
record.print_to_text()
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
Built Distribution
File details
Details for the file py_tree_sitter_epics-0.1.6.tar.gz
.
File metadata
- Download URL: py_tree_sitter_epics-0.1.6.tar.gz
- Upload date:
- Size: 228.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.11.4 Linux/6.2.0-39-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13efc266fd28a97ff31b574bb9ca7ef7b1544865dbd20b25bd4abf9bb294c0e2 |
|
MD5 | 6927825a3a9bd8d42478387238c4fcfd |
|
BLAKE2b-256 | 93c45ce2470a288cfca1efc934315d8e702e5595713cc8faa9fc9a3d097f02e2 |
File details
Details for the file py_tree_sitter_epics-0.1.6-py3-none-any.whl
.
File metadata
- Download URL: py_tree_sitter_epics-0.1.6-py3-none-any.whl
- Upload date:
- Size: 266.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.11.4 Linux/6.2.0-39-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9911c77b9c497edfd64af9f75a94bf9f438f06077addf014b695e2b31dafd07b |
|
MD5 | 4bf51c530026088582587428a54bcfa6 |
|
BLAKE2b-256 | 32cd7d7bd07eec398cbd68bceb8d3fe6f7b91d0c26b4333102c84c701e04ec41 |