This is a template repository for Orquestra Python projects.
After creating repository from this template, make sure to follow the steps below:
- Specify license. Supply LICENSE file and fill license entry in
setup.cfg
accordingly. - Update
setup.cfg
. At the very least update the following fields:[metadata]
section:name
,description
,license
,license_file
,install_requires
in[options]
section. You don't have to do this at the very beginning and you may add requirements as you go, but be wary that the ones present in this repository are only example ones and may not be applicable to your project.
- Substitute an example
orquestra.pythontemplate
packagesrc/
directory with your actual code. Remember, thatorquestra
is a namespace package, so you cannot put an__init__.py
insrc/orquestra
directory. Remove tests for the dummy package and replace them with meaningful ones as you develop your package. - (optional) Follow instructions below for setting up PR checks.
- Delete PR_checks.png and manual_workflow_run.png from main directory.
- Remove this instruction and replace it with a meaningful description of your package.
Here we have instructions for making github perform checks automatically when contributors make a PR to main. These checks will prevent any merges to main
which do not pass style and test checks, ensuring your repository is always clean and functional.
-
From the main directory of your repository on the
main
branch, run the commandsgit subtree add -P subtrees/z_quantum_actions https://github.com/zapatacomputing/z-quantum-actions.git main --squash git push origin main
If this step fails, contact quantum software team for help. Do not modify any content in the
subtrees
directory which is created by this command. Contact quantum software team if you need to change it. -
From your repository's github page, go to settings.
-
Select branches on the left side bar and click add rule.
-
Check boxes and type in the status checks as shown below. If github cannot find status checks, go to steps 3 a-d. Otherwise, move on to step 4.
a. If github cannot find status checks you will have to run them manually. Click on the actions tab.
b. For the TestCoverage and Style workflows, click run workflow and then click run workflow again in the green pop-up box.
c. Wait a few minutes for the checks to pass, if they fail then check to make sure they work on your machine.
d. Once the checks have been completed, add them as you would have in step 3.
-
If your repository has dependencies from orquestra-* libraries, repeat these steps for
style.yml
andcoverage.yml
in the.github/workflows
directory.a. Uncomment the following lines of code
- name: Get orquestra-quantum uses: actions/checkout@v2 with: repository: zapatacomputing/orquestra-quantum path: orquestra-quantum ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
b. Replace all instances
orquestra-quantum
with name of the repository your code depends on.c. If the dependency is public, delete the last line:
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
. If the dependency is private, keep this line and do the following:- Uncomment the following lines of code:
- uses: ./subtrees/z_quantum_actions/actions/ssh_setup with: ssh_key: ${{ secrets.SSH_PRIVATE_KEY }}
-
Add
SSH_PRIVATE_KEY
to Github secrets of this repo. -
Add
readonly-bots
with read access to the dependency repo. -
If you have multiple private dependencies, you will only need to do this once.
d. Repeat this process for all your dependencies. When you are finished, you should have one of the above commands for each dependency.
-
If your repository has dependencies from orquestra-* libraries, open the
Makefile
in the main directory of your repository and do the following:a. Replace its contents with:
include subtrees/z_quantum_actions/Makefile github_actions: ${PYTHON_EXE} -m venv ${VENV_NAME} "${VENV_NAME}/${VENV_BINDIR}/${PYTHON_EXE}" -m pip install --upgrade pip "${VENV_NAME}/${VENV_BINDIR}/${PYTHON_EXE}" -m pip install -e ./<your-orquestra-dependency-here> "${VENV_NAME}/${VENV_BINDIR}/${PYTHON_EXE}" -m pip install -e '.[dev]'
b. Replace
<your-orquestra-dependency-here>
in line 6 with the name of an orquestra dependency. Add similar lines for all other orquestra-* dependencies below line 6. At the end of this step, yourMakefile
should look something like this:include subtrees/z_quantum_actions/Makefile github_actions: ${PYTHON_EXE} -m venv ${VENV_NAME} "${VENV_NAME}/${VENV_BINDIR}/${PYTHON_EXE}" -m pip install --upgrade pip "${VENV_NAME}/${VENV_BINDIR}/${PYTHON_EXE}" -m pip install -e ./orquestra-quantum "${VENV_NAME}/${VENV_BINDIR}/${PYTHON_EXE}" -m pip install -e ./orquestra-opt "${VENV_NAME}/${VENV_BINDIR}/${PYTHON_EXE}" -m pip install -e ./orquestra-vqa "${VENV_NAME}/${VENV_BINDIR}/${PYTHON_EXE}" -m pip install -e '.[dev]'
-
Open your terminal, navigate to the main directory of your repository, and run the following lines of code one by one:
git checkout -b add-PR-dependencies git add .github/workflows/coverage.yml .github/workflows/style.yml Makefile git commit -m "feat(.github): added PR check dependencies" git push origin add-PR-dependencies
-
Create a pull request (PR) to main. The option to make a PR should appear once you go back to the github page for your repository after completing step 7.
-
After making your PR, ensure that tests run and pass. If there are any persistent issues, contact quantum software team.