Skip to content

Commit

Permalink
Merge pull request #131 from q-optimize/release/1.3
Browse files Browse the repository at this point in the history
Release/1.3
  • Loading branch information
lazyoracle authored Jul 20, 2021
2 parents 2b41aac + 0626a23 commit dcdb2be
Show file tree
Hide file tree
Showing 134 changed files with 15,628 additions and 5,442 deletions.
34 changes: 12 additions & 22 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,22 @@ assignees: ''

---

**Describe the bug**
## Describe the bug
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
## To Reproduce
Steps to reproduce the behavior. This can be in the form of a code snippet or some config files or a notebook to produce a minimum viable example of the bug.

**Expected behavior**
A clear and concise description of what you expected to happen.
## Expected behavior
A clear and concise description of what you expect(ed) to happen.

**Screenshots**
## Screenshots
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
## Environment (please complete the following information)
- OS: [e.g. MacOS]
- Python Version: [e.g. 3.8]
- `c3-toolset` Version [e.g. 1.2]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
## Additional context
Add any other context about the problem here. You can also suggest possible solutions and relevant implementations & edge case details.
16 changes: 8 additions & 8 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
## Describe the missing feature
A clear and concise description of what the problem is and what is being missed. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.
## Describe the solution you'd like
A clear and concise description of what you want to happen. If possible, provide example input-output descriptions or usecases. Better still, consider providing code snippets that outline the expected behaviour. Ex. I would like to call [...] on the [...] class objects to get [...] done.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
## Describe alternatives you've considered
How have you tried to resolve it in the current version of the code? Have you considered non `c3-toolset` alternative solutions? Please elaborate.

**Additional context**
Add any other context or screenshots about the feature request here.
## Additional context
Add any other context or screenshots about the feature request here. Please feel free to suggest details about how you believe this feature request might be best implemented. If you have used similar features in other libraries, consider providing links or resources to example implementations.
16 changes: 8 additions & 8 deletions .github/prepare-nightly.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
import os
import re

_PATH_INIT = os.path.join(os.getcwd(), 'c3', '__init__.py')
_PATH_SETUP = os.path.join(os.getcwd(), 'setup.py')
_PATH_INIT = os.path.join(os.getcwd(), "c3", "__init__.py")
_PATH_SETUP = os.path.join(os.getcwd(), "setup.py")

# get today date
now = datetime.datetime.now()
now_date = now.strftime("%Y%m%d")

print(f"Update init - replace version by {now_date}")
with open(_PATH_INIT, 'r') as fp:
with open(_PATH_INIT, "r") as fp:
init = fp.read()
init = re.sub(r'__version__ = [\d\.\w\'"]+', f'__version__ = "{now_date}"', init)
with open(_PATH_INIT, 'w') as fp:
with open(_PATH_INIT, "w") as fp:
fp.write(init)

print(f"Update setup - replace version by {now_date} and update to c3-toolset-nightly")
with open(_PATH_SETUP, 'r') as fp:
with open(_PATH_SETUP, "r") as fp:
setup = fp.read()
setup = re.sub(r'version=[\d\.\w\'"]+', f'version="{now_date}"', setup)
setup = re.sub(r'name="c3-toolset"', f'name="c3-toolset-nightly"', setup)
with open(_PATH_SETUP, 'w') as fp:
fp.write(setup)
setup = re.sub(r'name="c3-toolset"', 'name="c3-toolset-nightly"', setup)
with open(_PATH_SETUP, "w") as fp:
fp.write(setup)
22 changes: 22 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## What
Describe very concisely what this Pull Request does.

## Why
Describe what motivated this Pull Request and why this was necessary. Use closing keywords to link to the relevant Issue. Ex. Closes #666

## How
Describe details of how you implemented the solution, outlining the major steps involved in adding this new feature or fixing this bug. Provide code-snippets if possible, showing example usage.

## Remarks
Add notes on possible known quirks/drawbacks of this solution. If this introduces an API-breaking change, please provide an explanation on why it is necessary to break API compatibility and how users should update their notebook/script workflows once this PR is merged.

## Checklist
Please include and complete the following checklist. Your Pull Request is (in most cases) not ready for review until the following have been completed. You can create a draft PR while you are still completing the checklist. Check the [Contribution Guidelines](https://github.com/q-optimize/c3/blob/dev/CONTRIBUTING.md) for more details. You can mark an item as complete with the `- [x]` prefix

- [ ] Tests - Added unit tests for new code, regression tests for bugs and updated the integration tests if required
- [ ] Formatting & Linting - `black` and `flake8` have been used to ensure styling guidelines are met
- [ ] Type Annotations - All new code has been type annotated in the function signatures using type hints
- [ ] Docstrings - Docstrings have been provided for functions in the `numpydoc` style
- [ ] Documentation - The tutorial style documentation has been updated to explain changes & new features
- [ ] Notebooks - Example notebooks have been updated to incorporate changes and new features
- [ ] Changelog - A short note on this PR has been added to the Upcoming Release section
15 changes: 4 additions & 11 deletions .github/workflows/build_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-18.04, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8]
python-version: [3.6, 3.7, 3.8, 3.9]
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
Expand All @@ -26,16 +26,9 @@ jobs:
- name: Install c3 package
run: |
python -m pip install --upgrade pip
pip install pytest-cov qiskit==0.23.2
pip install pytest qiskit==0.25.0
pip install .
- name: Test with pytest
run: |
pytest -v --cov=c3 --cov-report=xml test/
- name: Upload build stats to Codecov
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
env_vars: OS,PYTHON
name: build-c3
fail_ci_if_error: false
verbose: true
pytest -v -x -m "not slow" test/
pytest -v -x -m "slow" test/
4 changes: 2 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
workflow_dispatch:

jobs:
build:
coverage_check_upload:

runs-on: ubuntu-latest
strategy:
Expand All @@ -29,7 +29,7 @@ jobs:
pip install -r requirements.txt
- name: Test with pytest
run: |
pytest -v --cov=c3 --cov-report=xml test/
pytest -x -v --cov=c3 --cov-report=xml test/
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Code Complexity
name: Code Formatting and Linting

on:
push:
Expand All @@ -8,7 +8,7 @@ on:
workflow_dispatch:

jobs:
build:
format_lint_check:

runs-on: ubuntu-latest
strategy:
Expand All @@ -26,7 +26,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Test Complexity with Xenon
pip install black flake8
- name: Test Code Formatting with Black
run: |
xenon --max-absolute B --max-modules B --max-average A c3/
black --check c3/
- name: Code Linting with flake8
run: |
flake8 --count c3/
7 changes: 4 additions & 3 deletions .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ on:
workflow_dispatch:

jobs:
build:
integration_unit_tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-18.04, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8]
python-version: [3.6, 3.7, 3.8, 3.9]
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
Expand All @@ -29,4 +29,5 @@ jobs:
pip install -r requirements.txt
- name: Test with pytest
run: |
pytest -v --cov=c3 test/
pytest -v -x -m "not slow" test/
pytest -v -x -m "slow" test/
2 changes: 1 addition & 1 deletion .github/workflows/nightly_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-18.04, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8]
python-version: [3.6, 3.7, 3.8, 3.9]
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/notebook_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Notebook Test

on:
push:
branches: [ master, dev, 'release/*' ]
pull_request:
branches: [ master, dev, 'release/*' ]
workflow_dispatch:

jobs:
notebook_run_check:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.8]
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install jupyter notebook ipykernel matplotlib
pip install .
- name: Test with nbconvert
run: |
jupyter nbconvert --to notebook --inplace --execute examples/*.ipynb
2 changes: 1 addition & 1 deletion .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-18.04, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8]
python-version: [3.6, 3.7, 3.8, 3.9]
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,5 @@ dmypy.json

# swp files
*.swp
.stignore
okteto.yml
19 changes: 9 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
repos:
- repo: https://github.com/ambv/black
rev: stable
rev: 21.5b1
hooks:
- id: black
language_version: python3.8
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3
language_version: python3
- repo: https://github.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v0.790'
rev: 'v0.812'
hooks:
- id: mypy
args: [--no-strict-optional, --ignore-missing-imports]
additional_dependencies: [cma==3.0.3,
matplotlib==3.3.2,
numpy==1.18.5,
numpy==1.19.5,
scipy==1.5.2,
tensorflow==2.3.1,
tensorflow-probability==0.11.1,
tensorflow-estimator==2.3.0
tensorflow==2.4.2,
tensorflow-probability==0.12.1,
tensorflow-estimator==2.4.0
]
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Nicolas Wittler
Shai Machnes
Kevin Pack
Anurag Saha Roy
Niklas J Glaser
Max Werninghaus
Loading

0 comments on commit dcdb2be

Please sign in to comment.