qiskit-mitigation 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. qiskit_mitigation-0.1.0/.github/ISSUE_TEMPLATE/BUG_REPORT.yaml +50 -0
  2. qiskit_mitigation-0.1.0/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yaml +14 -0
  3. qiskit_mitigation-0.1.0/.github/dependabot.yml +31 -0
  4. qiskit_mitigation-0.1.0/.github/workflows/README.md +37 -0
  5. qiskit_mitigation-0.1.0/.github/workflows/citation.yml +72 -0
  6. qiskit_mitigation-0.1.0/.github/workflows/coverage.yml +44 -0
  7. qiskit_mitigation-0.1.0/.github/workflows/docs.yml +71 -0
  8. qiskit_mitigation-0.1.0/.github/workflows/lint.yml +32 -0
  9. qiskit_mitigation-0.1.0/.github/workflows/release.yml +89 -0
  10. qiskit_mitigation-0.1.0/.github/workflows/test_development_versions.yml +57 -0
  11. qiskit_mitigation-0.1.0/.github/workflows/test_latest_versions.yml +43 -0
  12. qiskit_mitigation-0.1.0/.github/workflows/test_minimum_versions.yml +38 -0
  13. qiskit_mitigation-0.1.0/.gitignore +149 -0
  14. qiskit_mitigation-0.1.0/.mergify.yml +12 -0
  15. qiskit_mitigation-0.1.0/CITATION.bib +6 -0
  16. qiskit_mitigation-0.1.0/CODE_OF_CONDUCT.md +3 -0
  17. qiskit_mitigation-0.1.0/CONTRIBUTING.md +26 -0
  18. qiskit_mitigation-0.1.0/LICENSE.txt +201 -0
  19. qiskit_mitigation-0.1.0/Makefile +9 -0
  20. qiskit_mitigation-0.1.0/PKG-INFO +329 -0
  21. qiskit_mitigation-0.1.0/README.md +57 -0
  22. qiskit_mitigation-0.1.0/SECURITY.md +20 -0
  23. qiskit_mitigation-0.1.0/docs/_static/.gitkeep +0 -0
  24. qiskit_mitigation-0.1.0/docs/_static/images/qiskit-dark-logo.svg +178 -0
  25. qiskit_mitigation-0.1.0/docs/_static/images/qiskit-light-logo.svg +178 -0
  26. qiskit_mitigation-0.1.0/docs/_templates/autosummary/class.rst +33 -0
  27. qiskit_mitigation-0.1.0/docs/apidocs/index.rst +23 -0
  28. qiskit_mitigation-0.1.0/docs/apidocs/qiskit_mitigation.PEC.rst +29 -0
  29. qiskit_mitigation-0.1.0/docs/apidocs/qiskit_mitigation.mitigation_task.rst +29 -0
  30. qiskit_mitigation-0.1.0/docs/apidocs/qiskit_mitigation.noise.rst +12 -0
  31. qiskit_mitigation-0.1.0/docs/apidocs/qiskit_mitigation.postselection.passes.rst +20 -0
  32. qiskit_mitigation-0.1.0/docs/apidocs/qiskit_mitigation.postselection.rst +15 -0
  33. qiskit_mitigation-0.1.0/docs/apidocs/qiskit_mitigation.trex.rst +23 -0
  34. qiskit_mitigation-0.1.0/docs/apidocs/qiskit_mitigation.utils.rst +18 -0
  35. qiskit_mitigation-0.1.0/docs/apidocs/qiskit_mitigation.zne.rst +19 -0
  36. qiskit_mitigation-0.1.0/docs/conf.py +185 -0
  37. qiskit_mitigation-0.1.0/docs/guides/index.rst +7 -0
  38. qiskit_mitigation-0.1.0/docs/guides/postselection_with_non_markovian_error_checks.ipynb +504 -0
  39. qiskit_mitigation-0.1.0/docs/images/noise_mitigated_expt.png +0 -0
  40. qiskit_mitigation-0.1.0/docs/images/noisy_expt.png +0 -0
  41. qiskit_mitigation-0.1.0/docs/images/pna_overview.png +0 -0
  42. qiskit_mitigation-0.1.0/docs/index.rst +54 -0
  43. qiskit_mitigation-0.1.0/docs/install.rst +74 -0
  44. qiskit_mitigation-0.1.0/pyproject.toml +168 -0
  45. qiskit_mitigation-0.1.0/qiskit_mitigation/__init__.py +33 -0
  46. qiskit_mitigation-0.1.0/qiskit_mitigation/mitigation_task.py +998 -0
  47. qiskit_mitigation-0.1.0/qiskit_mitigation/noise.py +182 -0
  48. qiskit_mitigation-0.1.0/qiskit_mitigation/pec.py +700 -0
  49. qiskit_mitigation-0.1.0/qiskit_mitigation/postselection/__init__.py +25 -0
  50. qiskit_mitigation-0.1.0/qiskit_mitigation/postselection/constants.py +49 -0
  51. qiskit_mitigation-0.1.0/qiskit_mitigation/postselection/passes/__init__.py +28 -0
  52. qiskit_mitigation-0.1.0/qiskit_mitigation/postselection/passes/_utils.py +44 -0
  53. qiskit_mitigation-0.1.0/qiskit_mitigation/postselection/passes/add_post_circuit_checks.py +190 -0
  54. qiskit_mitigation-0.1.0/qiskit_mitigation/postselection/passes/add_pre_circuit_checks.py +251 -0
  55. qiskit_mitigation-0.1.0/qiskit_mitigation/postselection/passes/add_spectator_post_circuit_checks.py +493 -0
  56. qiskit_mitigation-0.1.0/qiskit_mitigation/postselection/passes/add_spectator_pre_circuit_checks.py +313 -0
  57. qiskit_mitigation-0.1.0/qiskit_mitigation/postselection/passes/x_pulse_type.py +26 -0
  58. qiskit_mitigation-0.1.0/qiskit_mitigation/postselection/post_selection_summary.py +421 -0
  59. qiskit_mitigation-0.1.0/qiskit_mitigation/postselection/post_selector.py +298 -0
  60. qiskit_mitigation-0.1.0/qiskit_mitigation/postselection/xslow_gate.py +28 -0
  61. qiskit_mitigation-0.1.0/qiskit_mitigation/trex.py +330 -0
  62. qiskit_mitigation-0.1.0/qiskit_mitigation/utils/__init__.py +34 -0
  63. qiskit_mitigation-0.1.0/qiskit_mitigation/utils/expectation_values.py +744 -0
  64. qiskit_mitigation-0.1.0/qiskit_mitigation/utils/measurement_bases.py +188 -0
  65. qiskit_mitigation-0.1.0/qiskit_mitigation/utils/observable_mappings.py +101 -0
  66. qiskit_mitigation-0.1.0/qiskit_mitigation/utils/utils.py +176 -0
  67. qiskit_mitigation-0.1.0/qiskit_mitigation/zne/__init__.py +23 -0
  68. qiskit_mitigation-0.1.0/qiskit_mitigation/zne/extrapolation.py +506 -0
  69. qiskit_mitigation-0.1.0/qiskit_mitigation/zne/gate_folding.py +1000 -0
  70. qiskit_mitigation-0.1.0/qiskit_mitigation/zne/pea.py +635 -0
  71. qiskit_mitigation-0.1.0/test/README.md +91 -0
  72. qiskit_mitigation-0.1.0/test/__init__.py +11 -0
  73. qiskit_mitigation-0.1.0/test/postselection/passes/__init__.py +11 -0
  74. qiskit_mitigation-0.1.0/test/postselection/passes/test_control_flow.py +147 -0
  75. qiskit_mitigation-0.1.0/test/postselection/passes/test_edge_passes.py +541 -0
  76. qiskit_mitigation-0.1.0/test/postselection/passes/test_node_passes.py +102 -0
  77. qiskit_mitigation-0.1.0/test/postselection/test_gate_and_enum.py +49 -0
  78. qiskit_mitigation-0.1.0/test/postselection/test_integration.py +279 -0
  79. qiskit_mitigation-0.1.0/test/postselection/test_post_selection_summary.py +439 -0
  80. qiskit_mitigation-0.1.0/test/postselection/test_post_selector.py +383 -0
  81. qiskit_mitigation-0.1.0/test/test_mitigation_task.py +1191 -0
  82. qiskit_mitigation-0.1.0/test/test_noise.py +234 -0
  83. qiskit_mitigation-0.1.0/test/test_pec.py +1017 -0
  84. qiskit_mitigation-0.1.0/test/test_trex.py +769 -0
  85. qiskit_mitigation-0.1.0/test/utils/__init__.py +11 -0
  86. qiskit_mitigation-0.1.0/test/utils/test_expectation_values.py +2148 -0
  87. qiskit_mitigation-0.1.0/test/utils/test_measurement_bases.py +383 -0
  88. qiskit_mitigation-0.1.0/test/utils/test_observable_mappings.py +70 -0
  89. qiskit_mitigation-0.1.0/test/utils/test_utils.py +659 -0
  90. qiskit_mitigation-0.1.0/test/zne/__init__.py +13 -0
  91. qiskit_mitigation-0.1.0/test/zne/test_extrapolation.py +657 -0
  92. qiskit_mitigation-0.1.0/test/zne/test_gate_folding.py +1041 -0
  93. qiskit_mitigation-0.1.0/test/zne/test_gate_folding_pass.py +228 -0
  94. qiskit_mitigation-0.1.0/test/zne/test_pea.py +910 -0
  95. qiskit_mitigation-0.1.0/tox.ini +65 -0
@@ -0,0 +1,50 @@
1
+ name: 🐛 Bug report
2
+ description: Create a report to help us improve 🤔.
3
+ labels: ["bug"]
4
+
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: Thank you for reporting a bug! Before you do so, please ensure that you have tested on the latest released version of the code. If it does, please also use the search to see if there are any other related issues or pull requests.
9
+
10
+ - type: textarea
11
+ attributes:
12
+ label: Environment
13
+ description: Please give the actual version number (_e.g._ 0.1.0) if you are using a release version, or the first 7-8 characters of the commit hash if you have installed from `git`. If anything else is relevant, you can add it to the list.
14
+ # The trailing spaces on the following lines are to make filling the form
15
+ # in easier. The type is 'textarea' rather than three separate 'input's
16
+ # to make the resulting issue body less noisy with headings.
17
+ value: |
18
+ - **qiskit-mitigation version**:
19
+ - **Python version**:
20
+ - **Operating system**:
21
+ validations:
22
+ required: true
23
+
24
+ - type: textarea
25
+ attributes:
26
+ label: What is happening and why is it wrong?
27
+ description: A short description of what is going wrong, in words.
28
+ validations:
29
+ required: true
30
+
31
+ - type: textarea
32
+ attributes:
33
+ label: How can we reproduce the issue?
34
+ description: Give some steps that show the bug. A [minimal working example](https://stackoverflow.com/help/minimal-reproducible-example) of code with output is best. If you are copying in code, please remember to enclose it in triple backticks (` ``` [multiline code goes here] ``` `) so that it [displays correctly](https://docs.github.com/en/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax).
35
+ validations:
36
+ required: true
37
+
38
+ - type: textarea
39
+ attributes:
40
+ label: Traceback
41
+ description: If your code provided an error traceback, please paste it below, enclosed in triple backticks (` ``` [multiline code goes here] ``` `) so that it [displays correctly](https://docs.github.com/en/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax).
42
+ validations:
43
+ required: false
44
+
45
+ - type: textarea
46
+ attributes:
47
+ label: Any suggestions?
48
+ description: Not required, but if you have suggestions for how a contributor should fix this, or any problems we should be aware of, let us know.
49
+ validations:
50
+ required: false
@@ -0,0 +1,14 @@
1
+ name: 🚀 Feature request
2
+ description: Suggest an idea for this project 💡!
3
+ labels: ["type: feature request"]
4
+
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: Please make sure to browse the opened and closed issues to make sure that this idea has not previously been discussed.
9
+
10
+ - type: textarea
11
+ attributes:
12
+ label: What should we add?
13
+ validations:
14
+ required: true
@@ -0,0 +1,31 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ labels: ["dependencies"]
6
+ schedule:
7
+ interval: "monthly"
8
+ groups:
9
+ github-actions:
10
+ patterns:
11
+ - "*" # Group all Actions updates into a single pull request
12
+
13
+ - package-ecosystem: "pip"
14
+ directory: "/"
15
+ labels: ["dependencies"]
16
+ versioning-strategy: increase-if-necessary
17
+ schedule:
18
+ interval: "monthly"
19
+ groups:
20
+ python-dependencies:
21
+ patterns:
22
+ - "*" # Group all Python updates into a single pull request
23
+ ignore:
24
+ # The lint tools are pinned exactly. Only surface minor/major bumps for them;
25
+ # patch releases are not worth a pull request.
26
+ - dependency-name: "ruff"
27
+ update-types: ["version-update:semver-patch"]
28
+ - dependency-name: "mypy"
29
+ update-types: ["version-update:semver-patch"]
30
+ - dependency-name: "pylint"
31
+ update-types: ["version-update:semver-patch"]
@@ -0,0 +1,37 @@
1
+ # GitHub Actions workflows
2
+
3
+ This directory contains a number of workflows for use with [GitHub Actions](https://docs.github.com/actions). They specify what standards should be expected for development of this software, including pull requests. These workflows are designed to work out of the box for any research software prototype, especially those based on [Qiskit](https://qiskit.org/).
4
+
5
+ ## Lint check (`lint.yml`)
6
+
7
+ This workflow checks that the code is formatted properly and follows the style guide by installing tox and running the lint environment (`tox -e lint`).
8
+
9
+ ## Latest version tests (`test_latest_versions.yml`)
10
+
11
+ This workflow installs the latest version of tox and runs the current repository's tests (`tox -e py`) under each supported Python version on Linux and under a single Python version on macOS and Windows. This is the primary testing workflow. It runs for all code changes and additionally once per day, to ensure tests continue to pass as new versions of dependencies are released.
12
+
13
+ ## Development version tests (`test_development_versions.yml`)
14
+
15
+ This workflow installs tox and modifies `pyproject.toml` to use the _development_ versions of certain Qiskit packages, using [extremal-python-dependencies](https://github.com/IBM/extremal-python-dependencies). For all other packages, the latest version is installed. This workflow runs on two versions of Python: the minimum supported version and the maximum supported version. Its purpose is to identify as soon as possible (i.e., before a Qiskit release) when changes in Qiskit will break the current repository. This workflow runs for all code changes, as well as on a timer once per day.
16
+
17
+ ## Minimum version tests (`test_minimum_versions.yml`)
18
+
19
+ This workflow first installs the minimum supported tox version (the `minversion` specified in [`tox.ini`](/tox.ini)) and then installs the _minimum_ compatible version of each package listed in `pyproject.toml`, using [extremal-python-dependencies](https://github.com/IBM/extremal-python-dependencies). The purpose of this workflow is to make sure the minimum version specifiers in these files are accurate, i.e., that the tests actually pass with these versions. This workflow uses a single Python version, typically the oldest supported version, as the minimum supported versions of each package may not be compatible with the most recent Python release.
20
+
21
+ Under the hood, this workflow uses a regular expression to change each `>=` and `~=` specifier in the dependencies to instead be `==`, as pip [does not support](https://github.com/pypa/pip/issues/8085) resolving the minimum versions of packages directly. Unfortunately, this means that the workflow will only install the minimum version of a package if it is _explicitly_ listed in one of the requirements files with a minimum version. For instance, if the only listed dependency is `qiskit>=1.0`, this workflow will install `qiskit==1.0` along with the latest version of each transitive dependency, such as `rustworkx`.
22
+
23
+ ## Code coverage (`coverage.yml`)
24
+
25
+ This workflow tests the coverage environment on a single version of Python by installing tox and running `tox -e coverage`.
26
+
27
+ ## Documentation (`docs.yml`)
28
+
29
+ This workflow ensures that the [Sphinx](https://www.sphinx-doc.org/) documentation builds successfully. It also publishes the resulting build to [GitHub Pages](https://pages.github.com/) if it is from the appropriate branch (currently `stable/0.1`).
30
+
31
+ ## Citation preview (`citation.yml`)
32
+
33
+ This workflow is only triggered when the `CITATION.bib` file is changed. It ensures that the file contains only ASCII characters ([escaped codes](https://en.wikibooks.org/wiki/LaTeX/Special_Characters#Escaped_codes) are preferred, as then the `bib` file will work even when `inputenc` is not used). It also compiles a sample LaTeX document which includes the citation in its bibliography and uploads the resulting PDF as an artifact so it can be previewed (e.g., before merging a pull request).
34
+
35
+ ## Release (`release.yml`)
36
+
37
+ This workflow is triggered by a maintainer pushing a tag that represents a release. It publishes the release to github.com and to [PyPI](https://pypi.org/).
@@ -0,0 +1,72 @@
1
+ name: Citation preview
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - 'stable/**'
8
+ paths: ['CITATION.bib', '.github/workflows/citation.yml']
9
+ pull_request:
10
+ branches:
11
+ - main
12
+ - 'stable/**'
13
+ paths: ['CITATION.bib', '.github/workflows/citation.yml']
14
+
15
+ jobs:
16
+ build-preview:
17
+ runs-on: ubuntu-latest
18
+ timeout-minutes: 30
19
+ steps:
20
+ - uses: actions/checkout@v7
21
+ - name: Check for non-ASCII characters
22
+ run: |
23
+ # Fail immediately if there are any non-ASCII characters in
24
+ # the BibTeX source. We prefer "escaped codes" rather than
25
+ # UTF-8 characters in order to ensure the bibliography will
26
+ # display correctly even in documents that do not contain
27
+ # \usepackage[utf8]{inputenc}.
28
+ if [ -f "CITATION.bib" ]; then
29
+ python3 -c 'open("CITATION.bib", encoding="ascii").read()'
30
+ fi
31
+ - name: Install LaTeX
32
+ run: |
33
+ if [ -f "CITATION.bib" ]; then
34
+ sudo apt-get update
35
+ sudo apt-get install -y texlive-latex-base texlive-publishers
36
+ fi
37
+ - name: Run LaTeX
38
+ run: |
39
+ if [ -f "CITATION.bib" ]; then
40
+ arr=(${GITHUB_REPOSITORY//\// })
41
+ export REPO=${arr[1]}
42
+ cat <<- EOF > citation-preview.tex
43
+ \documentclass[preprint,aps,physrev,notitlepage]{revtex4-2}
44
+ \usepackage{hyperref}
45
+ \begin{document}
46
+ \title{\texttt{$REPO} BibTeX test}
47
+ \maketitle
48
+ \noindent
49
+ \texttt{$REPO}
50
+ \cite{$REPO}
51
+ \bibliography{CITATION}
52
+ \end{document}
53
+ EOF
54
+ pdflatex citation-preview
55
+ fi
56
+ - name: Run BibTeX
57
+ run: |
58
+ if [ -f "CITATION.bib" ]; then
59
+ bibtex citation-preview
60
+ fi
61
+ - name: Re-run LaTeX
62
+ run: |
63
+ if [ -f "CITATION.bib" ]; then
64
+ pdflatex citation-preview
65
+ pdflatex citation-preview
66
+ fi
67
+ - name: Upload PDF
68
+ if: always()
69
+ uses: actions/upload-artifact@v7
70
+ with:
71
+ name: citation-preview.pdf
72
+ path: citation-preview.pdf
@@ -0,0 +1,44 @@
1
+ name: Coverage
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - 'stable/**'
8
+ pull_request:
9
+ branches:
10
+ - main
11
+ - 'stable/**'
12
+
13
+ jobs:
14
+ coverage:
15
+ name: code coverage (${{ matrix.os }}, ${{ matrix.python-version }})
16
+ runs-on: ${{ matrix.os }}
17
+ timeout-minutes: 30
18
+ strategy:
19
+ max-parallel: 4
20
+ matrix:
21
+ os: [ubuntu-latest]
22
+ python-version: ["3.10"]
23
+ steps:
24
+ - uses: actions/checkout@v7
25
+ - name: Set up Python ${{ matrix.python-version }}
26
+ uses: actions/setup-python@v7
27
+ with:
28
+ python-version: ${{ matrix.python-version }}
29
+ - name: Install tox
30
+ run: |
31
+ python -m pip install --upgrade pip
32
+ pip install tox coverage
33
+ - name: Run coverage
34
+ run: |
35
+ tox -e coverage
36
+ - name: Convert to lcov
37
+ if: always()
38
+ run: python -m coverage lcov -o coveralls.lcov
39
+ - name: Upload report to Coveralls
40
+ if: always()
41
+ uses: coverallsapp/github-action@v2
42
+ with:
43
+ file: coveralls.lcov
44
+ format: lcov
@@ -0,0 +1,71 @@
1
+ name: Sphinx
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ tags:
7
+ - "[0-9]+.[0-9]+.[0-9]+*"
8
+ branches:
9
+ - main
10
+ - 'stable/**'
11
+ pull_request:
12
+ branches:
13
+ - main
14
+ - 'stable/**'
15
+
16
+ jobs:
17
+ build:
18
+ name: build docs
19
+ runs-on: ubuntu-latest
20
+ timeout-minutes: 20
21
+ steps:
22
+ - uses: actions/checkout@v7
23
+ with:
24
+ fetch-depth: 0
25
+ - uses: actions/setup-python@v7
26
+ with:
27
+ python-version: '3.10'
28
+ - name: Install dependencies
29
+ run: |
30
+ python -m pip install --upgrade pip
31
+ pip install tox
32
+ sudo apt-get update
33
+ sudo apt-get install -y pandoc
34
+ - name: Build docs
35
+ run: |
36
+ tox -e docs
37
+ - name: Upload docs artifact for GitHub Pages
38
+ uses: actions/upload-pages-artifact@v5
39
+ with:
40
+ path: docs/_build/html
41
+
42
+ # Provide a nicely named artifact that extracts into an
43
+ # identically named subdirectory.
44
+ - name: Prepare nice docs artifact for humans
45
+ if: always()
46
+ shell: bash
47
+ run: |
48
+ mkdir artifact
49
+ cp -a docs/_build/html artifact/qiskit-mitigation-htmldocs
50
+ - name: Upload nice docs artifact
51
+ if: always()
52
+ uses: actions/upload-artifact@v7
53
+ with:
54
+ name: qiskit-mitigation-htmldocs
55
+ path: ./artifact
56
+
57
+ deploy:
58
+ name: deploy docs
59
+ if: ${{ github.ref == 'refs/heads/stable/0.1' }}
60
+ needs: build
61
+ permissions:
62
+ pages: write
63
+ id-token: write
64
+ environment:
65
+ name: github-pages
66
+ url: ${{ steps.deployment.outputs.page_url }}
67
+ runs-on: ubuntu-latest
68
+ steps:
69
+ - name: Deploy to GitHub Pages
70
+ id: deployment
71
+ uses: actions/deploy-pages@v5
@@ -0,0 +1,32 @@
1
+ name: Lint
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - 'stable/**'
8
+ pull_request:
9
+ branches:
10
+ - main
11
+ - 'stable/**'
12
+
13
+ jobs:
14
+ lint:
15
+ name: lint check
16
+ runs-on: ubuntu-latest
17
+ timeout-minutes: 30
18
+ steps:
19
+ - uses: actions/checkout@v7
20
+ with:
21
+ fetch-depth: 0
22
+ - name: Set up Python 3.10
23
+ uses: actions/setup-python@v7
24
+ with:
25
+ python-version: '3.10'
26
+ - name: Install tox
27
+ run: |
28
+ python -m pip install --upgrade pip
29
+ pip install tox
30
+ - name: Run lint check
31
+ run: |
32
+ tox -e lint
@@ -0,0 +1,89 @@
1
+ name: Build and publish
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ tags:
7
+ - "[0-9]+.[0-9]+.[0-9]+"
8
+ branches:
9
+ - main
10
+ - 'stable/**'
11
+
12
+ jobs:
13
+
14
+ build_sdist:
15
+ name: Build source distribution
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v7
19
+ - name: Build distribution
20
+ run: |
21
+ pipx run build --sdist
22
+ - name: Store the distribution packages
23
+ uses: actions/upload-artifact@v7
24
+ with:
25
+ name: pkg-sdist
26
+ path: dist/*.tar.gz
27
+
28
+ build_wheels:
29
+ name: Build universal wheel
30
+ runs-on: ubuntu-latest
31
+ steps:
32
+ - uses: actions/checkout@v7
33
+ - name: Build wheel
34
+ run: |
35
+ pipx run build --wheel
36
+ - name: Store the wheel
37
+ uses: actions/upload-artifact@v7
38
+ with:
39
+ name: pkg-wheel
40
+ path: dist/*.whl
41
+
42
+ github:
43
+ name: Publish to GitHub
44
+ if: startsWith(github.ref, 'refs/tags/')
45
+ runs-on: ubuntu-latest
46
+ needs:
47
+ - build_sdist
48
+ - build_wheels
49
+ steps:
50
+ - name: Checkout tag
51
+ uses: actions/checkout@v7
52
+ - name: Download artifacts
53
+ uses: actions/download-artifact@v8
54
+ with:
55
+ pattern: pkg-*
56
+ path: dist
57
+ merge-multiple: true
58
+ - name: Publish release
59
+ uses: ghalactic/github-release-from-tag@v6
60
+ with:
61
+ prerelease: false
62
+ generateReleaseNotes: "true"
63
+ assets: |
64
+ - path: dist/*
65
+
66
+ pypi:
67
+ name: Publish to pypi
68
+ if: startsWith(github.ref, 'refs/tags/')
69
+ runs-on: ubuntu-latest
70
+ needs:
71
+ - build_sdist
72
+ - build_wheels
73
+ - github
74
+ environment:
75
+ name: pypi
76
+ url: https://pypi.org/p/qiskit-mitigation
77
+ permissions:
78
+ id-token: write
79
+ steps:
80
+ - name: Checkout tag
81
+ uses: actions/checkout@v7
82
+ - name: Download artifacts
83
+ uses: actions/download-artifact@v8
84
+ with:
85
+ pattern: pkg-*
86
+ path: dist
87
+ merge-multiple: true
88
+ - name: Publish release to PyPI
89
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,57 @@
1
+ name: Development version tests
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - 'stable/**'
8
+ pull_request:
9
+ branches:
10
+ - main
11
+ - 'stable/**'
12
+ schedule:
13
+ - cron: '0 1 * * *'
14
+
15
+ jobs:
16
+ tests:
17
+ name: development version tests (${{ matrix.os }}, ${{ matrix.python-version }})
18
+ runs-on: ${{ matrix.os }}
19
+ timeout-minutes: 30
20
+ strategy:
21
+ max-parallel: 4
22
+ matrix:
23
+ os: [ubuntu-latest]
24
+ python-version: ["3.10", "3.13"]
25
+ steps:
26
+ - uses: actions/checkout@v7
27
+ - name: Set up Python ${{ matrix.python-version }}
28
+ uses: actions/setup-python@v7
29
+ with:
30
+ python-version: ${{ matrix.python-version }}
31
+ - name: Upgrade pip
32
+ run: |
33
+ python -m pip install --upgrade pip
34
+ - name: Install tools from pypi
35
+ run: |
36
+ python -m pip install tox build 'extremal-python-dependencies<2'
37
+ - name: Build Qiskit SDK development wheel
38
+ run: |
39
+ git clone https://github.com/Qiskit/qiskit
40
+ cd qiskit
41
+ git rev-parse HEAD
42
+ python -m build --wheel
43
+ - name: Build samplomatic development wheel
44
+ run: |
45
+ git clone https://github.com/Qiskit/samplomatic
46
+ cd samplomatic
47
+ git rev-parse HEAD
48
+ python -m build --wheel
49
+ - name: Pin development versions
50
+ shell: bash
51
+ run: >-
52
+ extremal-python-dependencies pin-dependencies --inplace
53
+ "qiskit @ file:$(realpath qiskit/dist/*.whl)"
54
+ "samplomatic @ file:$(realpath samplomatic/dist/*.whl)"
55
+ - name: Test using tox environment
56
+ run: |
57
+ tox -e py --parallel --parallel-no-spinner
@@ -0,0 +1,43 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - 'stable/**'
8
+ pull_request:
9
+ branches:
10
+ - main
11
+ - 'stable/**'
12
+ schedule:
13
+ - cron: '0 1 * * *'
14
+
15
+ jobs:
16
+ tests:
17
+ name: latest version tests (${{ matrix.os }}, ${{ matrix.python-version }})
18
+ runs-on: ${{ matrix.os }}
19
+ timeout-minutes: 30
20
+ strategy:
21
+ max-parallel: 4
22
+ matrix:
23
+ os: [ubuntu-latest]
24
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
25
+ include:
26
+ - os: macos-latest
27
+ python-version: "3.13"
28
+ - os: windows-latest
29
+ python-version: "3.13"
30
+ steps:
31
+ - uses: actions/checkout@v7
32
+ - name: Set up Python ${{ matrix.python-version }}
33
+ uses: actions/setup-python@v7
34
+ with:
35
+ python-version: ${{ matrix.python-version }}
36
+ - name: Install dependencies
37
+ run: |
38
+ python -m pip install --upgrade pip
39
+ pip install tox
40
+ - name: Test using tox environment
41
+ shell: bash
42
+ run: |
43
+ tox -e py --parallel --parallel-no-spinner
@@ -0,0 +1,38 @@
1
+ name: Minimum version tests
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - 'stable/**'
8
+ pull_request:
9
+ branches:
10
+ - main
11
+ - 'stable/**'
12
+
13
+ jobs:
14
+ tests:
15
+ name: minimum version tests (${{ matrix.os }}, ${{ matrix.python-version }})
16
+ runs-on: ${{ matrix.os }}
17
+ timeout-minutes: 30
18
+ strategy:
19
+ max-parallel: 4
20
+ matrix:
21
+ os: [ubuntu-latest]
22
+ python-version: ["3.10"]
23
+ steps:
24
+ - uses: actions/checkout@v7
25
+ - name: Set up Python ${{ matrix.python-version }}
26
+ uses: actions/setup-python@v7
27
+ with:
28
+ python-version: ${{ matrix.python-version }}
29
+ - name: Install dependencies (minimum versions)
30
+ shell: bash
31
+ run: |
32
+ python -m pip install --upgrade pip
33
+ python -m pip install 'extremal-python-dependencies<2'
34
+ pip install "tox==$(extremal-python-dependencies get-tox-minversion)"
35
+ extremal-python-dependencies pin-dependencies-to-minimum --inplace
36
+ - name: Test using tox environment
37
+ run: |
38
+ tox -e py --parallel --parallel-no-spinner