-
Notifications
You must be signed in to change notification settings - Fork 35
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
[WIP] Issue-181 | Prepare for summer school release #182
Merged
Merged
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8ef36de
Issue-181 | CD: release to PyPi on tag
IceKhan13 a6f130c
Issue-181 | Documentation: fix tutorials
IceKhan13 6206131
revert interactor
IceKhan13 457b4f6
Issue-181 | CD: deploy docs
IceKhan13 16fdc4d
Merge branch 'main' into issue-181/prep-for-release-cycles
IceKhan13 374e7eb
Issue 181 | Workflows: use cibuildwheel for package distributions
IceKhan13 253a81c
Issue 181 | Requirements specifications
IceKhan13 5877048
Issue 181 | Requirements specs fix
IceKhan13 429f40c
Docs: contribution guidelines
IceKhan13 8b77a67
Merge branch 'main' into issue-181/prep-for-release-cycles
IceKhan13 9c32559
Docs: installation and beginner guide
IceKhan13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# This code is part of Qiskit. | ||
# | ||
# (C) Copyright IBM 2021, 2022. | ||
# | ||
# This code is licensed under the Apache License, Version 2.0. You may | ||
# obtain a copy of this license in the LICENSE.txt file in the root directory | ||
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. | ||
# | ||
# Any modifications or derivative works of this code must retain this | ||
# copyright notice, and modified files need to carry a notice indicating | ||
# that they have been altered from the originals. | ||
|
||
name: Deploy Docs | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
docs_publish: | ||
if: ${{ startsWith(github.ref, 'refs/heads/stable') && contains('["manoelmarques","mtreinish","dsvandet","awcross1","quantumjim","grace-harper-ibm","IceKhan13"]', github.actor) }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.8] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- uses: ./.github/actions/install-machine-learning | ||
- name: Install Dependencies | ||
run: | | ||
pip install jupyter sphinx_rtd_theme qiskit-terra[visualization] 'torchvision<0.10.0' | ||
sudo apt-get install -y pandoc graphviz | ||
shell: bash | ||
- name: Build and publish | ||
env: | ||
encrypted_rclone_key: ${{ secrets.encrypted_rclone_key }} | ||
encrypted_rclone_iv: ${{ secrets.encrypted_rclone_iv }} | ||
QISKIT_PARALLEL: False | ||
QISKIT_DOCS_BUILD_TUTORIALS: 'always' | ||
run: | | ||
echo "earliest_version: 0.1.0" >> releasenotes/config.yaml | ||
tools/ignore_untagged_notes.sh | ||
make html | ||
tools/deploy_documentation.sh | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# This code is part of Qiskit. | ||
# | ||
# (C) Copyright IBM 2022. | ||
# | ||
# This code is licensed under the Apache License, Version 2.0. You may | ||
# obtain a copy of this license in the LICENSE.txt file in the root directory | ||
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. | ||
# | ||
# Any modifications or derivative works of this code must retain this | ||
# copyright notice, and modified files need to carry a notice indicating | ||
# that they have been altered from the originals. | ||
|
||
name: Release to PyPi | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
code_publish: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.7] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Deploy to Pypi | ||
env: | ||
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} | ||
TWINE_USERNAME: qiskit | ||
run : | | ||
pip install -U twine pip setuptools virtualenv wheel | ||
python3 setup.py sdist bdist_wheel | ||
twine upload dist/qiskit* | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "afc9dead", | ||
"metadata": {}, | ||
"source": [ | ||
"# How-to: query codes database" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "a0aca94a", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from qiskit_qec.qec_codebase.qec_codebase_interactor import QECCodeBase\n", | ||
"from qiskit_qec.operators.pauli_list import PauliList\n", | ||
"from qiskit_qec.structures.gauge import GaugeGroup\n", | ||
"from qiskit_qec.codes import SubSystemCode\n", | ||
"from qiskit_qec.exceptions import QiskitQECError" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "29d05317", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import os\n", | ||
"\n", | ||
"codebase_dir_path = os.environ.get(\"CODE_DB_PATH\")\n", | ||
"db = QECCodeBase(codebase_dir_path)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "6f7ec06d", | ||
"metadata": {}, | ||
"source": [ | ||
"### Basic query" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "caf152da", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"derulo_codes = db.get_subsystem_code(2, 1) # all 2,1 codes\n", | ||
"print(\"derulo\", len(derulo_codes))\n", | ||
"print(derulo_codes[0].gauge_group.generators)\n", | ||
"print(derulo_codes[0].parameters)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "647b9829", | ||
"metadata": {}, | ||
"source": [ | ||
"### Multi query" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "a7a3e592", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"swift_codes = db.get_subsystem_code([3, 2], [0, 1]) # all codes: (2,0), (2,1), (3,0), (3,1)\n", | ||
"len(swift_codes)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "326981dc", | ||
"metadata": {}, | ||
"source": [ | ||
"### QUERY sans results\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "ffaa7d2e", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"nope_codes = db.get_subsystem_code(3, 4)\n", | ||
"print(\"nope\", len(nope_codes))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "92252b55", | ||
"metadata": {}, | ||
"source": [ | ||
"### Query with parameters\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "dee58738", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"the1975_additional_params = {\"logical_ops\": \"ixi\"}\n", | ||
"the1975_codes = db.get_subsystem_code(\n", | ||
" 3, 2, **the1975_additional_params\n", | ||
") # all (3,2) codes that have css_logicals === \"ixi\"\n", | ||
"print(\"1975\", len(the1975_codes))\n", | ||
"\n", | ||
"glass_animals_params = {\"weight_enumerator\": 1}\n", | ||
"glass_animals_codes = db.get_subsystem_code(\n", | ||
" 2, 1, acceptable_missing_params={\"weight_enumerator\"}, **glass_animals_params\n", | ||
") # all codes (2,1) such that they either have \"1\" in their weight_enumerator list OR don't have weight_enumerator as a variable\n", | ||
"print(\"glass\", len(glass_animals_codes))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "fc4287da", | ||
"metadata": {}, | ||
"source": [ | ||
"### Deriving your own code" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "f70d6ddc", | ||
"metadata": { | ||
"scrolled": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"new_code = derulo_codes[0]\n", | ||
"new_code.parameters[\"my_new_param\"] = 123\n", | ||
"print(new_code.parameters)\n", | ||
"\n", | ||
"db.store_new_subsystem_code(new_code, allow_new_fields=True)\n", | ||
"new_derulo_codes = db.get_subsystem_code(2, 1) # all 2,1 codes\n", | ||
"print(\"new_derulo_codes\", len(new_derulo_codes))\n", | ||
"\n", | ||
"# You can limit your query results to only those in the standard codebase (Andrew's codebase)\n", | ||
"# by telling the database not to query the playground codebase\n", | ||
"\n", | ||
"only_standard_codes_derulo = db.get_subsystem_code(2, 1, allow_playground=False)\n", | ||
"print(\"only standard derulo codes\", len(only_standard_codes_derulo))\n", | ||
"\n", | ||
"# If you're going to add a lot of codes at once, set cache=True and flush after:\n", | ||
"my_code = SubSystemCode(GaugeGroup(PauliList(\"XX\")))\n", | ||
"my_code.parameters = {db.IS_GF4LINEAR: 1, db.N: 4, db.K: 2}\n", | ||
"\n", | ||
"for i in range(300):\n", | ||
" db.store_new_subsystem_code(my_code, flush_cache=False, force=True)\n", | ||
"\n", | ||
"db.flush_cache() # actually create/write to the json file\n", | ||
"\n", | ||
"retrieved_codes = db.get_subsystem_code(4, 2)\n", | ||
"\n", | ||
"db.delete_playground_codebase(True) # kill all the codes you've made" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.9.7" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there is a c++ extension in the package this won't be portable and isn't something you should publish as it will depend on the system libraries versions. You should leverage cibuildwheel here to build portable wheels of the package for distribution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mtreinish How do we test different distros for aer for example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't really have to test with different distros in CI, that's what cibuildwheel is for. It builds the binaries in the manylinux docker image to ensure the glibc and other libraries are at old enough versions (by basically just using red hat which is always the oldest) and then auditwheel is used to statically link any dynamic libs and check the symbols are compatible with the manylinux packaging specs and update the wheel tags. If you configure cibiuldwheel correctly and have it run tests of the wheels it should be sufficient to have confidence it will work in any environment that is compatible with the manylinux tags