Skip to content

Commit

Permalink
Merge branch 'microsoft:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
MarquessV authored Dec 13, 2023
2 parents 60129bd + 19ef9b5 commit b4a5f4f
Show file tree
Hide file tree
Showing 38 changed files with 891 additions and 22,071 deletions.
221 changes: 221 additions & 0 deletions .ado/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
trigger: none
pr: none

parameters:
- name: Build_Type
type: string
values:
- dev
- rc
- stable
default: 'dev'
- name: Patch_Number
type: number
default: 0
- name: Deploy_Azure_Quantum_Package
type: boolean
default: True
- name: Deploy_QDK_Package
type: boolean
default: False
- name: Create_GitHub_Release
type: boolean
default: False
- name: Publish_PyPi_Packages
type: boolean
default: False

variables:
- name: OwnerPersonalAlias
value: 'billti'

jobs:
- job: "Build_Azure_Quantum_Python"
pool:
vmImage: 'windows-latest'

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.11'

- script: |
pip install wheel
displayName: Install wheel
- script: |
pip freeze
displayName: List installed packages
- script: |
python set_version.py
env:
BUILD_TYPE: ${{ parameters.Build_Type }}
PATCH_NUMBER: ${{ parameters.Patch_Number }}
displayName: Set version
- script: |
cd $(Build.SourcesDirectory)/azure-quantum
python setup.py sdist --dist-dir=target/wheels
python setup.py bdist_wheel --dist-dir=target/wheels
displayName: Build azure-quantum package
- publish: $(Build.SourcesDirectory)/azure-quantum/target/wheels/
artifact: azure-quantum-wheels
displayName: Upload azure-quantum artifacts

- job: "Test_Azure_Quantum_Python"
pool:
vmImage: 'windows-latest'

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.11'

- script: |
pip install pytest pytest-azurepipelines pytest-cov
displayName: Install pytest dependencies
- script: |
pip freeze
displayName: List installed packages
- script: |
cd $(Build.SourcesDirectory)/azure-quantum
pip install .[all]
pytest --cov-report term --cov=azure.quantum --junitxml test-output-azure-quantum.xml $(Build.SourcesDirectory)/azure-quantum
displayName: Run azure-quantum unit tests
- task: PublishTestResults@2
displayName: 'Publish tests results (python)'
condition: succeededOrFailed()
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '**/test-*.xml'
testRunTitle: 'Azure Quantum Python Tests'

- job: "Build_QDK_Python"
pool:
vmImage: 'windows-latest'

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.11'

- script: |
pip install wheel
displayName: Install wheel
- script: |
pip freeze
displayName: List installed packages
- script: |
python set_version.py
env:
BUILD_TYPE: ${{ parameters.Build_Type }}
PATCH_NUMBER: ${{ parameters.Patch_Number }}
displayName: Set version
- script: |
cd $(System.DefaultWorkingDirectory)/qdk
python setup.py sdist --dist-dir=target/wheels
python setup.py bdist_wheel --dist-dir=target/wheels
displayName: Build qdk package
- publish: $(System.DefaultWorkingDirectory)/qdk/target/wheels/
artifact: qdk-wheels
displayName: Upload qdk-wheels artifacts

- job: "Approval"
dependsOn:
- "Build_Azure_Quantum_Python"
- "Build_QDK_Python"
- "Test_Azure_Quantum_Python"
pool: server
timeoutInMinutes: 1440 # job times out in 1 day
steps:
- task: ManualValidation@0
timeoutInMinutes: 1440 # task times out in 1 day
inputs:
notifyUsers: ''
instructions: 'Please verify artifacts and approve the release'
onTimeout: 'reject'

- job: "Publish_Python_Packages"
dependsOn: Approval
pool:
vmImage: 'windows-latest'

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.11'

- script: |
python set_version.py
env:
BUILD_TYPE: ${{ parameters.Build_Type }}
PATCH_NUMBER: ${{ parameters.Patch_Number }}
displayName: Set version
- download: current
artifact: azure-quantum-wheels
displayName: Download azure-quantum artifacts

- download: current
artifact: qdk-wheels
displayName: Download qdk artifacts

- task: CopyFiles@2
condition: ${{ parameters.Deploy_Azure_Quantum_Package }}
displayName: Copy azure-quantum artifacts
inputs:
SourceFolder: '$(Pipeline.Workspace)/azure-quantum-wheels'
Contents: '**'
TargetFolder: '$(Build.ArtifactStagingDirectory)/target/wheels'

- task: CopyFiles@2
condition: ${{ parameters.Deploy_QDK_Package }}
displayName: Copy qdk artifacts
inputs:
SourceFolder: '$(Pipeline.Workspace)/qdk-wheels'
Contents: '**'
TargetFolder: '$(Build.ArtifactStagingDirectory)/target/wheels'

- script: |
ls $(Build.ArtifactStagingDirectory)/target/wheels/*
displayName: List Py Artifacts to publish
- task: GitHubRelease@1
condition: ${{ parameters.Create_GitHub_Release }}
displayName: Create GitHub Release
inputs:
gitHubConnection: AzureQuantumOauth
repositoryName: Microsoft/azure-quantum-python
action: create
tagSource: 'userSpecifiedTag'
tag: azure-quantum_v$(PYTHON_VERSION)
isDraft: True
isPreRelease: ${{ ne(parameters.Build_Type, 'stable') }}
target: $(Build.SourceVersion)
addChangeLog: False
assets: |
$(Build.ArtifactStagingDirectory)/target/wheels/*
- task: EsrpRelease@4
condition: ${{ parameters.Publish_PyPi_Packages }}
displayName: Publish Py Packages
inputs:
ConnectedServiceName: 'ESRP_Release'
Intent: 'PackageDistribution'
ContentType: 'PyPi'
FolderLocation: '$(Build.ArtifactStagingDirectory)/target/wheels'
Owners: '$(OwnerPersonalAlias)@microsoft.com' # NB: Group email here fails the task with non-actionable output.
Approvers: '[email protected]'
# Auto-inserted Debugging defaults:
ServiceEndpointUrl: 'https://api.esrp.microsoft.com'
MainPublisher: 'QuantumDevelpmentKit' # ESRP Team's Correction (including the critical typo "Develpm").
DomainTenantId: '72f988bf-86f1-41af-91ab-2d7cd011db47'
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @microsoft/azurequantumclients
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
If you would like to become an active contributor to this project please
follow the instructions provided in [Microsoft Azure Projects Contribution Guidelines](https://opensource.microsoft.com/collaborate/).

## Pre-requisites

Install pre-reqs:

```bash
pip install azure_devtools pytest pytest-azurepipelines pytest-cov
```

## Building and testing ##

The Azure Quantum team uses [Anaconda](https://www.anaconda.com/products/individual) to create virtual environments for local unit and integration testing as well as in CI/CD.
Expand Down
58 changes: 10 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,33 @@
[![Build Status](https://dev.azure.com/ms-quantum-public/Microsoft%20Quantum%20(public)/_apis/build/status/microsoft.qdk-python?branchName=main)](https://dev.azure.com/ms-quantum-public/Microsoft%20Quantum%20(public)/_build/latest?definitionId=32&branchName=main)

# QDK-Python
# Azure Quantum SDK

## Introduction

QDK-Python is the repository for Python packages of the Quantum Development Kit (QDK). Currently, this consists of the following packages:
This repository contains the azure-quantum Python SDK.

Use azure-quantum SDK to submit quantum jobs written in Q#, Qiskit, or Cirq to the Azure Quantum service:

- `qdk` [![PyPI version](https://badge.fury.io/py/qdk.svg)](https://badge.fury.io/py/qdk)
- `azure-quantum` [![PyPI version](https://badge.fury.io/py/azure-quantum.svg)](https://badge.fury.io/py/azure-quantum)

Coming soon:
Deprecated:

- qsharp
- `qdk` [![PyPI version](https://badge.fury.io/py/qdk.svg)](https://badge.fury.io/py/qdk)
- Contains the qdk.chemistry packages.

## Installation and getting started

To install the packages, we recommend installing the Anaconda Python distribution. For instructions on installing Conda on your system, please follow the [Conda user guide](https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html).

To install the QDK package, run

```bash
pip install qdk
```

To install the Azure Quantum package, run
To install the Azure Quantum package, run:

```bash
pip install azure-quantum
```

To get started running examples, start a Jupyter notebook:

```bash
cd examples
jupyter notebook
```
To get started and submit your first job, see the official [Azure Quantum documentation](https://learn.microsoft.com/azure/quantum/quickstart-microsoft-qiskit-portal?pivots=platform-ionq).

## Development

Install pre-reqs:

```bash
pip install azure_devtools pytest pytest-azurepipelines pytest-cov
```

To create a new Conda environment, run:

```bash
conda env create -f environment.yml
```

in the root directory of the given package (`qdk` or `azure-quantum`).

Then to activate the environment:

```bash
conda activate <env name>
```

where `<env name>` is the environment name (`qdk` or `azurequantum`).

To install the package in development mode, run:

```bash
pip install -e .
```
See [CONTRIBUTING](./CONTRIBUTING.md) for instructions on how to build and test.

## Contributing

Expand All @@ -86,7 +49,6 @@ contact [[email protected]](mailto:[email protected]) with any additio

While we encourage contributions in any part of the code, there are some exceptions to take into account.
- The package `azure.quantum._client` is autogenerated using the [Azure Quantum Swagger spec](https://github.com/Azure/azure-rest-api-specs/tree/master/specification/quantum/data-plane). No manual changes to this code are accepted (because they will be lost next time we regenerate the client).
- The package `qdk.chemistry._xyz2mol` is maintained [here](https://github.com/jensengroup/xyz2mol) and included as a vendor package in this repo. Please make any suggestions or improvements to the code there.

## Trademarks

Expand Down
2 changes: 2 additions & 0 deletions azure-quantum/azure/quantum/qiskit/backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
IonQSimulatorBackend,
IonQQPUQirBackend,
IonQAriaQirBackend,
IonQForteBackend,
IonQForteQirBackend,
IonQSimulatorQirBackend,
)

Expand Down
Loading

0 comments on commit b4a5f4f

Please sign in to comment.