Contributing to qiskit-waveform-sim

We welcome contributions! This guide will help you get started.

Code of Conduct

This project follows our Code of Conduct. By participating, you agree to uphold this code.

How to Contribute

Reporting Issues

  • Search existing issues first to avoid duplicates

  • Use the issue templates when available

  • Provide minimal reproduction steps

  • Include environment info (Python version, Qiskit version, OS)

Submitting Pull Requests

  1. Fork the repository

  2. Create a feature branch: git checkout -b feature/my-feature

  3. Make your changes

  4. Run tests and linters (see below)

  5. Submit a PR with a clear description

Development Setup

git clone https://github.com/PratulDeshpande/qiskit-waveform-sim
cd qiskit-waveform-sim
pip install -e ".[dev,test,docs]"
pre-commit install

Running Tests

# Run all tests
pytest -v tests/

# Run with coverage (fails below the 88% gate set in pyproject.toml)
pytest tests/ --cov --cov-report=term-missing

# Run an example headless (no browser tabs): matplotlib Agg, Plotly json renderer
PYTHONUTF8=1 MPLBACKEND=Agg PLOTLY_RENDERER=json python examples/visualization_example.py

# Execute the tutorial notebooks (as CI does)
MPLBACKEND=Agg pytest --nbmake docs/source/tutorials -q

# Run specific test file
pytest -v tests/test_core.py

# Run with parallel execution
pytest -n auto tests/

Code Style

We use the following tools (configured in pyproject.toml):

  • Ruff - Fast Python linter

  • Black - Code formatter

  • MyPy - Static type checker

Run all checks:

ruff check qiskit_waveform_sim tests examples
black --check qiskit_waveform_sim tests examples
mypy qiskit_waveform_sim

The same checks run on every commit once you pre-commit install (configured in .pre-commit-config.yaml).

Auto-fix formatting:

ruff check --fix qiskit_waveform_sim tests examples
black qiskit_waveform_sim tests examples

Adding New Features

  1. Core Engine: Add new envelope types in AnalyticalEnvelopes

  2. Annotations: Extend PulseEnvelopeAnnotation for new pulse parameters

  3. Visualization: Add new Plotly/Matplotlib functions in visualization/

  4. Hardware Export: Add new export functions in examples/

Testing Guidelines

  • Write tests for new functionality in tests/

  • Use fixtures from tests/conftest.py

  • Mark slow tests with @pytest.mark.slow

  • Mark integration tests with @pytest.mark.integration

Documentation

  • Update docstrings for public APIs (NumPy style)

  • Add examples to relevant tutorial notebooks

  • Build docs locally: cd docs && sphinx-build -b html source _build/html -W --keep-going

Release Process

Releases are managed by maintainers:

  1. On a branch, bump version in pyproject.toml (the package and the docs read it from there) and the version field of the README citation, and move the [Unreleased] entries in CHANGELOG.md under the new version.

  2. Open a pull request and wait for CI to pass.

  3. Merge the pull request. Never amend or force-push main after merging.

  4. git pull so your local main matches origin/main.

  5. Tag the merge commit on origin/main: git tag vX.Y.Z.

  6. Push the tag: git push origin vX.Y.Z.

  7. The publish workflow builds and uploads to PyPI.

  8. Create the GitHub release from the tag (do not leave a duplicate draft release).

Getting Help

  • Open a GitHub Discussion for questions

  • Check existing issues and PRs