Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup file Changes for OpenQAOA Plugins #202

Merged
merged 84 commits into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
4403494
Adding setup.py to core, qiskit and azure
shahidee44 Mar 1, 2023
4a173e3
Added setup for openqaoa-core
shahidee44 Mar 1, 2023
7b3f7ea
Added setup and version files for plugins
shahidee44 Mar 1, 2023
d31ab13
Update unittest
shahidee44 Mar 1, 2023
4aac409
Revmoed unused file
shahidee44 Mar 1, 2023
56d7075
Update main setup for new structure
shahidee44 Mar 2, 2023
e6f9fc1
Merge branch 'dev_gate_applicator' into dev_setup_change
shahidee44 Mar 13, 2023
8bd613e
Added entry points for setup files
shahidee44 Mar 13, 2023
3e6f183
Moved version file and added pyproject.toml, license and readme
shahidee44 Mar 13, 2023
1107d72
Add publishing script
shahidee44 Mar 17, 2023
52961f5
Changed filemode
shahidee44 Mar 17, 2023
c1fb5c9
Added automation scripts for package deployment and update setup.py
shahidee44 Mar 20, 2023
1e7b778
Removed requirements from setup.py
shahidee44 Mar 21, 2023
81401e6
Bump version for testing, skip tests to be refactored
shahidee44 Mar 22, 2023
73a0e5a
Moved unittests
shahidee44 Mar 23, 2023
018e63d
Merged with dev
shahidee44 Mar 24, 2023
0fb0a32
Moved DeviceBase to different file
shahidee44 Mar 24, 2023
d660601
Moved unittests to plugins
shahidee44 Mar 29, 2023
824baf5
Moved some unittests, edited setup.py entry_point modules
shahidee44 Mar 29, 2023
a0e591b
Moved unittests
shahidee44 Mar 30, 2023
36f95a6
Updated unittests
shahidee44 Mar 30, 2023
5438aa4
Update unittests
shahidee44 Mar 30, 2023
3ea74be
Merge with dev
shahidee44 Mar 30, 2023
1db6695
Added convinience testing bash scripts
shahidee44 Mar 31, 2023
d5d7c85
Added pytest parallel execution
shahidee44 Mar 31, 2023
2980021
Update workflow yml
shahidee44 Mar 31, 2023
9267c55
Update version for new select
shahidee44 Apr 3, 2023
49d9689
Renamed unittests to be unique
shahidee44 Apr 3, 2023
1fe79d2
Update workflow
shahidee44 Apr 3, 2023
7b64459
Changed json path
shahidee44 Apr 3, 2023
d2b0725
Merged with dev
shahidee44 Apr 3, 2023
0db3f45
Updated qiskit plugin requirement
shahidee44 Apr 3, 2023
823ae70
Added Missing Imports
shahidee44 Apr 3, 2023
84e2e2a
Update Jobs unittests
shahidee44 Apr 4, 2023
1454794
Update Jobs unittests
shahidee44 Apr 4, 2023
d5b1553
Update script for plugin
shahidee44 Apr 4, 2023
7a96cea
Add import openqaoa
shahidee44 Apr 4, 2023
ec940d0
merged dev into branch and fixed conflicts
vishal-ph Apr 10, 2023
00f74bf
Updated root setup.py
shahidee44 Apr 17, 2023
3d098e3
Added manifest
shahidee44 Apr 18, 2023
e4e8341
Added automated build script for plugins
shahidee44 Apr 18, 2023
38e18ed
Updated setup.py and pyproject for poetry
shahidee44 Apr 18, 2023
a9c8115
Merged with dev
shahidee44 Apr 19, 2023
89b1a02
Removed unused file
shahidee44 Apr 19, 2023
42eb13c
Merge branch 'dev' into dev_setup_change
shahidee44 Apr 20, 2023
9311a2a
Merged with dev
shahidee44 Apr 21, 2023
62fd809
Update test_dev.yml
shahidee44 Apr 21, 2023
7120b03
Add tests
shahidee44 Apr 21, 2023
7785c15
Update pyproject.toml
shahidee44 Apr 21, 2023
4e0deb6
Update pyproject.toml
shahidee44 Apr 21, 2023
873cf1b
Update pyproject.toml
shahidee44 Apr 21, 2023
19c237a
Update pyproject.toml
shahidee44 Apr 21, 2023
e602ae2
Added extras for openqaoa-core
shahidee44 Apr 25, 2023
d0626fd
Update test_dev.yml
shahidee44 Apr 25, 2023
d1e8e9a
Update test_dev.yml
shahidee44 Apr 25, 2023
d6484e0
Update test_dev.yml
shahidee44 Apr 25, 2023
fdad411
Update pyproject
shahidee44 Apr 25, 2023
4512ce1
Update test_dev.yml
shahidee44 Apr 25, 2023
23aae3b
Removed unused code
shahidee44 Apr 25, 2023
9df994c
Added missing import
shahidee44 Apr 25, 2023
e99c5ab
Update test_dev.yml
shahidee44 Apr 25, 2023
33f655d
Updated setup.py
shahidee44 Apr 25, 2023
d152eda
Update conf.py for docs
shahidee44 Apr 26, 2023
36d2407
Update conf.py
shahidee44 Apr 26, 2023
13e5e6f
Update module
shahidee44 Apr 26, 2023
e35877c
Update conf.py
shahidee44 Apr 26, 2023
8f680c2
Updated conf.py
shahidee44 Apr 26, 2023
6dcc7cb
Update setup.py
shahidee44 Apr 26, 2023
4b90511
Update conf.py
shahidee44 Apr 26, 2023
59be06c
Update conf.py
shahidee44 Apr 26, 2023
b4ce662
Update conf.py
shahidee44 Apr 26, 2023
239cc95
Update .readthedocs.yml
shahidee44 Apr 27, 2023
c9127ef
Update .readthedocs.yml
shahidee44 Apr 27, 2023
fa8e3cf
Update .readthedocs.yml
shahidee44 Apr 27, 2023
92be3be
fixed merge conflicts with dev
vishal-ph May 2, 2023
9781868
[skip ci] fix to test_results.py
vishal-ph May 4, 2023
732b695
updated script error comments
vishal-ph May 7, 2023
6141f0f
Updated setup.py and pyproject.toml, use setuptools for setup
shahidee44 May 9, 2023
ce6a942
Added MANIFEST.in
shahidee44 May 9, 2023
c452f46
[skip-ci] removed poetry usage and made corresponding changes. can de…
vishal-ph May 9, 2023
28027aa
changes to backend wrapper test to accommodate plugin changes
vishal-ph May 10, 2023
773d94a
updated to failing backend wrapper tests
vishal-ph May 11, 2023
6975ce6
test file names causing issues with test, updated names
vishal-ph May 12, 2023
259fea1
removed cov report xml from test_dev
vishal-ph May 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/test_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ jobs:
python -m venv env
source env/bin/activate
python -m pip install --upgrade pip
pip install .[tests]
pip install .
pip install -e ./src/openqaoa-core[tests]
pip install ipykernel
- name: Setup IBMQ account
env:
Expand Down Expand Up @@ -63,8 +64,8 @@ jobs:
run: |
source env/bin/activate
ipython kernel install --name "env" --user
pytest tests/ -m 'not (qpu or sim)' --cov --cov-report=xml:coverage.xml

pip install pytest-xdist
pytest tests/ src/*/tests -m 'not (qpu or sim)' --cov -n auto
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3
with:
Expand All @@ -87,7 +88,8 @@ jobs:
- name: Install OpenQAOA
run: |
python -m pip install --upgrade pip
pip install .[docs]
pip install .
pip install -e ./src/openqaoa-core[docs]

- name: Install qvm
run: |
Expand Down
10 changes: 9 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ sphinx:
python:
install:
- method: pip
path: .
path: ./src/openqaoa-core
extra_requirements:
- docs
- method: pip
path: ./src/openqaoa-qiskit
- method: pip
path: ./src/openqaoa-pyquil
- method: pip
path: ./src/openqaoa-azure
- method: pip
path: ./src/openqaoa-braket
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
recursive-include src/* README.md requirements*.txt
47 changes: 47 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#This file stores instructions to install openqaoa in developer mode.
# Currently can only install all packages together for developer mode.

.PHONY: dev-install
dev-install:
pip install -e .
pip install -e ./src/openqaoa-core
pip install -e ./src/openqaoa-qiskit
pip install -e ./src/openqaoa-pyquil
pip install -e ./src/openqaoa-braket
pip install -e ./src/openqaoa-azure

.PHONY: dev-install-tests
dev-install-tests:
pip install -e .
pip install -e ./src/openqaoa-core[tests]
pip install -e ./src/openqaoa-qiskit
pip install -e ./src/openqaoa-pyquil
pip install -e ./src/openqaoa-braket
pip install -e ./src/openqaoa-azure

.PHONY: dev-install-docs
dev-install-docs:
pip install -e .
pip install -e ./src/openqaoa-core[docs]
pip install -e ./src/openqaoa-qiskit
pip install -e ./src/openqaoa-pyquil
pip install -e ./src/openqaoa-braket
pip install -e ./src/openqaoa-azure

.PHONY: dev-install-all
dev-install-all:
pip install -e .
pip install -e ./src/openqaoa-core[all]
pip install -e ./src/openqaoa-qiskit
pip install -e ./src/openqaoa-pyquil
pip install -e ./src/openqaoa-braket
pip install -e ./src/openqaoa-azure

.PHONY: dev-uninstall
dev-uninstall:
pip uninstall openqaoa -y
pip uninstall openqaoa-core -y
pip uninstall openqaoa-qiskit -y
pip uninstall openqaoa-pyquil -y
pip uninstall openqaoa-braket -y
pip uninstall openqaoa-azure -y
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,16 @@ To run the test, first, make sure to have installed all the optional testing dep

> :warning: **Some tests require authentication**: Please, check the flags in `pytest.ini`. Currently these testes are marked `qpu`, `api`, `docker_aws`, `braket_api`, `sim`

> :warning: **Some tests require Rigetti's QVM or a valid AWS Jobs docker**: Please, note these tests are marked as `qvm` and `docker_aws` (see Rigetti's documentation [here](https://pyquil-docs.rigetti.com/en/v3.1.0/qvm.html) for more information).
> :warning: **Some tests require authentication**: Please, note that the PyQuil-Rigetti tests contained in `test_pyquil_qvm.py` requires an active `qvm` (see Rigetti's documentation [here](https://pyquil-docs.rigetti.com/en/v3.1.0/qvm.html))

## For Developers

This repository was packaged with `poetry`. The default `pyproject.toml` file installs the internal plugin depedencies as editable through `poetry`. If you need to create an editable install of this repository do the following in the root directory of this repository:

```bash
poetry install
```

## Contributing and feedback

If you find any bugs or errors, have feature requests, or code you would like to contribute, feel free to open an issue or send us a pull request on GitHub.
Expand Down
19 changes: 19 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@
# sys.path.insert(0, os.path.abspath('.'))
# sys.path.insert(0, os.path.abspath("../../"))
sys.path.insert(0, os.path.abspath("../.."))
for each_folder_name in os.listdir(os.path.abspath("../../src")):
sys.path.insert(0, os.path.abspath("../../src/" + each_folder_name))
# sys.path.insert(0, os.path.abspath("../../src/openqaoa-core"))
# sys.path.insert(0, os.path.abspath("../../src/openqaoa-qiskit"))
# sys.path.insert(0, os.path.abspath("../../src/openqaoa-pyquil"))
# sys.path.insert(0, os.path.abspath("../../src/openqaoa-braket"))
# sys.path.insert(0, os.path.abspath("../../src/openqaoa-azure"))
print(sys.path)

# from openqaoa.qaoa_parameters.baseparams import shapedArray
Expand Down Expand Up @@ -51,6 +58,18 @@
"sphinx.ext.intersphinx",
]

autodoc_mock_imports = [
"botocore",
"qiskit_aer",
"pyquil",
"azure",
"boto3",
"qcs_api_client",
"qiskit_ibm_provider",
"qiskit",
"braket",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
build-backend = "setuptools.build_meta"
12 changes: 12 additions & 0 deletions scripts/install_all_subpackages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#Exit immediately if a command exits with a non-zero status.
set -e

# The order of install is important therefore the list cannot be dynamically generated
modulesList=("openqaoa-core" "openqaoa-qiskit" "openqaoa-braket" "openqaoa-pyquil" "openqaoa-azure")

for entry in "${modulesList[@]}"; do
echo "processing src/$entry/setup.py"
cd src/$entry
pip install .
cd "../.."
done
23 changes: 23 additions & 0 deletions scripts/install_and_test_openqaoa_azure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#Exit immediately if a command exits with a non-zero status.
set -e

# TODO: Dynamically generate names (The order of installing and pushing is important here.)
modulesList=("openqaoa-core" "openqaoa-qiskit" "openqaoa-azure")

for entry in "${modulesList[@]}"; do
echo "processing src/$entry/setup.py"
cd src/$entry
pip install .
cd "../.."
done

for entry in "${modulesList[@]}"; do
echo "testing $entry"
cd src/$entry
pytest -n auto tests
cd "../.."
done

for entry in "${modulesList[@]}"; do
pip uninstall -y $entry
done
23 changes: 23 additions & 0 deletions scripts/install_and_test_openqaoa_braket.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#Exit immediately if a command exits with a non-zero status.
set -e

# TODO: Dynamically generate names (The order of installing is important here.)
modulesList=("openqaoa-core" "openqaoa-braket")

for entry in "${modulesList[@]}"; do
echo "processing src/$entry/setup.py"
cd src/$entry
pip install .
cd "../.."
done

for entry in "${modulesList[@]}"; do
echo "testing $entry"
cd src/$entry
pytest -n auto tests
cd "../.."
done

for entry in "${modulesList[@]}"; do
pip uninstall -y $entry
done
23 changes: 23 additions & 0 deletions scripts/install_and_test_openqaoa_core.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#Exit immediately if a command exits with a non-zero status.
set -e

# TODO: Dynamically generate names (The order of installing and pushing is important here.)
modulesList=("openqaoa-core")

for entry in "${modulesList[@]}"; do
echo "processing src/$entry/setup.py"
cd src/$entry
pip install .
cd "../.."
done

for entry in "${modulesList[@]}"; do
echo "testing $entry"
cd src/$entry
pytest -n auto tests
cd "../.."
done

for entry in "${modulesList[@]}"; do
pip uninstall -y $entry
done
9 changes: 9 additions & 0 deletions scripts/install_and_test_openqaoa_dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#Exit immediately if a command exits with a non-zero status.
set -e

# TODO: Dynamically generate names (The order of installing is important here.)
modulesList=("src/openqaoa-core" "src/openqaoa-qiskit" "src/openqaoa-braket" "src/openqaoa-pyquil" "src/openqaoa-azure")

pip install .
pytest tests/ src/*/tests
pip uninstall -y openqaoa
23 changes: 23 additions & 0 deletions scripts/install_and_test_openqaoa_pyquil.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#Exit immediately if a command exits with a non-zero status.
set -e

# TODO: Dynamically generate names (The order of installing and pushing is important here.)
modulesList=("openqaoa-core" "openqaoa-pyquil")

for entry in "${modulesList[@]}"; do
echo "processing src/$entry/setup.py"
cd src/$entry
pip install .
cd "../.."
done

for entry in "${modulesList[@]}"; do
echo "testing $entry"
cd src/$entry
pytest -n auto tests
cd "../.."
done

for entry in "${modulesList[@]}"; do
pip uninstall -y $entry
done
23 changes: 23 additions & 0 deletions scripts/install_and_test_openqaoa_qiskit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#Exit immediately if a command exits with a non-zero status.
set -e

# TODO: Dynamically generate names (The order of installing and pushing is important here.)
modulesList=("openqaoa-core" "openqaoa-qiskit")

for entry in "${modulesList[@]}"; do
echo "processing src/$entry/setup.py"
cd src/$entry
pip install .
cd "../.."
done

for entry in "${modulesList[@]}"; do
echo "testing $entry"
cd src/$entry
pytest -n auto tests
cd "../.."
done

for entry in "${modulesList[@]}"; do
pip uninstall -y $entry
done
18 changes: 18 additions & 0 deletions scripts/push_package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#Exit immediately if a command exits with a non-zero status.
set -e

# TODO: Dynamically generate names (The order of installing and pushing is important here.)
modulesList=("src/openqaoa-core" "src/openqaoa-qiskit" "src/openqaoa-braket" "src/openqaoa-pyquil" "src/openqaoa-azure")

python scripts/test_version.py

for entry in "${modulesList[@]}"; do
echo "processing $entry/setup.py"
cd $entry
pip install .
# python -m build
python3 setup.py -q sdist
python3 setup.py -q bdist_wheel
twine upload --repository testpypi dist/* --username $1 --password $2
cd "../.."
done
6 changes: 6 additions & 0 deletions scripts/run_all_install_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
install_and_test_openqaoa_core.sh
install_and_test_openqaoa_qiskit.sh
install_and_test_openqaoa_pyquil.sh
install_and_test_openqaoa_braket.sh
install_and_test_openqaoa_azure.sh
install_and_test_openqaoa_dev.sh
16 changes: 16 additions & 0 deletions scripts/test_build_dist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#Exit immediately if a command exits with a non-zero status.
set -e

# TODO: Dynamically generate names (The order of installing and pushing is important here.)
modulesList=("src/openqaoa-core" "src/openqaoa-qiskit" "src/openqaoa-braket" "src/openqaoa-pyquil" "src/openqaoa-azure")

# This script checks that all internal plugins have the same version number
python scripts/test_version.py

for entry in "${modulesList[@]}"; do
echo "processing $entry/setup.py"
cd $entry
pip install -e .
python -m build
cd "../.."
done
5 changes: 5 additions & 0 deletions scripts/test_install_package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
modulesList=("openqaoa-core" "openqaoa-qiskit" "openqaoa-braket" "openqaoa-pyquil" "openqaoa-azure")

for entry in "${modulesList[@]}"; do
pip install -i https://test.pypi.org/simple/ --no-deps $entry
done
31 changes: 31 additions & 0 deletions scripts/test_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import os
import importlib

version_dict = {}
for each_file in os.listdir("src"):
if each_file.startswith("openqaoa-"):
__version__ = ""
if not each_file == "openqaoa-core":
exec(
open(
"./src/"
+ each_file
+ "/"
+ each_file.replace("-", "_")
+ "/_version.py"
).read()
)
else:
exec(open("./src/" + each_file + "/openqaoa/_version.py").read())
version_dict.update({each_file: __version__})

version_check = [
each_item == version_dict["openqaoa-core"] for each_item in version_dict.values()
]
for each_check in version_check:
if not each_check:
raise Exception(
"All Plugins should have the same version as the core version of OQ. {}".format(
version_dict
)
)
Loading