https://github.com/openqasm/openqasm-pygments
Pygments tools for OpenQASM programs
https://github.com/openqasm/openqasm-pygments
Last synced: about 1 year ago
JSON representation
Pygments tools for OpenQASM programs
- Host: GitHub
- URL: https://github.com/openqasm/openqasm-pygments
- Owner: openqasm
- License: apache-2.0
- Created: 2022-06-20T12:05:34.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-04-11T16:26:58.000Z (about 3 years ago)
- Last Synced: 2025-04-23T01:03:34.647Z (about 1 year ago)
- Language: Python
- Homepage:
- Size: 283 KB
- Stars: 5
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Pygments tools for OpenQASM
[](https://opensource.org/licenses/Apache-2.0)[](https://github.com/openqasm/openqasm-pygments/releases)[](https://pypi.org/project/openqasm-pygments/)
This repository provides the Python package `openqasm-pygments`, which provides
a lexer for syntax highlighting OpenQASM code with [Pygments](https://pygments.org/).
There are current three lexers included, all of which register themselves with
Pygments when this package is installed:
- `OpenQASM3Lexer` (Pygments aliases `openqasm3` and `qasm3`), for parsing
OpenQASM 3 code. Most OpenQASM 2 programs will lex acceptably with this lexer
as well, except for some keyword differences.
- `OpenQASM2Lexer` (aliases `openqasm2` and `qasm2`), for lexing OpenQASM 2
programs.
- `OpenPulseLexer` (aliases `openpulse`), for lexing the OpenPulse pulse
calibration dialect also defined in the OpenQASM 3 specification. For the
most part, this lexer will not be used as a root, but the `OpenQASM3Lexer`
will delegate lexing of calibration blocks to it, when required.
## Installation
Install the latest release of `openqasm-pygments` package from pip:
```bash
pip install openqasm-pygments
```
This will automatically install all the dependencies as well (Pygments, for
example) if they are not already installed.
## Developing
If you're looking to contribute to this project, please first read
[our contributing guidelines](CONTRIBUTING.md).
Set up your development environment by installing the development requirements
with pip:
```bash
pip install -r requirements-dev.txt tox
```
This installs a few more packages than the dependencies of the package at
runtime, because there are some tools we use for testing also included, such as
`tox` and `pytest`.
After the development requirements are installed, you can install an editable
version of the package with
```bash
pip install -e .
```
After this, any changes you make to the library code will immediately be present
when you open a new Python interpreter session.
## License
This project is licensed under [version 2.0 of the Apache License](LICENSE).
This is a Qiskit project.