Skip to content
This repository was archived by the owner on Aug 21, 2024. It is now read-only.

Commit 4b810b4

Browse files
author
Ryan Shaffer
authored
Load Katas package automatically at startup (#468)
This change contains the following changes: * Update QDK to version 0.12.20100504. * Add the IQSharpLoadAutomatically property to each .csproj that will cause IQ# to load the listed packages at initialization time. * Remove the %package Microsoft.Quantum.Katas and %workspace reload calls from each notebook, since those are no longer necessary with the above change.
1 parent 3ac8c10 commit 4b810b4

File tree

78 files changed

+170
-1643
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+170
-1643
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ The Quantum Development Kit is updated monthly (you can find the latest releases
8585
Updating the Katas to a different QDK version can be done using PowerShell script [Update-QDKVersion](https://github.com/microsoft/QuantumKatas/blob/main/scripts/Update-QDKVersion.ps1). It takes one parameter, the version to be used, so the command looks like this:
8686

8787
```powershell
88-
PS> ./scripts/Update-QDKVersion.ps1 0.12.20072031
88+
PS> ./scripts/Update-QDKVersion.ps1 0.12.20100504
8989
```
9090

9191
After running this script you should validate that the update didn't introduce any breaking changes; see the next section for how to do this.

BasicGates/BasicGates.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
<Project Sdk="Microsoft.Quantum.Sdk/0.12.20082513">
1+
<Project Sdk="Microsoft.Quantum.Sdk/0.12.20100504">
22
<PropertyGroup>
33
<TargetFramework>netcoreapp3.1</TargetFramework>
44
<PlatformTarget>x64</PlatformTarget>
55
<IsPackable>false</IsPackable>
66
<RootNamespace>Quantum.Kata.BasicGates</RootNamespace>
7+
<IQSharpLoadAutomatically>true</IQSharpLoadAutomatically>
78
</PropertyGroup>
89

910
<ItemGroup>
10-
<PackageReference Include="Microsoft.Quantum.Katas" Version="0.12.20082513" />
11-
<PackageReference Include="Microsoft.Quantum.Xunit" Version="0.12.20082513" />
11+
<PackageReference Include="Microsoft.Quantum.Katas" Version="0.12.20100504" />
12+
<PackageReference Include="Microsoft.Quantum.Xunit" Version="0.12.20100504" />
1213
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
1314
<PackageReference Include="xunit" Version="2.3.1" />
1415
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />

BasicGates/BasicGates.ipynb

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -23,42 +23,6 @@
2323
"The tasks are given in approximate order of increasing difficulty; harder ones are marked with asterisks."
2424
]
2525
},
26-
{
27-
"cell_type": "markdown",
28-
"metadata": {},
29-
"source": [
30-
"To begin, first prepare this notebook for execution (if you skip this step, you'll get \"Syntax does not match any known patterns\" error when you try to execute Q# code in the next cells):"
31-
]
32-
},
33-
{
34-
"cell_type": "code",
35-
"execution_count": null,
36-
"metadata": {},
37-
"outputs": [],
38-
"source": [
39-
"%package Microsoft.Quantum.Katas::0.12.20082513"
40-
]
41-
},
42-
{
43-
"cell_type": "markdown",
44-
"metadata": {},
45-
"source": [
46-
"> The package versions in the output of the cell above should always match. If you are running the Notebooks locally and the versions do not match, please install the IQ# version that matches the version of the `Microsoft.Quantum.Katas` package.\n",
47-
"> <details>\n",
48-
"> <summary><u>How to install the right IQ# version</u></summary>\n",
49-
"> For example, if the version of `Microsoft.Quantum.Katas` package above is 0.1.2.3, the installation steps are as follows:\n",
50-
">\n",
51-
"> 1. Stop the kernel.\n",
52-
"> 2. Uninstall the existing version of IQ#:\n",
53-
"> dotnet tool uninstall microsoft.quantum.iqsharp -g\n",
54-
"> 3. Install the matching version:\n",
55-
"> dotnet tool install microsoft.quantum.iqsharp -g --version 0.1.2.3\n",
56-
"> 4. Reinstall the kernel:\n",
57-
"> dotnet iqsharp install\n",
58-
"> 5. Restart the Notebook.\n",
59-
"> </details>\n"
60-
]
61-
},
6226
{
6327
"cell_type": "markdown",
6428
"metadata": {},

CHSHGame/CHSHGame.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
<Project Sdk="Microsoft.Quantum.Sdk/0.12.20082513">
1+
<Project Sdk="Microsoft.Quantum.Sdk/0.12.20100504">
22
<PropertyGroup>
33
<TargetFramework>netcoreapp3.1</TargetFramework>
44
<PlatformTarget>x64</PlatformTarget>
55
<IsPackable>false</IsPackable>
66
<RootNamespace>Quantum.Kata.CHSHGame</RootNamespace>
7+
<IQSharpLoadAutomatically>true</IQSharpLoadAutomatically>
78
</PropertyGroup>
89

910
<ItemGroup>
10-
<PackageReference Include="Microsoft.Quantum.Katas" Version="0.12.20082513" />
11-
<PackageReference Include="Microsoft.Quantum.Xunit" Version="0.12.20082513" />
11+
<PackageReference Include="Microsoft.Quantum.Katas" Version="0.12.20100504" />
12+
<PackageReference Include="Microsoft.Quantum.Xunit" Version="0.12.20100504" />
1213
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
1314
<PackageReference Include="xunit" Version="2.3.1" />
1415
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />

CHSHGame/CHSHGame.ipynb

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -29,42 +29,6 @@
2929
"with some Q# code that solves the task. To verify your answer, run the cell using Ctrl+Enter (⌘+Enter on macOS).\n"
3030
]
3131
},
32-
{
33-
"cell_type": "markdown",
34-
"metadata": {},
35-
"source": [
36-
"To begin, first prepare this notebook for execution (if you skip this step, you'll get \"Syntax does not match any known patterns\" error when you try to execute Q# code in the next cells):"
37-
]
38-
},
39-
{
40-
"cell_type": "code",
41-
"execution_count": null,
42-
"metadata": {},
43-
"outputs": [],
44-
"source": [
45-
"%package Microsoft.Quantum.Katas::0.12.20082513"
46-
]
47-
},
48-
{
49-
"cell_type": "markdown",
50-
"metadata": {},
51-
"source": [
52-
"> The package versions in the output of the cell above should always match. If you are running the Notebooks locally and the versions do not match, please install the IQ# version that matches the version of the `Microsoft.Quantum.Katas` package.\n",
53-
"> <details>\n",
54-
"> <summary><u>How to install the right IQ# version</u></summary>\n",
55-
"> For example, if the version of `Microsoft.Quantum.Katas` package above is 0.1.2.3, the installation steps are as follows:\n",
56-
">\n",
57-
"> 1. Stop the kernel.\n",
58-
"> 2. Uninstall the existing version of IQ#:\n",
59-
"> dotnet tool uninstall microsoft.quantum.iqsharp -g\n",
60-
"> 3. Install the matching version:\n",
61-
"> dotnet tool install microsoft.quantum.iqsharp -g --version 0.1.2.3\n",
62-
"> 4. Reinstall the kernel:\n",
63-
"> dotnet iqsharp install\n",
64-
"> 5. Restart the Notebook.\n",
65-
"> </details>\n"
66-
]
67-
},
6832
{
6933
"cell_type": "markdown",
7034
"metadata": {},

CHSHGame/Workbook_CHSHGame.ipynb

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,42 +16,6 @@
1616
"Since the tasks are offered as programming problems, the explanations also cover some elements of Q# that might be non-obvious for a first-time user."
1717
]
1818
},
19-
{
20-
"cell_type": "markdown",
21-
"metadata": {},
22-
"source": [
23-
"To begin, first prepare this notebook for execution (if you skip this step, you'll get \"Syntax does not match any known patterns\" error when you try to execute Q# code in the next cells):"
24-
]
25-
},
26-
{
27-
"cell_type": "code",
28-
"execution_count": null,
29-
"metadata": {},
30-
"outputs": [],
31-
"source": [
32-
"%package Microsoft.Quantum.Katas::0.12.20082513"
33-
]
34-
},
35-
{
36-
"cell_type": "markdown",
37-
"metadata": {},
38-
"source": [
39-
"> The package versions in the output of the cell above should always match. If you are running the Notebooks locally and the versions do not match, please install the IQ# version that matches the version of the `Microsoft.Quantum.Katas` package.\n",
40-
"> <details>\n",
41-
"> <summary><u>How to install the right IQ# version</u></summary>\n",
42-
"> For example, if the version of `Microsoft.Quantum.Katas` package above is 0.1.2.3, the installation steps are as follows:\n",
43-
">\n",
44-
"> 1. Stop the kernel.\n",
45-
"> 2. Uninstall the existing version of IQ#:\n",
46-
"> dotnet tool uninstall microsoft.quantum.iqsharp -g\n",
47-
"> 3. Install the matching version:\n",
48-
"> dotnet tool install microsoft.quantum.iqsharp -g --version 0.1.2.3\n",
49-
"> 4. Reinstall the kernel:\n",
50-
"> dotnet iqsharp install\n",
51-
"> 5. Restart the Notebook.\n",
52-
"> </details>\n"
53-
]
54-
},
5519
{
5620
"cell_type": "markdown",
5721
"metadata": {},

DeutschJozsaAlgorithm/DeutschJozsaAlgorithm.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
<Project Sdk="Microsoft.Quantum.Sdk/0.12.20082513">
1+
<Project Sdk="Microsoft.Quantum.Sdk/0.12.20100504">
22
<PropertyGroup>
33
<TargetFramework>netcoreapp3.1</TargetFramework>
44
<PlatformTarget>x64</PlatformTarget>
55
<RootNamespace>Quantum.Kata.DeutschJozsaAlgorithm</RootNamespace>
6+
<IQSharpLoadAutomatically>true</IQSharpLoadAutomatically>
67
</PropertyGroup>
78

89
<ItemGroup>
9-
<PackageReference Include="Microsoft.Quantum.Katas" Version="0.12.20082513" />
10-
<PackageReference Include="Microsoft.Quantum.Xunit" Version="0.12.20082513" />
10+
<PackageReference Include="Microsoft.Quantum.Katas" Version="0.12.20100504" />
11+
<PackageReference Include="Microsoft.Quantum.Xunit" Version="0.12.20100504" />
1112
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
1213
<PackageReference Include="xunit" Version="2.3.1" />
1314
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />

DeutschJozsaAlgorithm/DeutschJozsaAlgorithm.ipynb

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -22,51 +22,6 @@
2222
"with some Q# code that solves the task. To verify your answer, run the cell with Ctrl+Enter (⌘+Enter on macOS)."
2323
]
2424
},
25-
{
26-
"cell_type": "markdown",
27-
"metadata": {},
28-
"source": [
29-
"To begin, first prepare this notebook for execution (if you skip the first step, you'll get \"Syntax does not match any known patterns\" error when you try to execute Q# code in the next cells; if you skip the second step, you'll get \"Invalid kata name\" error):"
30-
]
31-
},
32-
{
33-
"cell_type": "code",
34-
"execution_count": null,
35-
"metadata": {},
36-
"outputs": [],
37-
"source": [
38-
"%package Microsoft.Quantum.Katas::0.12.20082513"
39-
]
40-
},
41-
{
42-
"cell_type": "markdown",
43-
"metadata": {},
44-
"source": [
45-
"> The package versions in the output of the cell above should always match. If you are running the Notebooks locally and the versions do not match, please install the IQ# version that matches the version of the `Microsoft.Quantum.Katas` package.\n",
46-
"> <details>\n",
47-
"> <summary><u>How to install the right IQ# version</u></summary>\n",
48-
"> For example, if the version of `Microsoft.Quantum.Katas` package above is 0.1.2.3, the installation steps are as follows:\n",
49-
">\n",
50-
"> 1. Stop the kernel.\n",
51-
"> 2. Uninstall the existing version of IQ#:\n",
52-
"> dotnet tool uninstall microsoft.quantum.iqsharp -g\n",
53-
"> 3. Install the matching version:\n",
54-
"> dotnet tool install microsoft.quantum.iqsharp -g --version 0.1.2.3\n",
55-
"> 4. Reinstall the kernel:\n",
56-
"> dotnet iqsharp install\n",
57-
"> 5. Restart the Notebook.\n",
58-
"> </details>\n"
59-
]
60-
},
61-
{
62-
"cell_type": "code",
63-
"execution_count": null,
64-
"metadata": {},
65-
"outputs": [],
66-
"source": [
67-
"%workspace reload"
68-
]
69-
},
7025
{
7126
"cell_type": "markdown",
7227
"metadata": {},

DistinguishUnitaries/DistinguishUnitaries.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
<Project Sdk="Microsoft.Quantum.Sdk/0.12.20082513">
1+
<Project Sdk="Microsoft.Quantum.Sdk/0.12.20100504">
22
<PropertyGroup>
33
<TargetFramework>netcoreapp3.1</TargetFramework>
44
<PlatformTarget>x64</PlatformTarget>
55
<IsPackable>false</IsPackable>
66
<RootNamespace>Quantum.Kata.DistinguishUnitaries</RootNamespace>
7+
<IQSharpLoadAutomatically>true</IQSharpLoadAutomatically>
78
</PropertyGroup>
89

910
<ItemGroup>
10-
<PackageReference Include="Microsoft.Quantum.Katas" Version="0.12.20082513" />
11-
<PackageReference Include="Microsoft.Quantum.Xunit" Version="0.12.20082513" />
11+
<PackageReference Include="Microsoft.Quantum.Katas" Version="0.12.20100504" />
12+
<PackageReference Include="Microsoft.Quantum.Xunit" Version="0.12.20100504" />
1213
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
1314
<PackageReference Include="xunit" Version="2.3.1" />
1415
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />

DistinguishUnitaries/DistinguishUnitaries.ipynb

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -15,51 +15,6 @@
1515
"The tasks are given in approximate order of increasing difficulty; harder ones are marked with asterisks."
1616
]
1717
},
18-
{
19-
"cell_type": "markdown",
20-
"metadata": {},
21-
"source": [
22-
"To begin, first prepare this notebook for execution (if you skip the first step, you'll get \"Syntax does not match any known patterns\" error when you try to execute Q# code in the next cells; if you skip the second step, you'll get \"Invalid test name\" error):"
23-
]
24-
},
25-
{
26-
"cell_type": "code",
27-
"execution_count": null,
28-
"metadata": {},
29-
"outputs": [],
30-
"source": [
31-
"%package Microsoft.Quantum.Katas::0.12.20082513"
32-
]
33-
},
34-
{
35-
"cell_type": "markdown",
36-
"metadata": {},
37-
"source": [
38-
"> The package versions in the output of the cell above should always match. If you are running the Notebooks locally and the versions do not match, please install the IQ# version that matches the version of the `Microsoft.Quantum.Katas` package.\n",
39-
"> <details>\n",
40-
"> <summary><u>How to install the right IQ# version</u></summary>\n",
41-
"> For example, if the version of `Microsoft.Quantum.Katas` package above is 0.1.2.3, the installation steps are as follows:\n",
42-
">\n",
43-
"> 1. Stop the kernel.\n",
44-
"> 2. Uninstall the existing version of IQ#:\n",
45-
"> dotnet tool uninstall microsoft.quantum.iqsharp -g\n",
46-
"> 3. Install the matching version:\n",
47-
"> dotnet tool install microsoft.quantum.iqsharp -g --version 0.1.2.3\n",
48-
"> 4. Reinstall the kernel:\n",
49-
"> dotnet iqsharp install\n",
50-
"> 5. Restart the Notebook.\n",
51-
"> </details>\n"
52-
]
53-
},
54-
{
55-
"cell_type": "code",
56-
"execution_count": null,
57-
"metadata": {},
58-
"outputs": [],
59-
"source": [
60-
"%workspace reload"
61-
]
62-
},
6318
{
6419
"cell_type": "markdown",
6520
"metadata": {},

0 commit comments

Comments
 (0)