Skip to content

Commit

Permalink
Preparing release v0.6.0
Browse files Browse the repository at this point in the history
- Fix some minor issues prior to releasing

  + Fixed pyproject.toml sections for pylint
  + Fixed constant warning messages if braket extra is not installed
  + Fixed file ignore list for check-manifest
  + Fixed issue with version in GitHub Actions
  + Added `setup_require` section to setup.cfg
  + Added new extra for testing (will eventually replace requirements_tests.txt)
  + Update pre-commit config to run black before linters
  + Update badges in README
  + Update configuration for pylint and pytest in pyproject.toml
  + Restructure and update CHANGELOG

- Enable pylint in pre-commit hooks
- Apply changes based on running pylint
- Rename `m` parameter of the LocalOptimizer to `cache_size`
- Gracious exit in case of failure in the MainEngine constructor
- Remove requirements_tests.txt and improve gen_reqfile setup command
- Remove docs/requirements.txt and add .readthedocs.yaml
- Remove all assert statements in non-test code
- Reinstate flaky test for phase estimation decomposition
  • Loading branch information
web-flow authored and Takishima committed Jun 23, 2021
1 parent f93cca3 commit 9ab4254
Show file tree
Hide file tree
Showing 165 changed files with 2,947 additions and 2,708 deletions.
30 changes: 11 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,16 @@ jobs:

- name: Prepare env
run: |
python setup.py gen_reqfile --include-extras
python setup.py gen_reqfile --include-extras=test,braket,revkit
python -m pip install -r requirements.txt --prefer-binary
python -m pip install -r requirements_tests.txt --prefer-binary
python -m pip install coveralls
- name: Setup annotations on Linux
if: runner.os == 'Linux'
run: python -m pip install pytest-github-actions-annotate-failures

- name: Build and install package
run: python -m pip install -ve .[braket]
run: python -m pip install -ve .[braket,revkit,test]

- name: Pytest
run: |
Expand Down Expand Up @@ -125,15 +124,14 @@ jobs:
- name: Prepare Python env
run: |
python3 setup.py gen_reqfile --include-extras
python3 setup.py gen_reqfile --include-extras=test,braket
python3 -m pip install -r requirements.txt --prefer-binary
python3 -m pip install -r requirements_tests.txt --prefer-binary
- name: Upgrade pybind11 and flaky
run: python3 -m pip install --upgrade pybind11 flaky --prefer-binary

- name: Build and install package
run: python3 -m pip install -ve .[braket]
run: python3 -m pip install -ve .[braket,test]

- name: Pytest
run: |
Expand Down Expand Up @@ -170,15 +168,14 @@ jobs:
- name: Prepare Python env
run: |
python3 setup.py gen_reqfile --include-extras
python3 setup.py gen_reqfile --include-extras=test,braket
python3 -m pip install -r requirements.txt --prefer-binary
python3 -m pip install -r requirements_tests.txt --prefer-binary
- name: Upgrade pybind11 and flaky
run: python3 -m pip install --upgrade pybind11 flaky --prefer-binary

- name: Build and install package
run: python3 -m pip install -ve .[braket]
run: python3 -m pip install -ve .[braket,test]

- name: Pytest
run: |
Expand Down Expand Up @@ -244,12 +241,11 @@ jobs:

- name: Install dependencies
run: |
python3 setup.py gen_reqfile --include-extras
python3 setup.py gen_reqfile --include-extras=test,braket
python3 -m pip install -r requirements.txt --prefer-binary
python3 -m pip install -r requirements_tests.txt --prefer-binary
- name: Build and install package
run: python3 -m pip install -ve .[braket]
run: python3 -m pip install -ve .[braket,test]

- name: Pytest
run: |
Expand Down Expand Up @@ -283,10 +279,7 @@ jobs:

- name: Install docs & setup requirements
run: |
python3 setup.py gen_reqfile --include-extras
python3 -m pip install -r requirements.txt --prefer-binary
python3 -m pip install -r docs/requirements.txt --prefer-binary
python3 -m pip install .
python3 -m pip install .[docs]
- name: Build docs
run: python3 -m sphinx -b html docs docs/.build
Expand Down Expand Up @@ -334,12 +327,11 @@ jobs:

- name: Prepare env
run: |
python setup.py gen_reqfile --include-extras
python setup.py gen_reqfile --include-extras=test,braket
python -m pip install -r requirements.txt --prefer-binary
python -m pip install -r requirements_tests.txt --prefer-binary
- name: Build and install package
run: python -m pip install -ve .[braket]
run: python -m pip install -ve .[braket,test]

- name: Run all checks
run: |
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,33 @@ jobs:
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Extract version from tag name
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
run: |
TAG_NAME="${GITHUB_REF/refs\/tags\//}"
VERSION=${TAG_NAME#v}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Extract version from branch name (for release branches)
if: github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'release/')
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION=${BRANCH_NAME#release/}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Extract version from branch name (for hotfix branches)
if: github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'hotfix/')
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION=${BRANCH_NAME#hotfix/}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Set tag for setuptools-scm
run: git tag v${RELEASE_VERSION} master

- name: Build wheels
uses: joerick/cibuildwheel@v1.11.1
env:
Expand Down
19 changes: 11 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
#
# See https://github.com/pre-commit/pre-commit

ci:
skip: [check-manifest]

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
Expand All @@ -25,7 +28,6 @@ repos:
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
- id: requirements-txt-fixer
- id: trailing-whitespace
- id: fix-encoding-pragma

Expand All @@ -35,12 +37,6 @@ repos:
hooks:
- id: remove-tabs

- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
exclude: ^(docs/.*|tools/.*)$

- repo: https://github.com/psf/black
rev: 21.5b1
hooks:
Expand All @@ -49,13 +45,20 @@ repos:
# This is a slow hook, so only run this if --hook-stage manual is passed
stages: [manual]

- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
exclude: ^(docs/.*|tools/.*)$

- repo: https://github.com/pre-commit/mirrors-pylint
rev: 'v3.0.0a3'
hooks:
- id: pylint
args: ['--score=n', '--exit-zero']
args: ['--score=n']
# This is a slow hook, so only run this if --hook-stage manual is passed
stages: [manual]
additional_dependencies: ['pybind11>=2.6', 'numpy', 'requests', 'boto3', 'matplotlib', 'networkx']

- repo: https://github.com/mgedmin/check-manifest
rev: "0.46"
Expand Down
19 changes: 19 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

sphinx:
configuration: docs/conf.py

formats: all

python:
version: 3.8
install:
- method: pip
path: .
extra_requirements:
- docs
49 changes: 35 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,48 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
### Changed
### Deprecated
### Fixed
### Removed
### Repository

## [0.6.0] - 2021-06-23

### Added

- Added backend for IonQ.
- Added support for state-dependent qubit control

### Changed

- Support for GitHub Actions
* Build and testing on various plaforms and compilers
* Automatic draft of new release
* Automatic publication of new release once ready
* Automatic upload of releases artifacts to PyPi and GitHub
- Use ``setuptools-scm`` for versioning
- Added ``.editorconfig` file
- Added ``pyproject.toml`` and ``setup.cfg``
- Added CHANGELOG.md
- Added backend for IonQ.
- Added support for state-dependent qubit control
- Name of the single parameter of the `LocalOptimizer` has been changed from `m` to `cache_size` in order to better represent its actual use.

### Deprecated

- Compatibility with Python <= 3.5
- Compatibility with Python &lt;= 3.5
- `LocalOptimizer(m=10)` should be changed into `LocalOptimizer(cache_size=10)`. Using of the old name is still possible, but is deprecated and will be removed in a future version of ProjectQ.

### Removed

- Compatibility with Python 2.7
- Support for multi-qubit measurement gates; use `All(Measure)` instead

### Repository

- Updated cibuildwheels action to v1.11.1
- Updated thomaseizinger/create-pull-request action to v1.1.0
- Use `setuptools-scm` for versioning
- Added `.editorconfig` file
- Added `pyproject.toml` and `setup.cfg`
- Added CHANGELOG.md
- Added support for GitHub Actions
- Build and testing on various plaforms and compilers
- Automatic draft of new release
- Automatic publication of new release once ready
- Automatic upload of releases artifacts to PyPi and GitHub
- Added pre-commit configuration file

- Updated cibuildwheels action to v1.11.1
- Updated thomaseizinger/create-pull-request action to v1.1.0

## [0.5.1] - 2019-02-15

Expand Down Expand Up @@ -71,3 +88,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
The ProjectQ v0.5.x release branch is the last one that is guaranteed to work with Python 2.7.x.

Future releases might introduce changes that will require Python 3.5 (Python 3.4 and earlier have already been declared deprecated at the time of this writing)

[Unreleased]: https://github.com/ProjectQ-Framework/ProjectQ/compare/0.6.0...HEAD

[0.6.0]: https://github.com/ProjectQ-Framework/ProjectQ/compare/0.5.1...0.6.0
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ include CHANGELOG.md
include MANIFEST.in
include NOTICE
include README.rst
include requirements*.txt
include setup.py
include setup.cfg
include pyproject.toml
Expand Down
23 changes: 13 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
ProjectQ - An open source software framework for quantum computing
==================================================================

.. image:: https://travis-ci.org/ProjectQ-Framework/ProjectQ.svg?branch=master
:target: https://travis-ci.org/ProjectQ-Framework/ProjectQ
.. image:: https://img.shields.io/pypi/pyversions/projectq?label=Python
:alt: PyPI - Python Version

.. image:: https://coveralls.io/repos/github/ProjectQ-Framework/ProjectQ/badge.svg
:target: https://coveralls.io/github/ProjectQ-Framework/ProjectQ
.. image:: https://badge.fury.io/py/projectq.svg
:target: https://badge.fury.io/py/projectq

.. image:: https://readthedocs.org/projects/projectq/badge/?version=latest
:target: http://projectq.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
.. image:: https://github.com/ProjectQ-Framework/ProjectQ/actions/workflows/ci.yml/badge.svg
:alt: CI Status
:target: https://github.com/ProjectQ-Framework/ProjectQ/actions/workflows/ci.yml

.. image:: https://badge.fury.io/py/projectq.svg
:target: https://badge.fury.io/py/projectq
.. image:: https://coveralls.io/repos/github/ProjectQ-Framework/ProjectQ/badge.svg
:alt: Coverage Status
:target: https://coveralls.io/github/ProjectQ-Framework/ProjectQ

.. image:: https://img.shields.io/badge/python-2.7%2C%203.4%2C%203.5%2C%203.6-brightgreen.svg
.. image:: https://readthedocs.org/projects/projectq/badge/?version=latest
:target: http://projectq.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status


ProjectQ is an open source effort for quantum computing.
Expand Down
5 changes: 2 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
Expand All @@ -18,7 +16,8 @@
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# pylint: skip-file

import os
import sys

Expand Down
28 changes: 24 additions & 4 deletions docs/package_description.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
# -*- coding: utf-8 -*-
# Copyright 2017 ProjectQ-Framework (www.projectq.ch)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Module containing some helper classes for generating the documentation"""

import inspect
import sys
import os


class PackageDescription(object):
class PackageDescription: # pylint: disable=too-many-instance-attributes,too-few-public-methods
"""Class representing a package description"""

package_list = []

def __init__(
def __init__( # pylint: disable=too-many-arguments
self,
pkg_name,
desc='',
Expand Down Expand Up @@ -80,7 +98,10 @@ def __init__(
]
self.members.sort(key=lambda x: x[0].lower())

def get_ReST(self):
def get_ReST(self): # pylint: disable=invalid-name,too-many-branches,too-many-statements
"""
Conversion to ReST formatted string.
"""
new_lines = []
new_lines.append(self.name)
new_lines.append('=' * len(self.name))
Expand Down Expand Up @@ -164,5 +185,4 @@ def get_ReST(self):
new_lines.append(' {}'.format(param))
new_lines.append('')

assert not new_lines[-1]
return new_lines[:-1]
2 changes: 0 additions & 2 deletions docs/requirements.txt

This file was deleted.

2 changes: 2 additions & 0 deletions examples/aqt.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
# pylint: skip-file

import matplotlib.pyplot as plt
import getpass

Expand Down
Loading

0 comments on commit 9ab4254

Please sign in to comment.