A Python library for simulating quantum computers and quantum algorithms
Project description
Quantum Simulator
A Python library for simulating quantum computers and quantum algorithms. This package provides an easy-to-use interface for quantum state simulation, gate operations, and circuit execution.
Features
- 🔬 Quantum State Simulation: Accurate simulation of quantum states using state vectors
- 🚪 Quantum Gates: Implementation of common single and multi-qubit gates (X, Y, Z, H, CNOT)
- 🔗 Quantum Circuits: Build and execute complex quantum circuits
- 📊 Measurement: Simulate quantum measurements with proper state collapse
- 🎯 Easy to Use: Clean, intuitive API for quantum programming
- 📚 Well Documented: Comprehensive documentation and examples
Quick Start
Installation
pip install quantum-simulator
Basic Example
from quantum_simulator import QuantumSimulator, QuantumCircuit
from quantum_simulator.gates import H_GATE, CNOT_GATE
# Create a 2-qubit quantum simulator
sim = QuantumSimulator(2)
# Build a Bell state circuit
circuit = QuantumCircuit(2)
circuit.add_gate(H_GATE, [0]) # Hadamard on qubit 0
circuit.add_gate(CNOT_GATE, [0, 1]) # CNOT with control=0, target=1
# Execute the circuit
circuit.execute(sim)
# Measure the qubits
result0 = sim.measure(0)
result1 = sim.measure(1)
print(f"Measurement: {result0}, {result1}")
Documentation
Full documentation is available at beefy.github.io/quantum-simulator
Development
Setting Up Development Environment
-
Clone the repository:
git clone https://github.com/beefy/quantum-simulator.git cd quantum-simulator
-
Install in development mode:
pip install -e .[dev,docs]
-
Run tests:
pytest --cov=quantum_simulator --cov-report=xml --cov-report=term
-
Run lint checks:
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics mypy src/
-
Build documentation:
mkdocs serve
Publishing
Publishing to PyPI
This project uses automated publishing via GitHub Actions. To publish a new version:
1. Prepare the Release
-
Update version in
src/quantum_simulator/__init__.py:__version__ = "0.2.0" # Increment version number
-
Update CHANGELOG.md with release notes
-
Commit changes:
git add . git commit -m "Bump version to 0.2.0" git push
2. Create a Release
-
Create and push a tag:
git tag v0.2.0 git push origin v0.2.0
-
Create a GitHub Release:
- Go to GitHub Releases
- Click "Create a new release"
- Choose the tag you just created
- Add release notes
- Click "Publish release"
-
Automated Publishing:
- GitHub Actions will automatically build and publish to PyPI
- Check the Actions tab for progress
3. Manual Publishing (if needed)
If automated publishing fails, you can publish manually:
# Install build tools
pip install build twine
# Build the package
python -m build
# Upload to PyPI (requires PyPI API token)
twine upload dist/*
Publishing Documentation
Documentation is automatically deployed to GitHub Pages on every push to the main branch.
Manual Documentation Deployment
# Install documentation dependencies
pip install -e .[docs]
# Build and deploy to GitHub Pages
mkdocs gh-deploy
Local Documentation Development
# Serve documentation locally with auto-reload
mkdocs serve
# Open http://localhost:8000 in your browser
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quantum_simulator-0.1.3.tar.gz.
File metadata
- Download URL: quantum_simulator-0.1.3.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b3d4d35a0df9c3a71ed20e5d245fec5de060ba75f101c587791fb239ac1be05
|
|
| MD5 |
57f414ff0b56427604b0d571384df805
|
|
| BLAKE2b-256 |
07a9153fc7a1f51cf8690de933a719506ec5dd1887f04158bdf88624c3647c8a
|
File details
Details for the file quantum_simulator-0.1.3-py3-none-any.whl.
File metadata
- Download URL: quantum_simulator-0.1.3-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf6735be250457be8a7032e167220d3bd8fb6964dea5a19a60147563e6d72ff9
|
|
| MD5 |
f18703e1e213f346c7f6a7a622a5568f
|
|
| BLAKE2b-256 |
5c7569d36edb9538ab085bdca068eba4925f8e7a5a898d77ebbc556d39de1246
|