| Name | qupac JSON | 
            
| Version | 
                  0.2.0
                   
                  JSON | 
            
 | download  | 
            
| home_page | None  | 
            
| Summary | Qupac (Quantum Python Abstraction Compiler): lightweight language for quantum circuits transpiled to Qiskit 2.x | 
            | upload_time | 2025-10-23 06:06:23 | 
            | maintainer | None | 
            
            | docs_url | None | 
            | author | Amol Yadav | 
            
            | requires_python | >=3.9 | 
            
            
            | license | MIT License
        
        Copyright (c) 2025  
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
         | 
            | keywords | 
                
                    quantum
                
                     qiskit
                
                     dsl
                
                     compiler
                
                     transpiler
                 | 
            | VCS | 
                
                    | 
                
            
            | bugtrack_url | 
                
                 | 
             
            
            | requirements | 
                
                  No requirements were recorded.
                
             | 
            
| Travis-CI | 
                
                   No Travis.
                
             | 
            | coveralls test coverage | 
                
                   No coveralls.
                
             | 
        
        
            
            # Qupac (Quantum Python Abstraction Compiler)
A lightweight language to design quantum circuits and transpile them to Python code using Qiskit 2.x. Write simple gate instructions; Qupac parses, transpiles, and can run the generated Python for simulation.
## Highlights
- Minimal syntax for qubit/classical declarations, gate application, measurement, and simulate.
- CLI runs generated Python in the background by default on Windows.
- Optionally emit the generated Python without running it.
## Project layout
- `qupac/grammar.lark` — Lark grammar for the language
- `qupac/parser.py` — Parser and transformer to an IR
- `qupac/transpiler.py` — IR -> Python (Qiskit 2.x) code generator
- `qupac/executor.py` — Runs generated Python (bg/fg)
- `qupac/cli.py` — CLI entrypoint (background by default)
## Language quick reference
- Use statement: `use qiskit`
- Qubits: `qubits: <int>`
- Classical bits (optional): `classical: <int>`
- Apply gate: `apply H to 0` or `apply CX from 0 to 1`
  - Entangle two qubits: `entangle 0,1` (shorthand for `apply CX from 0 to 1`)
  - Put a qubit in superposition: `superpose 0` (shorthand for `apply H to 0`)
- Measure all: `measure all`
- Measure one: `measure 0 -> 0`
- Execute: `simulate`
  - Shots (number of measurement samples): `shots: 1024` (default 1024 if not provided)
  - Optimization level for transpile: `optimize: 0|1|2|3` (maps to Qiskit's optimization_level)
  - Draw the generated circuit: `draw` or `draw mpl` (text drawing is default; `mpl` attempts a matplotlib rendering)
- Simulator backend method: `simulator: default|statevector|unitary`
- Simple noise model (depolarizing): `noise depol p=0.01` (requires qiskit-aer noise modules)
- Comments: lines starting with `#` or `//`
## Examples
Basic:
```
use qiskit
qubits: 2
entangle 0,1
measure all
simulate
```
Superpose:
```
use qiskit
qubits: 1
superpose 0
measure all
simulate
```
Draw and simulation options:
```
use qiskit
qubits: 2
entangle 0,1
draw
shots: 2048
optimize: 1
simulate
```
Parameterized gates and statevector:
```
use qiskit
qubits: 1
apply RY(1.5708) to 0
draw
simulator: statevector
shots: 1
simulate
```
Noise (depolarizing):
```
use qiskit
qubits: 2
entangle 0,1
noise depol p=0.02
shots: 2048
simulate
```
## Setup
1) Create and activate a Python 3.9+ environment.
2) Install dependencies (Qiskit is large; installing only Lark lets you test parsing/transpiling):
   - Minimal (parser/transpiler only):
     pip install lark
   - Full (to actually run/simulate):
     pip install -r requirements.txt
## Developer setup (lint, type-check, tests)
- Using pip extras:
  pip install -e .[dev]
- Or individually:
  pip install ruff mypy pytest
- Lint (Ruff):
  ruff check .
- Type check (mypy):
  mypy qupac
- Run tests (pytest):
  pytest -q
## How to run
- Emit generated Python (no Qiskit needed):
  python -m qupac.cli --emit examples/main.qu
- Run generated Python in the background (requires Qiskit installed):
  python -m qupac.cli examples/main.qu
- Run in foreground/blocking (requires Qiskit installed):
  python -m qupac.cli --fg examples/main.qu
## License
MIT
            
         
        Raw data
        
            {
    "_id": null,
    "home_page": null,
    "name": "qupac",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "quantum, qiskit, dsl, compiler, transpiler",
    "author": "Amol Yadav",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/47/fa/0636b7547f88ae2e633729eddd0c35ac0325fd4feabb9ecf48517eb93c98/qupac-0.2.0.tar.gz",
    "platform": null,
    "description": "# Qupac (Quantum Python Abstraction Compiler)\r\n\r\nA lightweight language to design quantum circuits and transpile them to Python code using Qiskit 2.x. Write simple gate instructions; Qupac parses, transpiles, and can run the generated Python for simulation.\r\n\r\n## Highlights\r\n- Minimal syntax for qubit/classical declarations, gate application, measurement, and simulate.\r\n- CLI runs generated Python in the background by default on Windows.\r\n- Optionally emit the generated Python without running it.\r\n\r\n## Project layout\r\n- `qupac/grammar.lark` \u2014 Lark grammar for the language\r\n- `qupac/parser.py` \u2014 Parser and transformer to an IR\r\n- `qupac/transpiler.py` \u2014 IR -> Python (Qiskit 2.x) code generator\r\n- `qupac/executor.py` \u2014 Runs generated Python (bg/fg)\r\n- `qupac/cli.py` \u2014 CLI entrypoint (background by default)\r\n\r\n## Language quick reference\r\n- Use statement: `use qiskit`\r\n- Qubits: `qubits: <int>`\r\n- Classical bits (optional): `classical: <int>`\r\n- Apply gate: `apply H to 0` or `apply CX from 0 to 1`\r\n  - Entangle two qubits: `entangle 0,1` (shorthand for `apply CX from 0 to 1`)\r\n  - Put a qubit in superposition: `superpose 0` (shorthand for `apply H to 0`)\r\n- Measure all: `measure all`\r\n- Measure one: `measure 0 -> 0`\r\n- Execute: `simulate`\r\n  - Shots (number of measurement samples): `shots: 1024` (default 1024 if not provided)\r\n  - Optimization level for transpile: `optimize: 0|1|2|3` (maps to Qiskit's optimization_level)\r\n  - Draw the generated circuit: `draw` or `draw mpl` (text drawing is default; `mpl` attempts a matplotlib rendering)\r\n- Simulator backend method: `simulator: default|statevector|unitary`\r\n- Simple noise model (depolarizing): `noise depol p=0.01` (requires qiskit-aer noise modules)\r\n- Comments: lines starting with `#` or `//`\r\n\r\n## Examples\r\n\r\nBasic:\r\n```\r\nuse qiskit\r\nqubits: 2\r\nentangle 0,1\r\nmeasure all\r\nsimulate\r\n```\r\n\r\nSuperpose:\r\n```\r\nuse qiskit\r\nqubits: 1\r\nsuperpose 0\r\nmeasure all\r\nsimulate\r\n```\r\n\r\nDraw and simulation options:\r\n```\r\nuse qiskit\r\nqubits: 2\r\nentangle 0,1\r\ndraw\r\nshots: 2048\r\noptimize: 1\r\nsimulate\r\n```\r\n\r\nParameterized gates and statevector:\r\n```\r\nuse qiskit\r\nqubits: 1\r\napply RY(1.5708) to 0\r\ndraw\r\nsimulator: statevector\r\nshots: 1\r\nsimulate\r\n```\r\n\r\nNoise (depolarizing):\r\n```\r\nuse qiskit\r\nqubits: 2\r\nentangle 0,1\r\nnoise depol p=0.02\r\nshots: 2048\r\nsimulate\r\n```\r\n\r\n## Setup\r\n1) Create and activate a Python 3.9+ environment.\r\n2) Install dependencies (Qiskit is large; installing only Lark lets you test parsing/transpiling):\r\n   - Minimal (parser/transpiler only):\r\n     pip install lark\r\n   - Full (to actually run/simulate):\r\n     pip install -r requirements.txt\r\n\r\n## Developer setup (lint, type-check, tests)\r\n- Using pip extras:\r\n  pip install -e .[dev]\r\n- Or individually:\r\n  pip install ruff mypy pytest\r\n\r\n- Lint (Ruff):\r\n  ruff check .\r\n- Type check (mypy):\r\n  mypy qupac\r\n- Run tests (pytest):\r\n  pytest -q\r\n\r\n## How to run\r\n- Emit generated Python (no Qiskit needed):\r\n  python -m qupac.cli --emit examples/main.qu\r\n- Run generated Python in the background (requires Qiskit installed):\r\n  python -m qupac.cli examples/main.qu\r\n- Run in foreground/blocking (requires Qiskit installed):\r\n  python -m qupac.cli --fg examples/main.qu\r\n\r\n## License\r\nMIT\r\n",
    "bugtrack_url": null,
    "license": "MIT License\r\n        \r\n        Copyright (c) 2025  \r\n        \r\n        Permission is hereby granted, free of charge, to any person obtaining a copy\r\n        of this software and associated documentation files (the \"Software\"), to deal\r\n        in the Software without restriction, including without limitation the rights\r\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n        copies of the Software, and to permit persons to whom the Software is\r\n        furnished to do so, subject to the following conditions:\r\n        \r\n        The above copyright notice and this permission notice shall be included in all\r\n        copies or substantial portions of the Software.\r\n        \r\n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n        SOFTWARE.\r\n        ",
    "summary": "Qupac (Quantum Python Abstraction Compiler): lightweight language for quantum circuits transpiled to Qiskit 2.x",
    "version": "0.2.0",
    "project_urls": {
        "Homepage": "https://pypi.org/project/qupac/",
        "Repository": "https://example.com/your-repo"
    },
    "split_keywords": [
        "quantum",
        " qiskit",
        " dsl",
        " compiler",
        " transpiler"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "8392d6236cb54165d3f852f3dac4d8e93d3e682f9cb9526d123a531b423929c6",
                "md5": "6fa0dde43708c1cb54bdd8e41c6e378b",
                "sha256": "5731e8d161faaa501178888cc2e33338f8070d70882b27525bb8965b28e14575"
            },
            "downloads": -1,
            "filename": "qupac-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6fa0dde43708c1cb54bdd8e41c6e378b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 17223,
            "upload_time": "2025-10-23T06:05:30",
            "upload_time_iso_8601": "2025-10-23T06:05:30.617430Z",
            "url": "https://files.pythonhosted.org/packages/83/92/d6236cb54165d3f852f3dac4d8e93d3e682f9cb9526d123a531b423929c6/qupac-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "47fa0636b7547f88ae2e633729eddd0c35ac0325fd4feabb9ecf48517eb93c98",
                "md5": "5eea9d166b9e98c887bd2af182122a64",
                "sha256": "b607bbd9d7c2d7f57a28db5770cf2e9ef5bc61cd45947ef335fc153cf7352486"
            },
            "downloads": -1,
            "filename": "qupac-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "5eea9d166b9e98c887bd2af182122a64",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 18663,
            "upload_time": "2025-10-23T06:06:23",
            "upload_time_iso_8601": "2025-10-23T06:06:23.128307Z",
            "url": "https://files.pythonhosted.org/packages/47/fa/0636b7547f88ae2e633729eddd0c35ac0325fd4feabb9ecf48517eb93c98/qupac-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-23 06:06:23",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "qupac"
}