diff --git a/.ionide/symbolCache.db b/.ionide/symbolCache.db new file mode 100644 index 0000000000..7566b892d7 Binary files /dev/null and b/.ionide/symbolCache.db differ diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000000..859aaf41e3 --- /dev/null +++ b/.vscode/launch.json @@ -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}" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000000..905dcd2b88 --- /dev/null +++ b/.vscode/tasks.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/NOTICE.txt b/NOTICE.txt index 6a85f2827d..b93806f68c 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -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. diff --git a/build/ci.yml b/build/ci.yml index d5d8fd387c..e87178f65a 100644 --- a/build/ci.yml +++ b/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 diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 new file mode 100644 index 0000000000..9fc1c601a4 --- /dev/null +++ b/build/pack-conda.ps1 @@ -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." +} diff --git a/build/pack.ps1 b/build/pack.ps1 index c4b272966d..38391e8785 100644 --- a/build/pack.ps1 +++ b/build/pack.ps1 @@ -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." -} diff --git a/build/set-env.ps1 b/build/set-env.ps1 index bda149b02a..a40d4cdfbe 100644 --- a/build/set-env.ps1 +++ b/build/set-env.ps1 @@ -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) } diff --git a/build/steps-conda.yml b/build/steps-conda.yml new file mode 100644 index 0000000000..bc8694cef7 --- /dev/null +++ b/build/steps-conda.yml @@ -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 diff --git a/build/steps.yml b/build/steps.yml index c5ea8e6716..2b3b2f5c04 100644 --- a/build/steps.yml +++ b/build/steps.yml @@ -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 \ No newline at end of file + artifactName: iqsharp diff --git a/conda-recipes/iqsharp/ToolStandalone.csproj b/conda-recipes/iqsharp/ToolStandalone.csproj new file mode 100644 index 0000000000..82937bede3 --- /dev/null +++ b/conda-recipes/iqsharp/ToolStandalone.csproj @@ -0,0 +1,45 @@ + + + + Exe + x64 + netcoreapp2.2 + Microsoft.Quantum.IQSharp + Microsoft.Quantum.IQSharp + + + + 0162 + Microsoft + Microsoft's IQ# Server. + © Microsoft Corporation. All rights reserved. + \ + + + + + + + + + PreserveNewest + + + + + + + + + + + + + + + + + + + + diff --git a/conda-recipes/iqsharp/bld.bat b/conda-recipes/iqsharp/bld.bat new file mode 100644 index 0000000000..6ce2fac1e3 --- /dev/null +++ b/conda-recipes/iqsharp/bld.bat @@ -0,0 +1 @@ +pwsh -NoProfile iqsharp/conda-recipes/iqsharp/build.ps1 diff --git a/conda-recipes/iqsharp/build.ps1 b/conda-recipes/iqsharp/build.ps1 new file mode 100644 index 0000000000..be528809ac --- /dev/null +++ b/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 true 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" diff --git a/conda-recipes/iqsharp/build.sh b/conda-recipes/iqsharp/build.sh new file mode 100644 index 0000000000..b546b8a5f6 --- /dev/null +++ b/conda-recipes/iqsharp/build.sh @@ -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)" diff --git a/conda-recipes/iqsharp/meta.yaml b/conda-recipes/iqsharp/meta.yaml new file mode 100644 index 0000000000..e2da5887f9 --- /dev/null +++ b/conda-recipes/iqsharp/meta.yaml @@ -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 + diff --git a/conda-recipes/iqsharp/test.ps1 b/conda-recipes/iqsharp/test.ps1 new file mode 100644 index 0000000000..92d4587248 --- /dev/null +++ b/conda-recipes/iqsharp/test.ps1 @@ -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 ##"; +} diff --git a/conda-recipes/iqsharp/test.py b/conda-recipes/iqsharp/test.py new file mode 100644 index 0000000000..e704c8b572 --- /dev/null +++ b/conda-recipes/iqsharp/test.py @@ -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() diff --git a/conda-recipes/qsharp/build.ps1 b/conda-recipes/qsharp/build.ps1 new file mode 100644 index 0000000000..4aeb3c0f94 --- /dev/null +++ b/conda-recipes/qsharp/build.ps1 @@ -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 diff --git a/conda-recipes/qsharp/meta.yaml b/conda-recipes/qsharp/meta.yaml new file mode 100644 index 0000000000..dd03726d32 --- /dev/null +++ b/conda-recipes/qsharp/meta.yaml @@ -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 diff --git a/src/Python/README.md b/src/Python/README.md index df96c665c7..6c30c05499 100644 --- a/src/Python/README.md +++ b/src/Python/README.md @@ -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 diff --git a/src/Python/setup.py b/src/Python/setup.py index ec12b3f0a3..af29234555 100644 --- a/src/Python/setup.py +++ b/src/Python/setup.py @@ -50,7 +50,7 @@ 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", diff --git a/src/Tool/Tool.csproj.orig b/src/Tool/Tool.csproj.orig new file mode 100644 index 0000000000..a57eeeec46 --- /dev/null +++ b/src/Tool/Tool.csproj.orig @@ -0,0 +1,54 @@ + + + + Exe + x64 + netcoreapp2.2 + Microsoft.Quantum.IQSharp + Microsoft.Quantum.IQSharp + + + + 0162 + Microsoft + Microsoft's IQ# Server. + © Microsoft Corporation. All rights reserved. + See: https://docs.microsoft.com/en-us/quantum/relnotes/ + MIT + https://github.com/Microsoft/Quantum + https://secure.gravatar.com/avatar/bd1f02955b2853ba0a3b1cdc2434e8ec.png + Quantum Q# Qsharp + true + dotnet-iqsharp + Microsoft.Quantum.IQSharp + \ + + + + + + + + + + PreserveNewest + + + + + + + + + + + + + + + + + + + + diff --git a/src/Tool/Tool.csproj.rej b/src/Tool/Tool.csproj.rej new file mode 100644 index 0000000000..4cf8879dd1 --- /dev/null +++ b/src/Tool/Tool.csproj.rej @@ -0,0 +1,11 @@ +--- src/Tool/Tool.csproj ++++ src/Tool/Tool.csproj +@@ -18,7 +18,7 @@ + https://github.com/Microsoft/Quantum + https://secure.gravatar.com/avatar/bd1f02955b2853ba0a3b1cdc2434e8ec.png + Quantum Q# Qsharp +- true ++ false + dotnet-iqsharp + Microsoft.Quantum.IQSharp + \ diff --git a/test-containers/miniconda/.devcontainer/devcontainer.json b/test-containers/miniconda/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..07fc1a792e --- /dev/null +++ b/test-containers/miniconda/.devcontainer/devcontainer.json @@ -0,0 +1,3 @@ +{ + "image": "continuumio/miniconda3" +} diff --git a/test-containers/miniconda/Untitled.ipynb b/test-containers/miniconda/Untitled.ipynb new file mode 100644 index 0000000000..25d3830adf --- /dev/null +++ b/test-containers/miniconda/Untitled.ipynb @@ -0,0 +1,157 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "data": { + "application/json": "[\"Hello\"]", + "text/html": [ + "" + ], + "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": [ + "" + ], + "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": [ + "
ComponentVersion
iqsharp1.0.0.0
Jupyter Core1.1.3712.0
" + ], + "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 +} diff --git a/test-containers/miniconda/environment.yml b/test-containers/miniconda/environment.yml new file mode 100644 index 0000000000..6497fae721 --- /dev/null +++ b/test-containers/miniconda/environment.yml @@ -0,0 +1,5 @@ +name: qsharp +channels: +- quantum-engineering +dependencies: +- qsharp