Skip to main content

Quickly detect imports removed in the Qiskit 1.0 release

Project description

flake8-qiskit-migration

Flake8 plugin to detect imports deprecated in Qiskit 1.0. For a full migration guide, see Qiskit 1.0 feature changes.

[!WARNING] This tool only detects deprecated import paths, it does not detect use of deprecated methods (such as QuantumCircuit.qasm), deprecated arguments, or assignments such as qk = qiskit (although it can handle aliases such as import qiskit as qk).

This tool is to help you quickly identify deprecated imports and work out how to fix them. This tool is not perfect and will make some mistakes, so make sure to test your project thoroughly after migrating.

Through pipx

We recommend using this plugin through pipx. If you have pipx installed, simply run:

pipx run flake8-qiskit-migration <path-to-source>

This will install this plugin in a temporary environment and run it. If you're at the root of your Python project, then <path-to-source> is ./.

With Python venv

If you don't want to use pipx, you can manually create a new environment for the linter. This approach also lets you use nbqa to check Jupyter notebooks. Delete the environment when you're finished.

# Make new environment and install
python -m venv .flake8-qiskit-migration-venv
source .flake8-qiskit-migration-venv/bin/activate
pip install flake8-qiskit-migration

# Run plugin on Python code
flake8 --select QKT100 <path-to-source>  # e.g. `src/`

# Run plugin on notebooks
pip install nbqa
nbqa flake8 ./**/*.ipynb --select QKT100

# Deactivate and delete environment
deactivate
rm -r .flake8-qiskit-migration-venv

With existing flake8

If you already have flake8 installed and want run this plugin that way, To run only the deprecation detection plugin (QKT100), use the --select argument. You'll probably want to uninstall it when you're done.

# Install plugin
pip install flake8-qiskit-migration

# Run all flake8 checks (including this plugin)
flake8 <path-to-source>

# Run only this plugin
flake8 --select QKT100 <path-to-source>

# Uninstall plugin
pip uninstall flake8-qiskit-migration

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

flake8_qiskit_migration-0.4.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

flake8_qiskit_migration-0.4.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file flake8_qiskit_migration-0.4.0.tar.gz.

File metadata

File hashes

Hashes for flake8_qiskit_migration-0.4.0.tar.gz
Algorithm Hash digest
SHA256 96dfc1d1466e81cff6ba344a4d216d2f8032097d1a417d03a32e5bdda7f9fe49
MD5 963ac1f6f1678fee36d4ede95932117d
BLAKE2b-256 8eef8a763effd23a6594c1e18e03467f7a31f89e5df89f9e1a2695bb92743069

See more details on using hashes here.

File details

Details for the file flake8_qiskit_migration-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for flake8_qiskit_migration-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 39bce955cf8f5389e23b6c57509e6b602856804d3796157b51234f6dd27d0dd2
MD5 e596741ae4af40f01d3f7e0e7f6b4313
BLAKE2b-256 44ac0ce9940f52d337009f7e8555f3dd1de532f8fcb6f8fa5315b207f7f77389

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page