Skip to content

Commit 296ad13

Browse files
BryceFullercaleb-johnsonconradhauptminhctran
authored andcommitted
Initial commit of the qiskit-addon-obp package
Co-authored-by: Caleb Johnson <[email protected]> Co-authored-by: Bryce Fuller <[email protected]> Co-authored-by: Conrad Haupt <[email protected]> Co-authored-by: Minh Tran <[email protected]>
0 parents  commit 296ad13

File tree

70 files changed

+7874
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+7874
-0
lines changed
+50
Original file line numberDiff line numberDiff line change
@@ -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-addon-obp 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
Original file line numberDiff line numberDiff line change
@@ -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

.github/dependabot.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
labels: ["dependencies"]
6+
schedule:
7+
interval: "weekly"
8+
- package-ecosystem: "pip"
9+
directory: "/"
10+
labels: ["dependencies"]
11+
versioning-strategy: increase
12+
schedule:
13+
interval: "monthly"

.github/workflows/README.md

+37
Original file line numberDiff line numberDiff line change
@@ -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](/tests/#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](/tests/#test-py-environments) 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](/tests/#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 (e.g., `main`).
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/).

.github/workflows/citation.yml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Citation preview
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths: ['CITATION.bib', '.github/workflows/citation.yml']
7+
pull_request:
8+
branches: [ main ]
9+
paths: ['CITATION.bib', '.github/workflows/citation.yml']
10+
11+
jobs:
12+
build-preview:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 30
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Check for non-ASCII characters
18+
run: |
19+
# Fail immediately if there are any non-ASCII characters in
20+
# the BibTeX source. We prefer "escaped codes" rather than
21+
# UTF-8 characters in order to ensure the bibliography will
22+
# display correctly even in documents that do not contain
23+
# \usepackage[utf8]{inputenc}.
24+
if [ -f "CITATION.bib" ]; then
25+
python3 -c 'open("CITATION.bib", encoding="ascii").read()'
26+
fi
27+
- name: Install LaTeX
28+
run: |
29+
if [ -f "CITATION.bib" ]; then
30+
sudo apt-get update
31+
sudo apt-get install -y texlive-latex-base texlive-publishers
32+
fi
33+
- name: Run LaTeX
34+
run: |
35+
if [ -f "CITATION.bib" ]; then
36+
arr=(${GITHUB_REPOSITORY//\// })
37+
export REPO=${arr[1]}
38+
cat <<- EOF > citation-preview.tex
39+
\documentclass[preprint,aps,physrev,notitlepage]{revtex4-2}
40+
\usepackage{hyperref}
41+
\begin{document}
42+
\title{\texttt{$REPO} BibTeX test}
43+
\maketitle
44+
\noindent
45+
\texttt{$REPO}
46+
\cite{$REPO}
47+
\bibliography{CITATION}
48+
\end{document}
49+
EOF
50+
pdflatex citation-preview
51+
fi
52+
- name: Run BibTeX
53+
run: |
54+
if [ -f "CITATION.bib" ]; then
55+
bibtex citation-preview
56+
fi
57+
- name: Re-run LaTeX
58+
run: |
59+
if [ -f "CITATION.bib" ]; then
60+
pdflatex citation-preview
61+
pdflatex citation-preview
62+
fi
63+
- name: Upload PDF
64+
if: always()
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: citation-preview.pdf
68+
path: citation-preview.pdf

.github/workflows/coverage.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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@v4
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v5
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+
run: coverage3 lcov -o coveralls.lcov
38+
- name: Upload report to Coveralls
39+
uses: coverallsapp/github-action@v2
40+
with:
41+
github-token: ${{ secrets.GITHUB_TOKEN }}
42+
file: coveralls.lcov
43+
format: lcov

.github/workflows/docs.yml

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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@v4
23+
with:
24+
fetch-depth: 0
25+
- uses: actions/setup-python@v5
26+
with:
27+
python-version: '3.9'
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: Tell reno to name the upcoming release after the branch we are on
35+
shell: bash
36+
run: |
37+
sed -i.bak -e '/unreleased_version_title:*/d' releasenotes/config.yaml
38+
echo unreleased_version_title: \"Upcoming release \(\`\`${GITHUB_REF_NAME}\`\`\)\" >> releasenotes/config.yaml
39+
- name: Build docs
40+
shell: bash
41+
run: |
42+
tox -edocs
43+
- name: Upload docs artifact for GitHub Pages
44+
uses: actions/upload-pages-artifact@v3
45+
with:
46+
path: docs/_build/html
47+
48+
# Provide a nicely named artifact that extracts into an
49+
# identically named subdirectory.
50+
- name: Prepare nice docs artifact for humans
51+
if: always()
52+
shell: bash
53+
run: |
54+
mkdir artifact
55+
cp -a docs/_build/html artifact/qiskit-addon-obp-htmldocs
56+
- name: Upload nice docs artifact
57+
if: always()
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: qiskit-addon-obp-htmldocs
61+
path: ./artifact
62+
63+
deploy:
64+
name: deploy docs
65+
if: ${{ github.ref == 'refs/heads/stable/0.1' }}
66+
needs: build
67+
permissions:
68+
pages: write
69+
id-token: write
70+
environment:
71+
name: github-pages
72+
url: ${{ steps.deployment.outputs.page_url }}
73+
runs-on: ubuntu-latest
74+
steps:
75+
- name: Deploy to GitHub Pages
76+
id: deployment
77+
uses: actions/deploy-pages@v4

.github/workflows/lint.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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@v4
20+
with:
21+
fetch-depth: 0
22+
- name: Set up Python 3.10
23+
uses: actions/setup-python@v5
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+
shell: bash
32+
run: |
33+
tox -elint

.github/workflows/release.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Publish release
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- "[0-9]+.[0-9]+.[0-9]+"
8+
9+
jobs:
10+
11+
github:
12+
name: github
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout tag
16+
uses: actions/checkout@v4
17+
with:
18+
ref: ${{ github.ref_name }}
19+
- name: Publish release
20+
uses: ghalactic/github-release-from-tag@v5
21+
if: github.ref_type == 'tag'
22+
with:
23+
prerelease: false
24+
token: ${{ secrets.GITHUB_TOKEN }}
25+
generateReleaseNotes: "true"
26+
27+
pypi:
28+
name: pypi
29+
runs-on: ubuntu-latest
30+
needs: github
31+
environment:
32+
name: pypi
33+
url: https://pypi.org/p/qiskit-addon-obp
34+
permissions:
35+
id-token: write
36+
steps:
37+
- name: Checkout tag
38+
uses: actions/checkout@v4
39+
with:
40+
ref: ${{ github.ref_name }}
41+
- name: Install `build` tool
42+
run: |
43+
python -m pip install --upgrade pip
44+
pip install build
45+
- name: Build distribution
46+
run: |
47+
python -m build
48+
- name: Publish release to PyPI
49+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)