зеркало из https://github.com/microsoft/iqsharp.git
Build conda packages for IQ#, qsharp.py (#37)
* Started iqsharp recipe.
* Update Jupyter.Core dependency to get --sys-prefix.
* Started work on packing new recipe.
* Modify steps to use conda env instead.
* Remove redundant step.
* Updated description.
* Add conda package to drop.
* Some very painful shell scripting.
* Move iqsharp conda install to opt.
* Fix order in which we add to path.
* Fix some bugs building dotnetcore-sdk from Linux.
* Use powershell instead of pwsh when building from Windows.
* Suppress profile when building iqsharp on POSIX.
* Made pwsh dependency from iqsharp POSIX-only.
* Started working on pwsh package.
* Only pack pwsh on non-Windows hosts.
* Prevent pwsh from capturing NuGet cache.
* Fix PowerShell 5.1 vs 6.2 issues.
* Fixed name of DOTNET_ROOT env var.
* Fix Runtime ID check on PS 5.1.
* Fix name of activation/deactivation scripts.
* Force line endings to enable patching 10607.
* Add SHA256 sums.
* Build fixes for # [non win].
* Fixes to test.
* Fixed meta.yaml for windows.
* Version bump
* Suppress posh profile on Windows.
* Fixed line endings in dotnet/cli#10607 workaround.
* Pin versions in pwsh.
* Added slightly more tests to iqsharp package.
* Use Jinja2 to handle IQ# version passed by set-env.ps1.
* Added qsharp package as well.
* Added qsharp package to pack as well.
* macOS fixes
* Fix some metadata.
* Extended build definition for xplat conda build.
* Renamed xplat conda build jobs.
* Propagate step template parameter into env.
* Adding more detail to pack diagnostics.
* Handle stderr from conda-build better.
* Detect $IsWindows even on Windows.
* Revert and downgrade to warning.
* Separate out conda-build call into separate job.
* Find .NET Core SDK more reliabily.
* Write conda build logs to temporary file as well.
* trying again to log.
* Explicitly write all conda-build output to host.
* Fixing property name in log upload.
* Fix uploadfile task command.
* Trying again to get any log information out of ADO.
* Don't trust conda-build's exit code.
* Switch to using pwsh everywhere.
* Fix macOS-specific bug.
* Fix pack-conda diagnostics.
* Forgot to remove log upload.
* First stab at removing dotnetcore-sdk and pwsh recipes.
* Updated pack script for reduced package set.
* Fixed test-time requirements for iqsharp.
* Force pwsh vs powershell.
* Try using pwsh on Windows.
* Lock conda-build to 3.18.8.
* Added call to dotnet --info.
* Revert "Added call to dotnet --info."
This reverts commit eeaf8a9ebd
.
* Lock conda build to dotnet 2.2.401
* Adding more diagnostics.
* More diagnostics.
* even more diagnostics
* Disable binary prefix searching.
* yet more debugging
* fix diagnostics.
* One more fix to diagnostics.
* one moar fix
* undo diagnostics.
* Workaround for conda/conda-build#3736.
* Workaround for conda/conda-build#3170.
* Trying again to redirect stderr.
* trying one more time to suppress stderr.
* Putting try catch back.
* Redirect just stderr.
* Downgrade error action as well.
* Build 3.6 and 3.7 versions.
* Adding python version to outputs as well.
This commit is contained in:
Родитель
8c925af20d
Коммит
81120dbec4
Двоичный файл не отображается.
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
// Use IntelliSense to find out which attributes exist for C# debugging
|
||||
// Use hover for the description of the existing attributes
|
||||
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": ".NET Core Launch (console)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
// If you have changed target frameworks, make sure to update the program path.
|
||||
"program": "${workspaceFolder}/src/Tool/bin/Debug/netcoreapp2.2/Microsoft.Quantum.IQSharp.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/src/Tool",
|
||||
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
|
||||
"console": "internalConsole",
|
||||
"stopAtEntry": false
|
||||
},
|
||||
{
|
||||
"name": ".NET Core Attach",
|
||||
"type": "coreclr",
|
||||
"request": "attach",
|
||||
"processId": "${command:pickProcess}"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"build",
|
||||
"${workspaceFolder}/src/Tool/Tool.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "publish",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"publish",
|
||||
"${workspaceFolder}/src/Tool/Tool.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "watch",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"watch",
|
||||
"run",
|
||||
"${workspaceFolder}/src/Tool/Tool.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -195,7 +195,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
-------------------------------------------------------------------
|
||||
|
||||
Microsoft.Jupyter.Core 1.1.14623 - MIT
|
||||
Microsoft.Jupyter.Core 1.1.17470 - MIT
|
||||
(c) 2008 VeriSign, Inc.
|
||||
(c) Microsoft Corporation.
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
|
18
build/ci.yml
18
build/ci.yml
|
@ -15,3 +15,21 @@ jobs:
|
|||
displayName: 'Component Detection'
|
||||
inputs:
|
||||
failOnAlert: true
|
||||
|
||||
- job: "pack_conda_linux"
|
||||
pool:
|
||||
vmImage: ubuntu-16.04
|
||||
steps:
|
||||
- template: steps-conda.yml
|
||||
|
||||
- job: "pack_conda_macos"
|
||||
pool:
|
||||
vmImage: macOS-10.14
|
||||
steps:
|
||||
- template: steps-conda.yml
|
||||
|
||||
- job: "pack_conda_win"
|
||||
pool:
|
||||
vmImage: windows-2019
|
||||
steps:
|
||||
- template: steps-conda.yml
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
& "$PSScriptRoot/set-env.ps1"
|
||||
$all_ok = $True
|
||||
$CondaPlatform = (conda info --json) `
|
||||
| ConvertFrom-Json `
|
||||
| Select-Object -ExpandProperty platform;
|
||||
|
||||
# Write out diagnostics about what version of PowerShell we're on.
|
||||
$PSVersionTable | Format-Table | Out-String | Write-Host;
|
||||
|
||||
function Pack-CondaRecipe() {
|
||||
param(
|
||||
[string] $Path,
|
||||
[string[]] $PythonVersions = @("3.6", "3.7")
|
||||
);
|
||||
|
||||
if (-not (Get-Command conda-build -ErrorAction SilentlyContinue)) {
|
||||
Write-Host "##vso[task.logissue type=warning;] conda-build not installed. " + `
|
||||
"Will skip creation of conda package for $Path.";
|
||||
return;
|
||||
}
|
||||
|
||||
# conda-build prints some warnings to stderr, which can lead to false positives.
|
||||
# We wrap in a try-finally to make sure we can condition on the built file being there, and not on
|
||||
# writing to stderr.
|
||||
try {
|
||||
$OldPreference = $ErrorActionPreference;
|
||||
$ErrorActionPreference = "Continue";
|
||||
$PythonVersions | `
|
||||
ForEach-Object {
|
||||
Write-Host "##[info]Running: conda build $(Resolve-Path $Path) --python=$_"
|
||||
# See https://stackoverflow.com/a/20950421/267841 for why this works to force conda
|
||||
# to output all log messages to stdout instead of stderr.
|
||||
conda build (Resolve-Path $Path) --python=$_ 2>&1 | ForEach-Object { "$_" };
|
||||
}
|
||||
} catch {
|
||||
Write-Host "##vso[task.logissue type=warning;]conda build error: $_";
|
||||
} finally {
|
||||
$ErrorActionPreference = $OldPreference;
|
||||
$TargetDir = (Join-Path $Env:CONDA_OUTDIR $CondaPlatform);
|
||||
New-Item -ItemType Directory -Path $TargetDir -Force -ErrorAction SilentlyContinue;
|
||||
$PythonVersions | `
|
||||
ForEach-Object {
|
||||
$PackagePath = (conda build (Resolve-Path $Path) --python=$_ --output);
|
||||
if (Test-Path $PackagePath) {
|
||||
Copy-Item `
|
||||
$PackagePath `
|
||||
$TargetDir `
|
||||
-ErrorAction Continue `
|
||||
-Verbose;
|
||||
Write-Host "##[info]Copied $PackagePath to $TargetDir.";
|
||||
} else {
|
||||
Write-Host "##vso[task.logissue type=error;]Failed to create conda package for $Path (Python $_)."
|
||||
$script:all_ok = $False
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "##[info]Packing conda recipes..."
|
||||
Pack-CondaRecipe -Path "../conda-recipes/iqsharp"
|
||||
Pack-CondaRecipe -Path "../conda-recipes/qsharp"
|
||||
|
||||
if (-not $all_ok) {
|
||||
throw "At least one package failed to build. Check the logs."
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
& "$PSScriptRoot/set-env.ps1"
|
||||
|
@ -92,7 +91,3 @@ Pack-Wheel '../src/Python/'
|
|||
|
||||
Write-Host "##[info]Packing Docker image..."
|
||||
Pack-Image -RepoName "iqsharp-base" -Dockerfile '../images/iqsharp-base/Dockerfile'
|
||||
|
||||
if (-not $all_ok) {
|
||||
throw "At least one package failed to build. Check the logs."
|
||||
}
|
||||
|
|
|
@ -21,6 +21,9 @@ If (-not (Test-Path -Path $Env:NUGET_OUTDIR)) { [IO.Directory]::CreateDirectory(
|
|||
If ($Env:PYTHON_OUTDIR -eq $null) { $Env:PYTHON_OUTDIR = (Join-Path $Env:DROPS_DIR "wheels") }
|
||||
If (-not (Test-Path -Path $Env:PYTHON_OUTDIR)) { [IO.Directory]::CreateDirectory($Env:PYTHON_OUTDIR) }
|
||||
|
||||
If ($Env:CONDA_OUTDIR -eq $null) { $Env:CONDA_OUTDIR = (Join-Path $Env:DROPS_DIR "conda") }
|
||||
If (-not (Test-Path -Path $Env:CONDA_OUTDIR)) { [IO.Directory]::CreateDirectory($Env:CONDA_OUTDIR) }
|
||||
|
||||
If ($Env:DOCS_OUTDIR -eq $null) { $Env:DOCS_OUTDIR = (Join-Path $Env:DROPS_DIR "docs") }
|
||||
If (-not (Test-Path -Path $Env:DOCS_OUTDIR)) { [IO.Directory]::CreateDirectory($Env:DOCS_OUTDIR) }
|
||||
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
##
|
||||
# Build and test IQ#.
|
||||
##
|
||||
|
||||
steps:
|
||||
|
||||
##
|
||||
# Pre-reqs
|
||||
##
|
||||
- task: CondaEnvironment@1
|
||||
inputs:
|
||||
packageSpecs: "python=3.6 pip setuptools pytest jupyter conda-build=3.18.8 conda-package-handling=1.3.11"
|
||||
displayName: 'Use conda environment w/ Python 3.6'
|
||||
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET Core sdk'
|
||||
inputs:
|
||||
packageType: sdk
|
||||
version: 2.2.401
|
||||
|
||||
##
|
||||
# Pack conda packages
|
||||
##
|
||||
- pwsh: .\pack-conda.ps1
|
||||
displayName: "Packing IQ# packages"
|
||||
workingDirectory: '$(System.DefaultWorkingDirectory)/build'
|
||||
|
||||
##
|
||||
# Publish build artifacts.
|
||||
##
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish Artifact: drop'
|
||||
condition: succeededOrFailed()
|
||||
inputs:
|
||||
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
|
||||
artifactName: iqsharp
|
|
@ -1,33 +1,30 @@
|
|||
##
|
||||
# Build and test IQ#.
|
||||
##
|
||||
|
||||
steps:
|
||||
|
||||
##
|
||||
# Pre-reqs
|
||||
##
|
||||
- task: UsePythonVersion@0
|
||||
- task: CondaEnvironment@1
|
||||
inputs:
|
||||
versionSpec: '3.6'
|
||||
architecture: 'x64'
|
||||
displayName: 'Use Python 3.6'
|
||||
|
||||
- script: pip install setuptools wheel pytest jupyter
|
||||
displayName: 'Install Python tools'
|
||||
packageSpecs: "python=3.6 pip setuptools pytest jupyter"
|
||||
displayName: 'Use conda environment w/ Python 3.6'
|
||||
|
||||
##
|
||||
# Build, test & pack
|
||||
##
|
||||
- powershell: .\build.ps1
|
||||
- pwsh: .\build.ps1
|
||||
displayName: "Building IQ#"
|
||||
workingDirectory: '$(System.DefaultWorkingDirectory)/build'
|
||||
|
||||
- powershell: .\test.ps1
|
||||
- pwsh: .\test.ps1
|
||||
displayName: "Testing IQ#"
|
||||
workingDirectory: '$(System.DefaultWorkingDirectory)/build'
|
||||
condition: and(succeeded(), ne(variables['Skip.Tests'], 'true'))
|
||||
|
||||
- powershell: .\pack.ps1
|
||||
- pwsh: .\pack.ps1
|
||||
displayName: "Packing IQ#"
|
||||
workingDirectory: '$(System.DefaultWorkingDirectory)/build'
|
||||
|
||||
|
@ -47,4 +44,4 @@ steps:
|
|||
condition: succeededOrFailed()
|
||||
inputs:
|
||||
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
|
||||
artifactName: iqsharp
|
||||
artifactName: iqsharp
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<RootNamespace>Microsoft.Quantum.IQSharp</RootNamespace>
|
||||
<AssemblyName>Microsoft.Quantum.IQSharp</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<NoWarn>0162</NoWarn>
|
||||
<Authors>Microsoft</Authors>
|
||||
<Description>Microsoft's IQ# Server.</Description>
|
||||
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
|
||||
<ContentTargetFolders>\</ContentTargetFolders>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\build\DelaySign.cs" Link="Properties\DelaySign.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Jupyter\Jupyter.csproj" />
|
||||
<ProjectReference Include="..\Core\Core.csproj" />
|
||||
<ProjectReference Include="..\Web\Web.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.NETCore.Portable.Compatibility" Version="1.0.1" />
|
||||
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1 @@
|
|||
pwsh -NoProfile iqsharp/conda-recipes/iqsharp/build.ps1
|
|
@ -0,0 +1,82 @@
|
|||
#!/usr/bin/env pwsh
|
||||
param(
|
||||
[string]
|
||||
$Configuration = "Release",
|
||||
|
||||
[string]
|
||||
$DotNetPath = $null
|
||||
);
|
||||
|
||||
# This script is only designed to work on PowerShell Core or PowerShell 7 and later.
|
||||
if ($PSVersionTable.PSEdition -eq "Desktop") {
|
||||
Write-Error "##vso[task.logissue type=error;]conda recipe for iqsharp requires PowerShell Core or PowerShell 7.";
|
||||
}
|
||||
|
||||
# If we weren't given a path, find dotnet now.
|
||||
# By default, look for the executable provided by the dotnetcore-sdk package,
|
||||
# since the activate.d script isn't run by conda-build on all platforms.
|
||||
if (($null -eq $DotNetPath) -or $DotNetPath.Length -eq 0) {
|
||||
$DotNetPath = (Get-Command dotnet).Source;
|
||||
}
|
||||
|
||||
if (-not (Get-Command $DotNetPath)) {
|
||||
Write-Error "Could not find .NET Core SDK. This should never happen."
|
||||
exit -1;
|
||||
}
|
||||
|
||||
# The user may not have run .NET Core SDK before, so we disable first-time
|
||||
# experience to avoid capturing the NuGet cache.
|
||||
$Env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = "true";
|
||||
$Env:NUGET_XMLDOC_MODE = "skip";
|
||||
|
||||
if ($IsWindows) {
|
||||
# NOTE: Building this package is ★only★ supported for Windows 10.
|
||||
$RuntimeID = "win10-x$Env:ARCH";
|
||||
} elseif ($IsLinux) {
|
||||
$RuntimeID = "linux-x$Env:ARCH";
|
||||
} elseif ($IsMacOS) {
|
||||
$RuntimeID = "osx-x$Env:ARCH";
|
||||
}
|
||||
|
||||
$TargetDirectory = (Join-Path $Env:PREFIX "opt" "iqsharp");
|
||||
$RepoRoot = Resolve-Path iqsharp;
|
||||
|
||||
Write-Host "## Diagnostic Information ##"
|
||||
@{
|
||||
"Path to .NET Core SDK" = $DotNetPath;
|
||||
"Script root" = $PSScriptRoot;
|
||||
"Prefix" = $Env:PREFIX;
|
||||
"Runtime ID" = $RuntimeID;
|
||||
"Target directory" = $TargetDirectory;
|
||||
"Path to Jupyter" = (Get-Command jupyter -ErrorAction SilentlyContinue).Source;
|
||||
"Repo root" = $RepoRoot;
|
||||
} | Format-Table | Out-String | Write-Host
|
||||
|
||||
# We need to disable <PackAsTool>true</PackAsTool> when publishing
|
||||
# due to https://github.com/dotnet/cli/issues/10607. This should
|
||||
# be resolved with .NET Core SDK 3.0 and later.
|
||||
Write-Host "## Patching IQ# for Standalone Deployment. ##"
|
||||
Copy-Item `
|
||||
(Join-Path $PSScriptRoot "ToolStandalone.csproj") `
|
||||
(Join-Path $RepoRoot "src" "Tool" "Tool.csproj") `
|
||||
-Verbose;
|
||||
|
||||
Write-Host "## Building IQ#. ##"
|
||||
Push-Location (Join-Path $RepoRoot src/Tool)
|
||||
& $DotNetPath publish --self-contained -c $Configuration -r $RuntimeID -o $TargetDirectory
|
||||
Pop-Location
|
||||
|
||||
Write-Host "## Installing IQ# into Jupyter. ##"
|
||||
$BaseName = "Microsoft.Quantum.IQSharp";
|
||||
if ($IsWindows) {
|
||||
$BaseName = "${BaseName}.exe";
|
||||
}
|
||||
Push-Location $TargetDirectory
|
||||
$PathToTool = Resolve-Path "./$BaseName";
|
||||
& $PathToTool install --path-to-tool $PathToTool --sys-prefix
|
||||
Pop-Location
|
||||
|
||||
Write-Host "## Manifest of Installed Files ##"
|
||||
$ManifestFile = New-TemporaryFile | Select-Object -ExpandProperty FullName;
|
||||
Get-ChildItem -Recurse $TargetDirectory | Out-File $ManifestFile;
|
||||
Write-Host "##vso[task.uploadfile]$ManifestFile"
|
|
@ -0,0 +1,6 @@
|
|||
echo "Using $(which pwsh) to run build.ps1"
|
||||
echo "Using .NET Core SDK at $(which dotnet)"
|
||||
# We need to pass the path to dotnet manually,
|
||||
# as the path environment variable is sometimes clobbered when
|
||||
# running the build script.
|
||||
pwsh iqsharp/conda-recipes/iqsharp/build.ps1 -DotNetPath "$(which dotnet)"
|
|
@ -0,0 +1,47 @@
|
|||
{% set version = environ.get('PYTHON_VERSION', '0.0.0.1') %}
|
||||
|
||||
package:
|
||||
name: iqsharp
|
||||
version: "{{ version }}"
|
||||
|
||||
source:
|
||||
- path: ../../
|
||||
folder: iqsharp
|
||||
|
||||
build:
|
||||
binary_relocation: False
|
||||
detect_binary_files_with_prefix: False
|
||||
|
||||
requirements:
|
||||
build:
|
||||
- python
|
||||
- setuptools
|
||||
- jupyter
|
||||
|
||||
run:
|
||||
- python
|
||||
- jupyter
|
||||
|
||||
test:
|
||||
requires:
|
||||
- jupyter
|
||||
- python>=3.6
|
||||
- jupyter_client
|
||||
- pip
|
||||
|
||||
source_files:
|
||||
- iqsharp/conda-recipes/iqsharp/test.ps1
|
||||
- iqsharp/conda-recipes/iqsharp/test.py
|
||||
|
||||
commands:
|
||||
- powershell -NoProfile iqsharp/conda-recipes/iqsharp/test.ps1 # [win]
|
||||
- pwsh iqsharp/conda-recipes/iqsharp/test.ps1 # [not win]
|
||||
- pip install jupyter_kernel_test
|
||||
- python iqsharp/conda-recipes/iqsharp/test.py
|
||||
|
||||
about:
|
||||
home: https://docs.microsoft.com/quantum
|
||||
license: MIT
|
||||
summary: Microsoft's IQ# Server.
|
||||
dev_url: https://github.com/microsoft/iqsharp
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
$failed = $false;
|
||||
|
||||
# Check that iqsharp is installed as a Jupyter kernel.
|
||||
$kernels = jupyter kernelspec list --json | ConvertFrom-Json;
|
||||
if ($null -eq $kernels.kernelspecs.iqsharp) {
|
||||
$failed = $true;
|
||||
Write-Error "## TEST FAILED: IQ# not found in list of kernelspecs, see kernelspec list below."
|
||||
jupyter kernelspec list
|
||||
}
|
||||
|
||||
# If any tests failed, raise an error code.
|
||||
if ($failed) {
|
||||
exit -1;
|
||||
} else {
|
||||
Write-Host "## ALL TESTS PASSED ##";
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
import unittest
|
||||
import jupyter_kernel_test
|
||||
|
||||
class MyKernelTests(jupyter_kernel_test.KernelTests):
|
||||
# Required --------------------------------------
|
||||
|
||||
# The name identifying an installed kernel to run the tests against
|
||||
kernel_name = "iqsharp"
|
||||
|
||||
# language_info.name in a kernel_info_reply should match this
|
||||
language_name = "qsharp"
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
|
@ -0,0 +1,7 @@
|
|||
# We need to set the PYTHON_VERSION environment variable
|
||||
# explicitly here, since conda-build doesn't by default pass
|
||||
# environment variables from the host environment.
|
||||
$Env:PYTHON_VERSION = $Env:PKG_VERSION
|
||||
Push-Location src/src/Python/
|
||||
python setup.py install --prefix $Env:PREFIX
|
||||
Pop-Location
|
|
@ -0,0 +1,49 @@
|
|||
{% set version = environ.get('PYTHON_VERSION', '0.0.0.1') %}
|
||||
|
||||
package:
|
||||
name: qsharp
|
||||
version: "{{ version }}"
|
||||
|
||||
source:
|
||||
- path: ../../
|
||||
folder: src
|
||||
|
||||
requirements:
|
||||
build:
|
||||
- python
|
||||
- setuptools
|
||||
- jupyter
|
||||
- jupyter_client
|
||||
- iqsharp={{ version }}
|
||||
|
||||
run:
|
||||
- python
|
||||
- jupyter_client
|
||||
- iqsharp
|
||||
|
||||
build:
|
||||
script: |
|
||||
powershell -NoProfile src/conda-recipes/qsharp/build.ps1 # [win]
|
||||
pwsh src/conda-recipes/qsharp/build.ps1 # [not win]
|
||||
|
||||
# test:
|
||||
# requires:
|
||||
# - python
|
||||
# - jupyter_client
|
||||
# - iqsharp
|
||||
|
||||
# source_files:
|
||||
# - iqsharp/conda-recipes/iqsharp/test.ps1
|
||||
# - iqsharp/conda-recipes/iqsharp/test.py
|
||||
|
||||
# commands:
|
||||
# - powershell -NoProfile iqsharp/conda-recipes/iqsharp/test.ps1 # [win]
|
||||
# - pwsh iqsharp/conda-recipes/iqsharp/test.ps1 # [not win]
|
||||
# - pip install jupyter_kernel_test
|
||||
# - python iqsharp/conda-recipes/iqsharp/test.py
|
||||
|
||||
about:
|
||||
home: https://docs.microsoft.com/quantum
|
||||
license: MIT
|
||||
summary: Python client for Q#, a domain-specific quantum programming language
|
||||
dev_url: https://github.com/microsoft/iqsharp
|
|
@ -4,6 +4,14 @@ The `qsharp` package for Python provides interoperability with the Quantum Devel
|
|||
|
||||
For details on how to get started with Python and Q#, please see the [Getting Started with Python guide](https://docs.microsoft.com/quantum/install-guide/python).
|
||||
|
||||
## Installing with Anaconda ##
|
||||
|
||||
If you use Anaconda or Miniconda, installing the `qsharp` package will automatically include all dependencies:
|
||||
|
||||
```bash
|
||||
conda install -c quantum-engineering qsharp
|
||||
```
|
||||
|
||||
## Installing from Source ##
|
||||
|
||||
If you'd like to contribute to or experiment with the Python interoperability feature, it may be useful to install from source rather than from the `qsharp` package on the Python Package Index (PyPI).
|
||||
|
@ -19,7 +27,6 @@ python setup.py install
|
|||
The Python interoperability feature uses a standard `setuptools`-based packaging strategy.
|
||||
To build a platform-independent wheel, run the setup script with `bdist_wheel` instead:
|
||||
|
||||
|
||||
```bash
|
||||
cd iqsharp/src/Python/
|
||||
python setup.py bdist_wheel
|
||||
|
|
|
@ -50,7 +50,7 @@ setuptools.setup(
|
|||
description="Python client for Q#, a domain-specific quantum programming language",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
url="https://github.com/Quantum/QuantumLibraries",
|
||||
url="https://github.com/microsoft/iqsharp",
|
||||
packages=setuptools.find_packages(),
|
||||
classifiers=[
|
||||
"Programming Language :: Python :: 3",
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<RootNamespace>Microsoft.Quantum.IQSharp</RootNamespace>
|
||||
<AssemblyName>Microsoft.Quantum.IQSharp</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<NoWarn>0162</NoWarn>
|
||||
<Authors>Microsoft</Authors>
|
||||
<Description>Microsoft's IQ# Server.</Description>
|
||||
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
|
||||
<PackageReleaseNotes>See: https://docs.microsoft.com/en-us/quantum/relnotes/</PackageReleaseNotes>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<PackageProjectUrl>https://github.com/Microsoft/Quantum</PackageProjectUrl>
|
||||
<PackageIconUrl>https://secure.gravatar.com/avatar/bd1f02955b2853ba0a3b1cdc2434e8ec.png</PackageIconUrl>
|
||||
<PackageTags>Quantum Q# Qsharp</PackageTags>
|
||||
<PackAsTool>true</PackAsTool>
|
||||
<ToolCommandName>dotnet-iqsharp</ToolCommandName>
|
||||
<PackageId>Microsoft.Quantum.IQSharp</PackageId>
|
||||
<ContentTargetFolders>\</ContentTargetFolders>
|
||||
<ApplicationIcon />
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\build\DelaySign.cs" Link="Properties\DelaySign.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Jupyter\Jupyter.csproj" />
|
||||
<ProjectReference Include="..\Core\Core.csproj" />
|
||||
<ProjectReference Include="..\Web\Web.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.NETCore.Portable.Compatibility" Version="1.0.1" />
|
||||
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,11 @@
|
|||
--- src/Tool/Tool.csproj
|
||||
+++ src/Tool/Tool.csproj
|
||||
@@ -18,7 +18,7 @@
|
||||
<PackageProjectUrl>https://github.com/Microsoft/Quantum</PackageProjectUrl>
|
||||
<PackageIconUrl>https://secure.gravatar.com/avatar/bd1f02955b2853ba0a3b1cdc2434e8ec.png</PackageIconUrl>
|
||||
<PackageTags>Quantum Q# Qsharp</PackageTags>
|
||||
- <PackAsTool>true</PackAsTool>
|
||||
+ <PackAsTool>false</PackAsTool>
|
||||
<ToolCommandName>dotnet-iqsharp</ToolCommandName>
|
||||
<PackageId>Microsoft.Quantum.IQSharp</PackageId>
|
||||
<ContentTargetFolders>\</ContentTargetFolders>
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"image": "continuumio/miniconda3"
|
||||
}
|
|
@ -0,0 +1,157 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/json": "[\"Hello\"]",
|
||||
"text/html": [
|
||||
"<ul><li>Hello</li></ul>"
|
||||
],
|
||||
"text/plain": [
|
||||
"Hello"
|
||||
]
|
||||
},
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"function Hello() : Unit {\n",
|
||||
" Message(\"Hi!\");\n",
|
||||
"}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Hi!\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"application/json": "{\"@type\":\"tuple\"}",
|
||||
"text/plain": [
|
||||
"()"
|
||||
]
|
||||
},
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"%simulate Hello"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/json": "[\"SampleQrng\"]",
|
||||
"text/html": [
|
||||
"<ul><li>SampleQrng</li></ul>"
|
||||
],
|
||||
"text/plain": [
|
||||
"SampleQrng"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"open Microsoft.Quantum.Measurement;\n",
|
||||
"\n",
|
||||
"operation SampleQrng() : Result {\n",
|
||||
" using (q = Qubit()) {\n",
|
||||
" return MResetX(q);\n",
|
||||
" }\n",
|
||||
"}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/json": "1",
|
||||
"text/plain": [
|
||||
"One"
|
||||
]
|
||||
},
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"%simulate SampleQrng"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/json": "{\"rows\":[{\"@type\":\"@tuple\",\"Item1\":\"iqsharp\",\"Item2\":\"1.0.0.0\"},{\"@type\":\"@tuple\",\"Item1\":\"Jupyter Core\",\"Item2\":\"1.1.3712.0\"}]}",
|
||||
"text/html": [
|
||||
"<table><thead><tr><th>Component</th><th>Version</th></tr></thead><tbody><tr><td>iqsharp</td><td>1.0.0.0</td></tr><tr><td>Jupyter Core</td><td>1.1.3712.0</td></tr></tbody></table>"
|
||||
],
|
||||
"text/plain": [
|
||||
"Component Version\n",
|
||||
"------------ ----------\n",
|
||||
"iqsharp 1.0.0.0\n",
|
||||
"Jupyter Core 1.1.3712.0\n"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"%version"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Q#",
|
||||
"language": "qsharp",
|
||||
"name": "iqsharp"
|
||||
},
|
||||
"language_info": {
|
||||
"file_extension": ".qs",
|
||||
"mimetype": "text/x-qsharp",
|
||||
"name": "qsharp",
|
||||
"version": "0.4"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
name: qsharp
|
||||
channels:
|
||||
- quantum-engineering
|
||||
dependencies:
|
||||
- qsharp
|
Загрузка…
Ссылка в новой задаче