Skip to content

Commit

Permalink
Switch from qiskit-terra to qiskit (qiskit-community#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
woodsp-ibm authored Nov 20, 2023
1 parent 7fc109f commit bed866f
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 105 deletions.
34 changes: 17 additions & 17 deletions .github/actions/install-main-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,33 @@ inputs:
python-version:
description: 'Python version'
required: true
terra-main:
description: 'Use Terra main'
qiskit-main:
description: 'Use Qiskit main'
required: true
runs:
using: "composite"
steps:
- name: Get main last commit ids
run: |
echo "TERRA_HASH=$(git ls-remote --heads https://github.com/Qiskit/qiskit-terra.git refs/heads/main | awk '{print $1}')" >> $GITHUB_ENV
echo "QISKIT_HASH=$(git ls-remote --heads https://github.com/Qiskit/qiskit.git refs/heads/main | awk '{print $1}')" >> $GITHUB_ENV
shell: bash
- name: Terra Cache
- name: Qiskit Cache
env:
CACHE_VERSION: v1
id: terra-cache
id: qiskit-cache
uses: actions/cache@v3
with:
path: terra-cache
key: terra-cache-${{ inputs.os }}-${{ inputs.python-version }}-${{ env.TERRA_HASH }}-${{ env.CACHE_VERSION }}
- name: Install Terra from Main
path: qiskit-cache
key: qiskit-cache-${{ inputs.os }}-${{ inputs.python-version }}-${{ env.QISKIT_HASH }}-${{ env.CACHE_VERSION }}
- name: Install Qiskit from Main
env:
MACOSX_DEPLOYMENT_TARGET: 10.15
run: |
if [ "${{ inputs.terra-main }}" == "true" ]; then
echo 'Install Terra from Main'
BASE_DIR=terra-cache
if [ "${{ inputs.qiskit-main }}" == "true" ]; then
echo 'Install Qiskit from Main'
BASE_DIR=qiskit-cache
build_from_main=true
cache_hit=${{ steps.terra-cache.outputs.cache-hit }}
cache_hit=${{ steps.qiskit-cache.outputs.cache-hit }}
echo "cache hit: ${cache_hit}"
if [ "$cache_hit" == "true" ]; then
pip_result=0
Expand All @@ -61,18 +61,18 @@ runs:
if [ "$build_from_main" == "true" ]; then
echo 'Create wheel file from main'
pip install -U wheel setuptools_rust
git clone --depth 1 --branch main https://github.com/Qiskit/qiskit-terra.git /tmp/qiskit-terra
pushd /tmp/qiskit-terra
git clone --depth 1 --branch main https://github.com/Qiskit/qiskit.git /tmp/qiskit
pushd /tmp/qiskit
python setup.py bdist_wheel
popd
cp -rf /tmp/qiskit-terra/dist/*.whl "${BASE_DIR}"
cp -rf /tmp/qiskit/dist/*.whl "${BASE_DIR}"
pushd "${BASE_DIR}"
python -m pip install *.whl
popd
pip uninstall -y setuptools_rust
fi
else
echo 'Install Terra from Stable'
pip install -U qiskit-terra
echo 'Install Qiskit from Stable'
pip install -U qiskit
fi
shell: bash
2 changes: 1 addition & 1 deletion .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
os: ${{ matrix.os }}
- name: Install Dependencies
run: |
pip install jupyter qiskit-terra[visualization]
pip install jupyter qiskit[visualization]
sudo apt-get install -y pandoc graphviz
shell: bash
- name: Build and publish
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
terra-main: "false"
qiskit-main: "false"
if: ${{ !startsWith(github.ref, 'refs/heads/stable') && !startsWith(github.base_ref, 'stable/') }}
- uses: ./.github/actions/install-algorithms
- name: Install Dependencies
Expand Down Expand Up @@ -135,7 +135,7 @@ jobs:
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
terra-main: "false"
qiskit-main: "false"
if: ${{ !startsWith(github.ref, 'refs/heads/stable') && !startsWith(github.base_ref, 'stable/') }}
- uses: ./.github/actions/install-algorithms
- run: make lint
Expand Down Expand Up @@ -187,7 +187,7 @@ jobs:
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
terra-main: "true"
qiskit-main: "true"
- uses: ./.github/actions/install-algorithms
- run: make lint
shell: bash
Expand Down Expand Up @@ -229,7 +229,7 @@ jobs:
- uses: ./.github/actions/install-algorithms
- name: Install Dependencies
run: |
pip install jupyter qiskit-terra[visualization]
pip install jupyter qiskit[visualization]
sudo apt-get install -y pandoc graphviz
echo "earliest_version: 0.1.0" >> releasenotes/config.yaml
shell: bash
Expand Down
94 changes: 14 additions & 80 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,60 +73,32 @@ please ensure that:
there is a [.pylintdict](./.pylintdict) custom word list file in the root of the repo,
where such words can be added, in alphabetic order, as needed.

3. If you have added new unit tests that cover the changes and any new function.
3. If it makes sense for your change that you have added new tests that
cover the changes and any new function.

4. Ensure that, if your change has user-facing impact (new feature,
deprecation, removal, etc), you have added a reno (release note) for
4. Ensure that if your change has an end user facing impact (new feature,
deprecation, removal etc) that you have added a reno release note for
that change and that the PR is tagged for the changelog.

5. Ensure all code, including unit tests, has the copyright header. The copyright

date will be checked by CI build. The format of the date(s) is _year of creation,

last year changed_. So for example:


> \# (C) Copyright IBM 2018, 2021.

If the _year of creation_ is the same as _last year changed_ then only

one date is needed, for example:


> \# (C) Copyright IBM 2021.
If code is changed in a file make sure the copyright includes the current year.

If there is just one date and it's a prior year then add the current year as the 2nd date,

otherwise simply change the 2nd date to the current year. The _year of creation_ date is

never changed.

### Changelog generation

The changelog is automatically generated as part of the release process
automation. This works through a combination of the git log and the pull
request. When a release is tagged and pushed to GitHub, the release automation
bot looks at all commit messages from the git log for the release. It takes the
PR numbers from the git log (assuming a squash merge) and checks if that PR had
a `Changelog:` label on it. If there is a label it will add the git commit
message summary line from the git log for the release to the changelog.

If there are multiple `Changelog:` tags on a PR the git commit message summary
line from the git log will be used for each changelog category tagged.

The current categories for each label are as follows:

| PR Label | Changelog Category |
| -----------------------|--------------------|
| Changelog: Deprecation | Deprecated |
| Changelog: New Feature | Added |
| Changelog: API Change | Changed |
| Changelog: Removal | Removed |
| Changelog: Bugfix | Fixed |
A changelog is manually generated as part of the release process from the release notes.

### Release Notes

Expand Down Expand Up @@ -210,8 +182,8 @@ deprecations:
You can also look at other release notes for other examples.
You can use any restructured text feature in them (code sections, tables,
enumerated lists, bulleted list, etc) to express what is being changed as
needed. In general you want the release notes to include as much detail as
enumerated lists, bulleted list, etc.) to express what is being changed as
needed. In general, you want the release notes to include as much detail as
needed so that users will understand what has changed, why it changed, and how
they'll have to update their code.
Expand Down Expand Up @@ -254,10 +226,8 @@ Please see the [Installing Qiskit Algorithms from
Source](https://github.com/qiskit-community/qiskit-algorithms#installation)
section of the Qiskit documentation.

Note: Qiskit Algorithms depends on Terra, and has optional dependence on Aer, so
these should be installed too. The main branch of Algorithms is kept working with those other element
main branches so these should be installed from source too following the instructions at
the same location
Note: Qiskit Algorithms depends on Qiskit, and has optional dependence on Aer, so
these should be installed too.

Algorithms also has some other optional dependents see
[Algorithms optional installs](https://github.com/qiskit-community/qiskit-algorithms#optional-installs) for
Expand All @@ -275,13 +245,13 @@ The test suite can be run from a command line or via your IDE. You can run `make
run all unit tests. Another way to run the test suite is to use
[**tox**](https://tox.readthedocs.io/en/latest/#). For more information about using tox please
refer to
[Terra CONTRIBUTING](https://github.com/Qiskit/qiskit-terra/blob/main/CONTRIBUTING.md#test)
[Qiskit CONTRIBUTING](https://github.com/Qiskit/qiskit/blob/main/CONTRIBUTING.md#test)
Test section. However please note Algorithms does not have any
[online tests](https://github.com/Qiskit/qiskit-terra/blob/main/CONTRIBUTING.md#online-tests)
[online tests](https://github.com/Qiskit/qiskit/blob/main/CONTRIBUTING.md#online-tests)
nor does it have
[test skip
options](https://github.com/Qiskit/qiskit-terra/blob/main/CONTRIBUTING.md#test-skip-options).
options](https://github.com/Qiskit/qiskit/blob/main/CONTRIBUTING.md#test-skip-options).

### Branches

* `main`:
Expand All @@ -292,7 +262,7 @@ can and will change on main as we introduce and refine new features.

* `stable/*`:
The stable branches are used to maintain the most recent released versions of
qiskit-machine-learning. It contains the versions of the code corresponding to the minor
qiskit-algorithms. It contains the versions of the code corresponding to the minor
version release in the branch name release for The API on these branches are
stable and the only changes merged to it are bugfixes.

Expand All @@ -301,65 +271,29 @@ stable and the only changes merged to it are bugfixes.
From time to time, we will release brand new versions of Qiskit Algorithms. These
are well-tested versions of the software.

When the time for a new release has come, we will:

1. Create a new tag with the version number and push it to github
2. Change the `main` version to the next release version.

The release automation processes will be triggered by the new tag and perform

the following steps:


1. Create a stable branch for the new minor version from the release tag

on the `main` branch

2. Build and upload binary wheels to pypi

3. Create a GitHub release page with a generated changelog


The `stable/*` branches should only receive changes in the form of bug
fixes.

## Dealing with the git blame ignore list


In the qiskit-algorithms repository we maintain a list of commits for git blame

to ignore. This is mostly commits that are code style changes that don't

change the functionality but just change the code formatting (for example,

when we migrated to use black for code formatting). This file,

`.git-blame-ignore-revs` just contains a list of commit SHA1s you can tell git

to ignore when using the `git blame` command. This can be done one time

with something like


```

git blame --ignore-revs-file .git-blame-ignore-revs qiskit_algorithms/version.py

```
from the root of the repository. If you'd like to enable this by default you
can update your local repository's configuration with:
```

git config blame.ignoreRevsFile .git-blame-ignore-revs

```
which will update your local repositories configuration to use the ignore list
by default.
2 changes: 1 addition & 1 deletion qiskit_algorithms/optimizers/scipy_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def minimize(
)

# Workaround for L_BFGS_B because it does not accept np.ndarray.
# See https://github.com/Qiskit/qiskit-terra/pull/6373.
# See https://github.com/Qiskit/qiskit/pull/6373.
if jac is not None and self._method == "l-bfgs-b":
jac = self._wrap_gradient(jac)

Expand Down
2 changes: 1 addition & 1 deletion qiskit_algorithms/time_evolvers/variational/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
Algorithms for performing Variational Quantum Time Evolution of quantum states,
which can be tailored to near-term devices.
:class:`~qiskit_algorithms.time_evolvers.variational.VarQTE` base class exposes an interface, compliant
with the Quantum Time Evolution Framework in Qiskit Terra, that is implemented by
with the Quantum Time Evolution Framework, that is implemented by
:class:`~qiskit_algorithms.VarQRTE` and :class:`~qiskit_algorithms.VarQITE` classes for real and
imaginary time evolution respectively. The variational approach is taken according to a variational
principle chosen by a user.
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ setenv =
LANGUAGE=en_US
LC_ALL=en_US.utf-8
ARGS="-V"
deps = git+https://github.com/Qiskit/qiskit-terra.git
deps = git+https://github.com/Qiskit/qiskit.git
-r{toxinidir}/requirements.txt
-r{toxinidir}/requirements-dev.txt
commands =
Expand Down

0 comments on commit bed866f

Please sign in to comment.