<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sarah Kasier</title>
    <description>The latest articles on DEV Community by Sarah Kasier (@crazy4pi314).</description>
    <link>https://dev.to/crazy4pi314</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F306154%2F8c298d76-71c5-4791-9dfe-b70663ff3c5f.jpeg</url>
      <title>DEV Community: Sarah Kasier</title>
      <link>https://dev.to/crazy4pi314</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/crazy4pi314"/>
    <language>en</language>
    <item>
      <title>Profiles for fun and profit: How to use profiles to customize VS Code</title>
      <dc:creator>Sarah Kasier</dc:creator>
      <pubDate>Mon, 27 Feb 2023 21:54:10 +0000</pubDate>
      <link>https://dev.to/crazy4pi314/profiles-for-fun-and-profit-how-to-use-profiles-to-customize-vs-code-57hj</link>
      <guid>https://dev.to/crazy4pi314/profiles-for-fun-and-profit-how-to-use-profiles-to-customize-vs-code-57hj</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;tl;dr&lt;/strong&gt; Check out this &lt;a href="https://gist.github.com/crazy4pi314/a3b1157dcd0873d471fb79cf5dffaba4" rel="noopener noreferrer"&gt;gist&lt;/a&gt; for some examples of VS Code profiles I use daily 📝🥳&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;VS Code is my daily driver for basically all of my projects, not just for writing Python code for work.&lt;br&gt;
I use it for writing books, blogs, embedded devices for IoT projects, and presentations with &lt;a href="https://revealjs.com/" rel="noopener noreferrer"&gt;reveal.js&lt;/a&gt;.&lt;br&gt;
My settings for each project using VS Code are pretty different, and I used to do a lot of manual setting switching and installing/uninstalling extensions.&lt;br&gt;
For some of the embedded projects, extensions like &lt;a href="https://marketplace.visualstudio.com/items?itemName=platformio.platformio-ide" rel="noopener noreferrer"&gt;PlatformIO&lt;/a&gt; and the &lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools" rel="noopener noreferrer"&gt;C/C++ extension&lt;/a&gt; are great, but they take a lot of time to setup and install dependencies which are not needed for, say writing a blog post.&lt;br&gt;
You could always use workspaces to help manage editor settings and what files open, but you cannot control which extensions are installed for each workspace.&lt;br&gt;
This is where VS Code profiles come in!&lt;/p&gt;

&lt;h2&gt;
  
  
  What are VS Code profiles?
&lt;/h2&gt;

&lt;p&gt;VS Code profiles are like workspaces, but are less about the contents of the editor and more about what the VS Code window itself looks like.&lt;br&gt;
Profiles were &lt;a href="https://code.visualstudio.com/updates/v1_75#_profiles" rel="noopener noreferrer"&gt;officially launched&lt;/a&gt; in VS Code 1.75, and work anywhere you can use VS Code.&lt;br&gt;
A Profile can include extensions, settings, keyboard shortcuts, UI state, tasks, and user snippets.&lt;br&gt;
This means you can have a profile for writing Python code, one for web development, and one for writing blog posts that you can switch between with a few clicks.&lt;/p&gt;

&lt;p&gt;Some ideas or use cases for profiles that I have tried or seen:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Language specific development (e.g. Python, C++, etc.)&lt;/li&gt;
&lt;li&gt;Web development&lt;/li&gt;
&lt;li&gt;Work + personal profiles: you can log into different accounts for each (e.g. GitHub, Azure, etc.)&lt;/li&gt;
&lt;li&gt;Text editing&lt;/li&gt;
&lt;li&gt;Demos, live streams, or screencasts&lt;/li&gt;
&lt;li&gt;Teaching&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are definitely more ways to use profiles, and I would love to hear about them in the comments!&lt;/p&gt;

&lt;h2&gt;
  
  
  Using profiles
&lt;/h2&gt;

&lt;p&gt;To create a profile, you can either use the command palette (&lt;em&gt;Profiles: Create an empty profile&lt;/em&gt; / &lt;em&gt;Profiles: Create from current profile&lt;/em&gt;) or click on the settings icon in the bottom left corner of the VS Code window.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F06ucu04d363u2p4go5nd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F06ucu04d363u2p4go5nd.png" alt="Screenshot of VS Code menu for selecting profiles, the yellow arrow points to the settings icon in the bottom left" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you have opened the settings, select the &lt;em&gt;Create Profile&lt;/em&gt; menu option, which will give you the option of starting with a blank profile or copying the current window's settings to the new profile.&lt;/p&gt;

&lt;p&gt;You can delete and rename profiles, import and export profiles, and switch between profiles them all from the gear icon menu.&lt;br&gt;
When you go to export a profile, there is a helpful panel that opens up to show you what will be included in the export.&lt;br&gt;
From that panel it is easy to inspect and edit if needed the settings, UI state, and extensions that will be included in the export.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjf9tusyb1gt4oeuqm1ub.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjf9tusyb1gt4oeuqm1ub.png" alt="Screenshot of VS Code menu for exporting profiles" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you export a profile, you can either save it as a file, or if you save it to a gist, it will give you a URL you can share with others.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; The share URL will open to a vscode.dev editor window with the profile loaded. A profile management panel open on the left with a prompt for the user to import the profile!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Check out this &lt;a href="https://gist.github.com/crazy4pi314/a3b1157dcd0873d471fb79cf5dffaba4" rel="noopener noreferrer"&gt;gist&lt;/a&gt; for some samples of profiles I use, which I'll try to update periodically.&lt;br&gt;
The use-case specific profiles are also linked below which will give you a preview and an option to import yourself:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://vscode.dev/profile/github/46080e417c6b2abcb41a73802186c47f" rel="noopener noreferrer"&gt;Presentations/Screenshots&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vscode.dev/profile/github/5fb7723efc17f9b6119cef6ae84c7408" rel="noopener noreferrer"&gt;Notepad&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vscode.dev/profile/github/75a4b34f763bfdb2e56a0afa4ececf73" rel="noopener noreferrer"&gt;Python Data Science Dev&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's it for now, hopefully this helps you tweak your VS Code setup to be even more awesome!&lt;br&gt;
If you have any questions or comments please leave them below or reach out to me on &lt;a href="https://mathstodon.xyz/crazy4pi314" rel="noopener noreferrer"&gt;Mastodon&lt;/a&gt; 😎&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to get the best Conda environment experience in Codespaces</title>
      <dc:creator>Sarah Kasier</dc:creator>
      <pubDate>Mon, 30 Jan 2023 23:02:36 +0000</pubDate>
      <link>https://dev.to/crazy4pi314/how-to-get-the-best-conda-environment-experience-in-codespaces-4na9</link>
      <guid>https://dev.to/crazy4pi314/how-to-get-the-best-conda-environment-experience-in-codespaces-4na9</guid>
      <description>&lt;p&gt;I often use Conda environments when working on my Python projects, as it helps me manage dependencies for projects outside of just pure Python packages. In porting some of these projects to &lt;a href="https://github.com/features/codespaces" rel="noopener noreferrer"&gt;Codespaces&lt;/a&gt; and &lt;a href="https://containers.dev/" rel="noopener noreferrer"&gt;Dev Containers&lt;/a&gt;, I have found some tricks to getting the fastest and most reliable experience with Conda and Codespaces.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;tl;dr&lt;/em&gt; Check out this &lt;a href="https://github.com/crazy4pi314/conda-devcontainer-demo" rel="noopener noreferrer"&gt;template repo&lt;/a&gt; for a sample Dev Container that is fast and reduces Codespace resource consumption.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Base image size matters
&lt;/h2&gt;

&lt;p&gt;When you start a Codespace for a project, it will try to use whatever Dev Container you have specified in your repo, else it will try to use a kitchen sink container.&lt;br&gt;
That default kitchen sink can be way too much and so if you will be working with Conda environments with an Anaconda or Miniconda &lt;a href="https://containers.dev/templates" rel="noopener noreferrer"&gt;Dev Container template&lt;/a&gt; instead.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tip 1:&lt;/strong&gt; To use less of your Codespaces resources start with a smaller image like Miniconda or &lt;a href="https://github.com/conda-forge/miniforge" rel="noopener noreferrer"&gt;Miniforge&lt;/a&gt; and install only what you need.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is worth noting as well that if you use one of these template docker images or start with the same original docker image on the &lt;code&gt;FROM&lt;/code&gt; line, the memory for those layers is pre-cached in Codespaces and seems to download faster.&lt;/p&gt;
&lt;h2&gt;
  
  
  Create new environments, don't install into base
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://containers.dev/templates" rel="noopener noreferrer"&gt;default Anaconda/Miniconda templates&lt;/a&gt; in VS Code will look for an &lt;code&gt;environment.yml&lt;/code&gt; file in your project root and then install those requirements in the base environment.&lt;br&gt;
This can run into issues when there are conflicts between what is already in the base Conda environment and what you are trying to install.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tip 2:&lt;/strong&gt; Change your Dockerfile to &lt;code&gt;conda create&lt;/code&gt; a new environment as opposed to merging your environment with the base environment to avoid conflicts:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;RUN if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; &lt;span class="s2"&gt;"/tmp/conda-tmp/environment.yml"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then &lt;/span&gt;&lt;span class="nb"&gt;umask &lt;/span&gt;0002 &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; /opt/conda/bin/conda &lt;span class="nb"&gt;env &lt;/span&gt;create &lt;span class="nt"&gt;-f&lt;/span&gt; /tmp/conda-tmp/environment.yml&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;fi&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;    &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; /tmp/conda-tmp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Conda process uses lots of memory, gets killed
&lt;/h2&gt;

&lt;p&gt;The other challenge I ran into sometimes was that if I was running a lower memory/storage Codespace instance, when I tried to use Conda from the command line to modify environments, the process would be killed after a few seconds.&lt;br&gt;
This turns out to be related to some &lt;a href="https://github.com/conda/conda/issues/5003" rel="noopener noreferrer"&gt;performance issues&lt;/a&gt; Conda has that make it consume a lot of memory when trying to work with the conda-forge installation channel.&lt;br&gt;
You can always then just increase the size of the Codespace your are working with (just go to your Codespaces list and use the triple dots to change the settings for a Codespace).&lt;/p&gt;

&lt;p&gt;There is another option that will fix the performance issues so that it can be run on smaller Codespaces.&lt;br&gt;
&lt;a href="https://mamba.readthedocs.io/en/latest/index.html#" rel="noopener noreferrer"&gt;Mamba&lt;/a&gt; is a faster dependency solver that can wrap Conda and resolve some of these performance issues.&lt;br&gt;
You use all the same Conda syntax for things except use the command &lt;code&gt;mamba&lt;/code&gt; and if it's not something Mamba improves on, it just drops back to &lt;code&gt;conda&lt;/code&gt;.&lt;br&gt;
To use mamba in your Dev Container to speed up working with environments, you will need to install it into your base Conda profile, and the use &lt;code&gt;mamba&lt;/code&gt; to create the Conda environment for your environment.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tip 3:&lt;/strong&gt; Install and use &lt;code&gt;mamba&lt;/code&gt; to speed up the Conda environment creation process.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The snippet below is a minimal example of a Dockerfile for your dev containers and Codespaces with all the tips included:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; mcr.microsoft.com/devcontainers/miniconda:0-3&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;conda &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; base &lt;span class="nt"&gt;-c&lt;/span&gt; conda-forge mamba
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/&lt;/span&gt;
&lt;span class="k"&gt;RUN if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; &lt;span class="s2"&gt;"/tmp/conda-tmp/environment.yml"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then &lt;/span&gt;&lt;span class="nb"&gt;umask &lt;/span&gt;0002 &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; /opt/conda/bin/mamba &lt;span class="nb"&gt;env &lt;/span&gt;create &lt;span class="nt"&gt;-f&lt;/span&gt; /tmp/conda-tmp/environment.yml&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;fi&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;    &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; /tmp/conda-tmp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can find a &lt;a href="https://github.com/crazy4pi314/conda-devcontainer-demo" rel="noopener noreferrer"&gt;template repo&lt;/a&gt; where I have added all of these files into a blank repo that might help test some dev containers and Codespaces yourself!&lt;/p&gt;

&lt;h2&gt;
  
  
  Other Troubleshooting
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Conda not working from the start in the terminal
&lt;/h3&gt;

&lt;p&gt;Sometimes after the Codespace or Dev Container has started, the shell will not have been configured to use the &lt;code&gt;conda&lt;/code&gt; or &lt;code&gt;mamba&lt;/code&gt; commands. If you try to run either &lt;code&gt;conda&lt;/code&gt; or &lt;code&gt;mamba&lt;/code&gt; the error message will prompt you to run &lt;code&gt;conda init&lt;/code&gt; and that should fix it. Make sure after you run the fix that you close that terminal and open a new one for the shell profile to be reloaded.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conda environments don't show up in the terminal/don't auto activate the right Conda environment
&lt;/h3&gt;

&lt;p&gt;Depending on the loading order of the extensions in VS Code, if it has not seen any Python file or tool in use yet it will not necessarily load the terminal settings for environments right away.&lt;br&gt;
If I open a Jupyter notebook or any Python file that will usually prompt the extension to load the terminal parts and then I just open another terminal window and it's all fixed.&lt;/p&gt;

&lt;p&gt;Anyway, hope this helps you get the best Conda experience in Codespaces and Dev Containers! If you have any other questions, tips, or tricks, feel free to reach out to me on &lt;a href="https://mathstodon.xyz/@crazy4pi314" rel="noopener noreferrer"&gt;Mastodon&lt;/a&gt; or in the comments below! 💖&lt;/p&gt;

</description>
      <category>cryptocurrency</category>
      <category>crypto</category>
      <category>web3</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>GitHub Universe 2022</title>
      <dc:creator>Sarah Kasier</dc:creator>
      <pubDate>Mon, 07 Nov 2022 17:58:49 +0000</pubDate>
      <link>https://dev.to/crazy4pi314/github-universe-2022-40hg</link>
      <guid>https://dev.to/crazy4pi314/github-universe-2022-40hg</guid>
      <description>&lt;p&gt;I cannot believe it's almost time for GitHub Universe 2022!! It has been super fun working with the &lt;a href="https://github.com/features/codespaces"&gt;GitHub Codespaces&lt;/a&gt; team and the &lt;a href="https://www.qir-alliance.org/"&gt;QIR Alliance&lt;/a&gt; to prepare for the event, and I'm so excited to be able to share what I have been up to.&lt;/p&gt;

&lt;p&gt;tl;dr: &lt;em&gt;You can develop for and with quantum computers from your tablet on the beach&lt;/em&gt; 😎&lt;/p&gt;

&lt;p&gt;Bold claim, I know, but I will show you in my Community Stage session &lt;strong&gt;&lt;a href="https://githubuniverse.com/events/detail/virtual-schedule/00191b20-fdaa-4930-9"&gt;Quantum development with Codespaces&lt;/a&gt; on Thursday Nov 10 from 11:30 AM - 12:00 PM&lt;/strong&gt;. The demo I put together will show you an example of how the  QIR alliance is using tools like &lt;a href="https://github.com/features/codespaces"&gt;Codespaces&lt;/a&gt;, Python and &lt;a href="https://jupyter.org"&gt;Jupyter Notebooks&lt;/a&gt; to build the infrastructure for quantum computing. The QIR alliance is a Linux Foundation project that helps develop the specifications for the compilers, front-ends, and hardware that make quantum devices work.&lt;/p&gt;

&lt;p&gt;I'll be posting during the event on &lt;a href="https://mathstodon.xyz/@crazy4pi314"&gt;Mastodon&lt;/a&gt;, and make sure to check back here for my notes on the event as well as some more fun experiments with Python and Codespaces 🐍💖&lt;/p&gt;

</description>
      <category>github</category>
      <category>codespaces</category>
      <category>vscode</category>
      <category>quantumcomputing</category>
    </item>
    <item>
      <title>Quantum Development Kit 0.12 Release Highlights</title>
      <dc:creator>Sarah Kasier</dc:creator>
      <pubDate>Mon, 06 Jul 2020 09:07:29 +0000</pubDate>
      <link>https://dev.to/crazy4pi314/quantum-development-kit-0-12-release-highlights-4mp6</link>
      <guid>https://dev.to/crazy4pi314/quantum-development-kit-0-12-release-highlights-4mp6</guid>
      <description>&lt;p&gt;I am so excited for this release folks, it has some features I have been wanting for a long while!&lt;/p&gt;

&lt;p&gt;The QDK team has published &lt;a href="https://docs.microsoft.com/quantum/resources/relnotes#version-01220070124"&gt;official QDK release notes for version 0.12.20070124&lt;/a&gt;, but I wanted to walk through and highlight some of the parts that I am most excited about. So let's get to it!&lt;/p&gt;

&lt;h2&gt;
  
  
  Using Q# with Python and Jupyter just got soo much better!
&lt;/h2&gt;

&lt;p&gt;There is so much in this release that makes developing Q# in Jupyter Notebooks and Python so much easier.&lt;br&gt;
I have also noticed &lt;a href="https://docs.microsoft.com/qsharp/api/iqsharp-magic/azure.connect"&gt;a ton more documentation on the IQ# magic commands&lt;/a&gt;, which was sorely needed.&lt;/p&gt;

&lt;p&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jEcLBMfs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://sckaiser.com/public/media/blog/2020-07-02-magicdocs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jEcLBMfs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://sckaiser.com/public/media/blog/2020-07-02-magicdocs.png" alt="magic command api docs" width="800" height="457"&gt;&lt;/a&gt;You can see the new docs in the API Reference on the side of the page.

&lt;/p&gt;

&lt;p&gt;Let's take a look at the &lt;a href="https://docs.microsoft.com/quantum/resources/relnotes#version-01220070124"&gt;official release notes&lt;/a&gt; to see the details of what all was added:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;IQ# now allows arguments to the &lt;a href="https://docs.microsoft.com/qsharp/api/iqsharp-magic/simulate"&gt;%simulate&lt;/a&gt;, &lt;a href="https://docs.microsoft.com/en-us/qsharp/api/iqsharp-magic/estimate"&gt;%estimate&lt;/a&gt;, and other magic commands. See the &lt;a href="https://docs.microsoft.com/qsharp/api/iqsharp-magic/simulate"&gt;%simulate magic command reference&lt;/a&gt; for more details.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I HAVE BEEN WANTING THIS FOREVER 😻&lt;br&gt;
It will be so much nicer to use Jupyter notebooks with Q# kernels now, you won't have to write stubs that would fill in the arguments you wanted.&lt;br&gt;
Thanks so much to the team for getting this one implemented 💖&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;New phase display options in IQ#. See the &lt;a href="https://docs.microsoft.com/qsharp/api/iqsharp-magic/config"&gt;%config magic command reference&lt;/a&gt; for more details.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The &lt;code&gt;%config&lt;/code&gt; magic command is not new, but there are &lt;a href="https://docs.microsoft.com/qsharp/api/iqsharp-magic/config"&gt;new docs for &lt;code&gt;%config&lt;/code&gt;&lt;/a&gt; and some new config options.&lt;br&gt;
These options allow for configuring how the phase is displayed when running callables like &lt;a href="https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.diagnostics.dumpmachine"&gt;&lt;code&gt;DumpMachine&lt;/code&gt;&lt;/a&gt; and &lt;a href="https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.diagnostics.dumpregister"&gt;&lt;code&gt;DumpRegister&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hEgOh2ao--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://sckaiser.com/public/media/blog/2020-07-02-config1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hEgOh2ao--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://sckaiser.com/public/media/blog/2020-07-02-config1.png" alt="Default styling for DumpMachine" width="800" height="698"&gt;&lt;/a&gt;&lt;strong&gt;Here's an example of some of the new IQ# features including arguments to simulate and showing the default &lt;code&gt;DumpMachine&lt;/code&gt; behavior.&lt;/strong&gt;

&lt;/p&gt;

&lt;p&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mw18e-WC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://sckaiser.com/public/media/blog/2020-07-02-config2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mw18e-WC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://sckaiser.com/public/media/blog/2020-07-02-config2.png" alt="Configured to 'ArrowAndNumber' styling for DumpMachine" width="800" height="462"&gt;&lt;/a&gt;&lt;strong&gt;Using the &lt;code&gt;%config&lt;/code&gt; magic command, we can change the display of the phase column in &lt;code&gt;DumpMachine&lt;/code&gt;. &lt;/strong&gt;

&lt;/p&gt;

&lt;p&gt;I really like the ability to actually turn them off as they can add a lot of noise when trying to demonstrate something that is independent of phase.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;IQ# and the &lt;code&gt;qsharp&lt;/code&gt; Python package are now provided via conda packages (&lt;a href="https://anaconda.org/quantum-engineering/qsharp"&gt;qsharp&lt;/a&gt; and &lt;a href="https://anaconda.org/quantum-engineering/iqsharp"&gt;iqsharp&lt;/a&gt;) to simplify local installation of Q# Jupyter and Python functionality to a conda environment. See the &lt;a href="https://docs.microsoft.com/quantum/quickstarts/install-jupyter"&gt;Q# Jupyter Notebooks&lt;/a&gt; and &lt;a href="https://docs.microsoft.com/quantum/quickstarts/install-python"&gt;Q# with Python&lt;/a&gt; installation guides for more details.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I pretty much only use the &lt;a href="https://www.anaconda.com/"&gt;Anaconda distributions&lt;/a&gt; of Python, as it's great for working with scientific software.&lt;br&gt;
The addition of the &lt;code&gt;qsharp&lt;/code&gt; package to conda will thus make managing environments for quantum development a &lt;em&gt;lot&lt;/em&gt; easier.&lt;/p&gt;

&lt;p&gt;In this case, &lt;code&gt;conda&lt;/code&gt; envs are especially useful, as you can specify things that are not Python packages as part of an environment (like if you needed a particular version of some .NET tooling, or the IQ# kernel that powers Python ↔ Q# interoperability).&lt;br&gt;
Using the new packages, it's really easy to get everything you need for working with IQ# Notebooks, or with using Q# from Python:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;conda install -c quantum-engineering qsharp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Updates to make it easier for IQ# users to consume library packages with different QDK versions, requiring only major &amp;amp; minor version numbers match rather than the exact same version&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This one is also a general quality of life improvement, and makes maintenance tasks easier.&lt;br&gt;
IQ# uses a specific version of the compiler when building and running your Jupyter notebook code.&lt;br&gt;
In your notebook, you might also want to load additional packages but they each have a version of the compiler that they were built against.&lt;br&gt;
Now, rather than the IQ# compiler version and the package compiler versions needing to match &lt;em&gt;exactly&lt;/em&gt;, they only need match major and minor.&lt;/p&gt;
&lt;h2&gt;
  
  
  Legacy, we got chemistry 😘
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;New qdk-chem tool for converting legacy electronic structure problem serialization formats (e.g.: FCIDUMP) to Broombridge&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Full disclaimer, I am not a chemist.&lt;br&gt;
That said, I am familiar with having to manage data that is in multiple different encodings for a project and that is a nightmare.&lt;br&gt;
This comes up in quantum chemistry applications as there is a step in the development loop where the chemist exports a description of the problem from their simulation software and wants to use that with the QDK. This release adds some new support for converting/using other serializations with the QDK, so that you can use the standard &lt;a href="https://docs.microsoft.com/quantum/user-guide/libraries/chemistry/schema/broombridge"&gt;Broombridge format&lt;/a&gt; to work with your electronic structure problems.&lt;/p&gt;

&lt;p&gt;
&lt;a href="https://docs.microsoft.com/quantum/user-guide/libraries/chemistry/schema/broombridge"&gt;
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---jZtfrIw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://docs.microsoft.com/quantum/media/broombridge.png" alt="magic command api docs" width="800" height="651"&gt;&lt;/a&gt;This new conversion tool help in translating between the top box "Chemistry Modeling" and the blue box "Quantum chemistry format."

&lt;/p&gt;

&lt;p&gt;If you want to try it out, you can use the same &lt;code&gt;dotnet tool install&lt;/code&gt; command that you use to get other .NET Core Global Tools:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dotnet tool install -g Microsoft.Quantum.Chemistry.Tools
qdk-chem --help
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  New functionality for Oracle synthesis
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;New functions and operations in the &lt;a href="https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.synthesis"&gt;Microsoft.Quantum.Synthesis namespace&lt;/a&gt; for coherently applying classical oracles using transformation- and decomposition-based synthesis algorithms.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is some great new functionality for those that are working on writing oracles for their algorithms.&lt;br&gt;
Oracles are basically a way of representing classical functions in quantum algorithms, if you want to learn more, check out &lt;a href="https://livebook.manning.com/book/learn-quantum-computing-with-python-and-q-sharp/chapter-7/v-8/84"&gt;Chapter 7.4&lt;/a&gt; of &lt;a href="//bit.ly/qsharp-book"&gt;&lt;em&gt;Learn Quantum Computing with Python and Q#&lt;/em&gt;&lt;/a&gt;!&lt;br&gt;
The new namespace provides operations that help with taking truth tables or functions and helping you create an oracle that implements the table or function.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quality of life/Consistency improvements
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;When using the simulator, qubits no longer need to be in the |0⟩ state upon release, but can be automatically reset if they were measured immediately before releasing.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The error messages for this before were not too bad, and always helped remind me I forgot to explicitly reset a register of qubits, but I greatly appreciate this new feature.&lt;br&gt;
If you have already measured a qubit, then the the quantum device will know what &lt;em&gt;exactly&lt;/em&gt; what state it's in, so resetting it is trivial.&lt;br&gt;
Thus, if it is tracking that they were already measured and it's time to release them, it can do whatever operations needed automatically to put them back in the |0⟩ state.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Moved operations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Microsoft.Quantum.Intrinsic.Assert is now Microsoft.Quantum.Diagnostics.AssertMeasurement&lt;/li&gt;
&lt;li&gt;Microsoft.Quantum.Intrinsic.AssertProb is now Microsoft.Quantum.Diagnostics.AssertMeasurementProbability&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;The new names here make it much more clear what the operations are actually doing.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Removed deprecated Microsoft.Quantum.Primitive.* namespace&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I think that finally clearing out that namespace will be good for clarity and also help make the language more inclusive.&lt;br&gt;
It was originally deprecated in &lt;a href="https://docs.microsoft.com/quantum/resources/relnotes#version-061905"&gt;version 0.6&lt;/a&gt; and renamed to the more descriptive &lt;a href="https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.intrinsic"&gt;&lt;strong&gt;Microsoft.Quantum.Intrinsic&lt;/strong&gt; namespace&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Time to go update some code!
&lt;/h2&gt;

&lt;p&gt;Anyway, I hope it was helpful to look at the release in context like this, I hope to be doing it for every release I can in the future!&lt;br&gt;
If you want to learn more about getting started with Q# or maybe diving into quantum applications, check out my book &lt;a href="//bit.ly/qsharp-book"&gt;&lt;em&gt;Learn Quantum Computing with Python and Q#&lt;/em&gt;&lt;/a&gt;.&lt;br&gt;
It's geared as a gentle introduction for developers of all levels to build up an understanding of both quantum computing and Q#.&lt;/p&gt;

&lt;p&gt;Leave a comment below about what you are most excited about from this release or Q# in general!&lt;br&gt;
Remember, quantum isn't magic but you are ✨&lt;/p&gt;

</description>
      <category>qsharp</category>
      <category>quantumcomputing</category>
    </item>
    <item>
      <title>Building and Packaging a Q# Library</title>
      <dc:creator>Sarah Kasier</dc:creator>
      <pubDate>Thu, 18 Jun 2020 06:13:38 +0000</pubDate>
      <link>https://dev.to/crazy4pi314/building-and-packaging-a-q-library-1ce0</link>
      <guid>https://dev.to/crazy4pi314/building-and-packaging-a-q-library-1ce0</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;tl;dr If you want to get started developing a new library for Q#, check out this &lt;a href="https://github.com/crazy4pi314/qsharp-library-template"&gt;template repo&lt;/a&gt; I made to get you going with the right structure, project files, and build automation with GitHub actions.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I have been really excited to start working on a new project with some colleagues building a &lt;a href="https://github.com/qsharp-community/qram"&gt;new library for Q#&lt;/a&gt;, and wanted to share with you our journey so far!&lt;br&gt;
The team will probably post more about the content of what the library is doing (implementing memory for a quantum computer), but here I want to focus on the infrastructure that we needed to get from an empty repo to a built and hosted NuGet package for a Q# library via &lt;a href="https://github.com/features/packages"&gt;GitHub Packages&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EnoeT-mM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.sckaiser.com/public/media/blog/2020-06-15-cover.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EnoeT-mM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.sckaiser.com/public/media/blog/2020-06-15-cover.png" alt="template repo for new q# libraries by yours truly" width="800" height="478"&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;Libraries in general are a great way to extend languages without having to expand the base language thus increasing the maintenance and scope of the language.&lt;br&gt;
Q# has a bunch of official libraries already provided already in the &lt;a href="https://github.com/Microsoft/QuantumLibraries"&gt;Microsoft/QuantumLibraries&lt;/a&gt; repo.&lt;br&gt;
Part of our goal with this project is to show how leverage the existing Q# libraries and runtime and extend them to add new features and content.&lt;br&gt;
This is certainly not a complete guide, and I'll highlight some improvements I plan to make in the future as we go!&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 0: Setup your repo
&lt;/h2&gt;

&lt;p&gt;This is probably a step that most of you can skip, but I wanted to add a few notes/reminders of things that are good to setup on a new git repo for a project like this.&lt;br&gt;
Don't forget to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add a licence file (otherwise people won't be able to use your library!)

&lt;ul&gt;
&lt;li&gt;If you want to learn more about your options, check out this &lt;a href="https://choosealicense.com/"&gt;licence selection assistant&lt;/a&gt; from GitHub.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Add a &lt;code&gt;.gitignore&lt;/code&gt; file for Q#, you can just use the same &lt;a href="https://github.com/qsharp-community/qram/blob/master/.gitignore"&gt;&lt;code&gt;.gitignore&lt;/code&gt;&lt;/a&gt; we did for our qRAM library.&lt;/li&gt;
&lt;li&gt;Add a &lt;code&gt;README.md&lt;/code&gt; so that there is a nice description of your project to folks visiting your repo 💖

&lt;ul&gt;
&lt;li&gt;There are some good references out there for writing a good README, like this post from &lt;a href="https://medium.com/@meakaakka/a-beginners-guide-to-writing-a-kickass-readme-7ac01da88ab3"&gt;Akash Nimare
&lt;/a&gt;, this one from &lt;a href="https://blog.bitsrc.io/how-to-write-beautiful-and-meaningful-readme-md-for-your-next-project-897045e3f991"&gt;Divyansh Tripathi&lt;/a&gt;, and this one by &lt;a href="https://www.makeareadme.com/"&gt;Danny Guo&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Add a &lt;code&gt;CODE_OF_CONDUCT.md&lt;/code&gt; to your repo, check out GitHub's &lt;a href="https://help.github.com/en/github/building-a-strong-community/adding-a-code-of-conduct-to-your-project"&gt;documentation for adding a code of conduct to your repo&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Also for running Q# code you will want to &lt;a href="https://docs.microsoft.com/en-us/quantum/install-guide/"&gt;install the QDK&lt;/a&gt;, or setup a &lt;a href="https://github.com/crazy4pi314/learn-qc-with-python-and-qsharp#using-devcontainers"&gt;Docker container&lt;/a&gt; to do your work in.&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 1: Create your Directory Structure
&lt;/h2&gt;

&lt;p&gt;After looking at the &lt;a href="https://github.com/Microsoft/QuantumLibraries"&gt;microsoft/QuantumLibraries&lt;/a&gt; repo for a bit, I worked out how I wanted to structure the code in our repo.&lt;br&gt;
There are three main directories that we needed, one for the source of the library, one for the samples demonstrating the library, and one for tests.&lt;br&gt;
The samples directory will have a bunch of subdirectories (eventually) for each qRAM implementation we want to demo, as well as some samples showing how to do resource estimation for the various implementations.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;│   .gitignore
│   LICENSE
│   README.md
│   CODE_OF_CONDUCT.md
│
├───samples
│
├───src
│
└───tests

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can make these folders/directories however you want, you will just need three folders in your base or root project folder called &lt;code&gt;src&lt;/code&gt;, &lt;code&gt;tests&lt;/code&gt;, and &lt;code&gt;samples&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;NOTE: There is nothing magical about these names, it just happens to be what my team and I decided so if you have other naming conventions, go ahead and change them!&lt;br&gt;
Just make sure then as you are reading the rest of this post to make the right replacements for your names in the commands and files I show below 👍&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Step 2: Create the Q# projects
&lt;/h2&gt;

&lt;p&gt;Now that you have the folder structure, its time to create the Q# project files that will allow you and the later automation to build your library.&lt;br&gt;
These project files are kinda like Makefiles and use the C# infrastructure (MsBuild) to actually control the Q# compilation.&lt;/p&gt;
&lt;h3&gt;
  
  
  Library source
&lt;/h3&gt;

&lt;p&gt;Navigate to the &lt;code&gt;src&lt;/code&gt; folder and run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet new classlib &lt;span class="nt"&gt;-lang&lt;/span&gt; Q#
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create two files in the &lt;code&gt;src/&lt;/code&gt; directory: &lt;code&gt;Library.qs&lt;/code&gt; and &lt;code&gt;src.csproj&lt;/code&gt;.&lt;br&gt;
You can see the contents below.&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;Library.qs&lt;/code&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;namespace src {

    open Microsoft.Quantum.Canon;
    open Microsoft.Quantum.Intrinsic;


    operation HelloQ () : Unit {
        Message("Hello quantum world!");
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;blockquote&gt;
&lt;p&gt;NOTE: You can change the namespace name to better reflect what your library is about!&lt;br&gt;
The &lt;a href="https://docs.microsoft.com/en-us/quantum/contributing/api-design-principles#namespaces-and-organization"&gt;Q# API design documentation&lt;/a&gt; has some good guidance on how to make good namespace names, e.g.: Organization.Product.DomainArea.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;src.csproj&lt;/code&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;Project&lt;/span&gt; &lt;span class="na"&gt;Sdk=&lt;/span&gt;&lt;span class="s"&gt;"Microsoft.Quantum.Sdk/0.11.2004.2825"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;PropertyGroup&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;TargetFramework&amp;gt;&lt;/span&gt;netstandard2.1&lt;span class="nt"&gt;&amp;lt;/TargetFramework&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/PropertyGroup&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;/Project&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;You can see that the &lt;code&gt;src.csproj&lt;/code&gt; file has a reference to the version of the QDK that it was created with as well as what .NET framework it is being built for.&lt;/p&gt;

&lt;p&gt;You can test that this template was created correctly by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; dotnet build
Microsoft &lt;span class="o"&gt;(&lt;/span&gt;R&lt;span class="o"&gt;)&lt;/span&gt; Build Engine version 16.4.0+e901037fe &lt;span class="k"&gt;for&lt;/span&gt; .NET Core
Copyright &lt;span class="o"&gt;(&lt;/span&gt;C&lt;span class="o"&gt;)&lt;/span&gt; Microsoft Corporation. All rights reserved.

  Restore completed &lt;span class="k"&gt;in &lt;/span&gt;284.96 ms &lt;span class="k"&gt;for &lt;/span&gt;C:&lt;span class="se"&gt;\U&lt;/span&gt;sers&lt;span class="se"&gt;\s&lt;/span&gt;kais&lt;span class="se"&gt;\q&lt;/span&gt;sharp-library-template&lt;span class="se"&gt;\s&lt;/span&gt;rc&lt;span class="se"&gt;\s&lt;/span&gt;rc.csproj.
  Restore completed &lt;span class="k"&gt;in &lt;/span&gt;29.64 ms &lt;span class="k"&gt;for &lt;/span&gt;C:&lt;span class="se"&gt;\U&lt;/span&gt;sers&lt;span class="se"&gt;\s&lt;/span&gt;kais&lt;span class="se"&gt;\q&lt;/span&gt;sharp-library-template&lt;span class="se"&gt;\s&lt;/span&gt;rc&lt;span class="se"&gt;\s&lt;/span&gt;rc.csproj.

  ____________________________________________

  Q#: Success! &lt;span class="o"&gt;(&lt;/span&gt;0 errors, 0 warnings&lt;span class="o"&gt;)&lt;/span&gt;

  src -&amp;gt; C:&lt;span class="se"&gt;\U&lt;/span&gt;sers&lt;span class="se"&gt;\s&lt;/span&gt;kais&lt;span class="se"&gt;\q&lt;/span&gt;sharp-library-template&lt;span class="se"&gt;\s&lt;/span&gt;rc&lt;span class="se"&gt;\b&lt;/span&gt;&lt;span class="k"&gt;in&lt;/span&gt;&lt;span class="se"&gt;\D&lt;/span&gt;ebug&lt;span class="se"&gt;\n&lt;/span&gt;etstandard2.1&lt;span class="se"&gt;\s&lt;/span&gt;rc.dll

Build succeeded.
    0 Warning&lt;span class="o"&gt;(&lt;/span&gt;s&lt;span class="o"&gt;)&lt;/span&gt;
    0 Error&lt;span class="o"&gt;(&lt;/span&gt;s&lt;span class="o"&gt;)&lt;/span&gt;

Time Elapsed 00:00:12.79
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Generally you will not need to do much with the project files here in Q# other than to make sure to add references to other projects and packages you might take as dependencies for your project.&lt;br&gt;
Speaking of, let's try that now by starting our tests project.&lt;/p&gt;
&lt;h3&gt;
  
  
  Testing
&lt;/h3&gt;

&lt;p&gt;Navigate to the &lt;code&gt;tests/&lt;/code&gt; folder and run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet new xunit &lt;span class="nt"&gt;-lang&lt;/span&gt; Q#
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This should create two new files in the &lt;code&gt;tests/&lt;/code&gt; directory, &lt;code&gt;Tests.qs&lt;/code&gt; and &lt;code&gt;tests.csproj&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;Tests.qs&lt;/code&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;namespace tests {

    open Microsoft.Quantum.Canon;
    open Microsoft.Quantum.Diagnostics;
    open Microsoft.Quantum.Intrinsic;


    @Test("QuantumSimulator")
    operation AllocateQubit () : Unit {

        using (q = Qubit()) {
            Assert([PauliZ], [q], Zero, "Newly allocated qubit must be in |0&amp;gt; state.");
        }

        Message("Test passed.");
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;tests.csproj&lt;/code&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;Project Sdk="Microsoft.Quantum.Sdk/0.11.2004.2825"&amp;gt;

  &amp;lt;PropertyGroup&amp;gt;
    &amp;lt;TargetFramework&amp;gt;netcoreapp3.1&amp;lt;/TargetFramework&amp;gt;
    &amp;lt;IsPackable&amp;gt;false&amp;lt;/IsPackable&amp;gt;
  &amp;lt;/PropertyGroup&amp;gt;

  &amp;lt;ItemGroup&amp;gt;
    &amp;lt;PackageReference Include="Microsoft.Quantum.Xunit" Version="0.11.2004.2825" /&amp;gt;
    &amp;lt;PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" /&amp;gt;
    &amp;lt;PackageReference Include="xunit" Version="2.4.1" /&amp;gt;
    &amp;lt;PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" /&amp;gt;
    &amp;lt;DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" /&amp;gt;
  &amp;lt;/ItemGroup&amp;gt;

&amp;lt;/Project&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the project file here is almost good to go, but it needs to know about our library project in the &lt;code&gt;src/&lt;/code&gt; folder.&lt;br&gt;
Let's add that now by running this command in the &lt;code&gt;tests/&lt;/code&gt; directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet add reference ..&lt;span class="se"&gt;\s&lt;/span&gt;rc&lt;span class="se"&gt;\s&lt;/span&gt;rc.csproj
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That should add the following &lt;code&gt;&amp;lt;ItemGroup&amp;gt;&lt;/code&gt; to your &lt;code&gt;tests.csproj&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;  &lt;span class="nt"&gt;&amp;lt;ItemGroup&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;ProjectReference&lt;/span&gt; &lt;span class="na"&gt;Include=&lt;/span&gt;&lt;span class="s"&gt;"..\src\src.csproj"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/ItemGroup&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now when you go to run the tests you write for your library the compiler knows where to find your actual library code!&lt;br&gt;
You can test that this tests project is setup correctly by running &lt;code&gt;dotnet test&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; dotnet &lt;span class="nb"&gt;test
&lt;/span&gt;Test run &lt;span class="k"&gt;for &lt;/span&gt;C:&lt;span class="se"&gt;\U&lt;/span&gt;sers&lt;span class="se"&gt;\s&lt;/span&gt;kais&lt;span class="se"&gt;\f&lt;/span&gt;oo&lt;span class="se"&gt;\t&lt;/span&gt;ests&lt;span class="se"&gt;\b&lt;/span&gt;&lt;span class="k"&gt;in&lt;/span&gt;&lt;span class="se"&gt;\D&lt;/span&gt;ebug&lt;span class="se"&gt;\n&lt;/span&gt;etcoreapp3.1&lt;span class="se"&gt;\t&lt;/span&gt;ests.dll&lt;span class="o"&gt;(&lt;/span&gt;.NETCoreApp,Version&lt;span class="o"&gt;=&lt;/span&gt;v3.1&lt;span class="o"&gt;)&lt;/span&gt;
Microsoft &lt;span class="o"&gt;(&lt;/span&gt;R&lt;span class="o"&gt;)&lt;/span&gt; Test Execution Command Line Tool Version 16.3.0
Copyright &lt;span class="o"&gt;(&lt;/span&gt;c&lt;span class="o"&gt;)&lt;/span&gt; Microsoft Corporation.  All rights reserved.

Starting &lt;span class="nb"&gt;test &lt;/span&gt;execution, please wait...

A total of 1 &lt;span class="nb"&gt;test &lt;/span&gt;files matched the specified pattern.


Test Run Successful.
Total tests: 1
     Passed: 1
 Total &lt;span class="nb"&gt;time&lt;/span&gt;: 1.7436 Seconds
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Samples
&lt;/h3&gt;

&lt;p&gt;The last directory we need to setup is &lt;code&gt;samples/&lt;/code&gt;.&lt;br&gt;
Navigate back to the project root and into the &lt;code&gt;samples/&lt;/code&gt; folder.&lt;br&gt;
Now, I plan to have multiple samples for my project so I'll make one more folder in &lt;code&gt;samples/&lt;/code&gt; called &lt;code&gt;sample1&lt;/code&gt;.&lt;br&gt;
Navigate into the &lt;code&gt;sample1&lt;/code&gt; folder and run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet new console &lt;span class="nt"&gt;-lang&lt;/span&gt; Q#
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This should create two files, &lt;code&gt;Program.qs&lt;/code&gt; and &lt;code&gt;sample1.csproj&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;Program.qs&lt;/code&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;namespace sample1 {

    open Microsoft.Quantum.Canon;
    open Microsoft.Quantum.Intrinsic;


    @EntryPoint()
    operation HelloQ() : Unit {
        Message("Hello quantum world!");
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;NOTE: You can change the namespace name to better reflect what your sample is about!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;sample1.csproj&lt;/code&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;Project&lt;/span&gt; &lt;span class="na"&gt;Sdk=&lt;/span&gt;&lt;span class="s"&gt;"Microsoft.Quantum.Sdk/0.11.2004.2825"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;PropertyGroup&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;OutputType&amp;gt;&lt;/span&gt;Exe&lt;span class="nt"&gt;&amp;lt;/OutputType&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;TargetFramework&amp;gt;&lt;/span&gt;netcoreapp3.1&lt;span class="nt"&gt;&amp;lt;/TargetFramework&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/PropertyGroup&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;/Project&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Again, you will want to run &lt;code&gt;dotnet add reference&lt;/code&gt; to make sure the sample also knows about your library.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet add reference ..&lt;span class="se"&gt;\.&lt;/span&gt;.&lt;span class="se"&gt;\s&lt;/span&gt;rc&lt;span class="se"&gt;\s&lt;/span&gt;rc.csproj
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will add the same &lt;code&gt;ProjectReference&lt;/code&gt; to your &lt;code&gt;sample1.csproj&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;You can check that this sample was created correctly by running the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; dotnet run
Hello quantum world!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Setup the GitHub Actions to build and publish a package
&lt;/h2&gt;

&lt;p&gt;Now that you have your repo structure setup, it's time to hook up the GitHub automation that will automatically do some maintenance on the repo.&lt;/p&gt;

&lt;p&gt;We will setup two automation workflows for this repo, one that will make sure tests pass on code that is committed to master, and the other will build and publish a NuGet package when a new commit is made to master.&lt;/p&gt;

&lt;p&gt;Both of these workflows are examples of GitHub Actions, learn more about &lt;a href="https://github.com/features/actions"&gt;this feature of GitHub repos here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Automating test builds
&lt;/h3&gt;

&lt;p&gt;We can use yaml files to configure these workflows, and to make sure that GitHub finds these files let's make the following folders at the root of your project: &lt;code&gt;.github/workflows/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In the &lt;code&gt;workflows&lt;/code&gt; folder create a file called &lt;code&gt;test.yml&lt;/code&gt; with the following contents.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# This is a workflow that will run `dotnet test` on your tests directory.&lt;/span&gt;

&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Run Tests&lt;/span&gt;

&lt;span class="c1"&gt;# Controls when the action will run. Triggers the workflow on push or pull request&lt;/span&gt;
&lt;span class="c1"&gt;# events but only for the master branch.&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;pull_request&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;branches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt; &lt;span class="nv"&gt;master&lt;/span&gt; &lt;span class="pi"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;# A workflow run is made up of one or more jobs that can run sequentially or in parallel&lt;/span&gt;
&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="c1"&gt;# This workflow contains a single job called "build"&lt;/span&gt;
  &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# The type of runner that the job will run on&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;

    &lt;span class="c1"&gt;# Steps represent a sequence of tasks that will be executed as part of the job&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v2&lt;/span&gt;

    &lt;span class="c1"&gt;# Runs a set of commands using the runners shell&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;.NET tests&lt;/span&gt;
      &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;dotnet test&lt;/span&gt;
      &lt;span class="na"&gt;working-directory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;tests&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This action will fire whenever you make a pull request on the master branch.&lt;br&gt;
In the PR window you will see the feedback from the tests (passing/not passing).&lt;/p&gt;

&lt;p&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jgndvvIC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.sckaiser.com/public/media/blog/2020-06-15-pr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jgndvvIC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.sckaiser.com/public/media/blog/2020-06-15-pr.png" alt="Test feedback in PR page" width="800" height="176"&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;You may want to modify this flow to fire on other branches or conditions, check out &lt;a href="https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#on"&gt;all the possible triggers&lt;/a&gt; for GitHub actions.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you want to see all of the actions that have been run on your repo you can look at the actions tab:&lt;/p&gt;

&lt;p&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6UUslv60--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.sckaiser.com/public/media/blog/2020-06-15-actions.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6UUslv60--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.sckaiser.com/public/media/blog/2020-06-15-actions.png" alt="GitHub Actions tab for the qRAM repo" width="800" height="425"&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;The above screen cap is from the &lt;a href="https://github.com/qsharp-community/qram/actions"&gt;qRAM library's actions page&lt;/a&gt;.&lt;br&gt;
You can see the details of a particular action run here:&lt;/p&gt;

&lt;p&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--R2yFLF4I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.sckaiser.com/public/media/blog/2020-06-15-test-run.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R2yFLF4I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.sckaiser.com/public/media/blog/2020-06-15-test-run.png" alt="Details of a particular action run" width="800" height="448"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now that you are sure your code is building and ready to merge it into master, let's take a look at the workflow that will package our library!&lt;/p&gt;

&lt;h3&gt;
  
  
  Automating packaging
&lt;/h3&gt;

&lt;p&gt;In the same &lt;code&gt;workflows/&lt;/code&gt; folder, create a file called &lt;code&gt;publish.yml&lt;/code&gt; with the following contents:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Build and publish NuGet package to GitHub packages&lt;/span&gt;

&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;push&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;branches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt; &lt;span class="nv"&gt;master&lt;/span&gt; &lt;span class="pi"&gt;]&lt;/span&gt;

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;windows-latest&lt;/span&gt;

    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# Same checkout action as before, but adding an authentication token to&lt;/span&gt;
    &lt;span class="c1"&gt;# help push the package to the GPR.&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v2&lt;/span&gt;
    &lt;span class="c1"&gt;# NUGET_AUTH_TOKEN trick from https://stackoverflow.com/questions/57889719/how-to-push-nuget-package-in-github-actions&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Setup&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;.NET&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Core&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;@&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Latest"&lt;/span&gt;
      &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/setup-dotnet@v1&lt;/span&gt;
      &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;dotnet-version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;3.1.x'&lt;/span&gt;
        &lt;span class="na"&gt;source-url&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://nuget.pkg.github.com/qsharp-community/index.json&lt;/span&gt;
      &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;NUGET_AUTH_TOKEN&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{secrets.GITHUB_TOKEN}}&lt;/span&gt;

    &lt;span class="c1"&gt;# The command `dotnet pack` will build your project and then pack it up in &lt;/span&gt;
    &lt;span class="c1"&gt;# a NuGet package. The `-c` switch to indicate the build configuration&lt;/span&gt;
    &lt;span class="c1"&gt;# here "Release" and `-o` indicates where it will put the output. We just&lt;/span&gt;
    &lt;span class="c1"&gt;# make a new directory called `drop` at the project root and will get the &lt;/span&gt;
    &lt;span class="c1"&gt;# built package from there later.&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;.NET pack&lt;/span&gt;
      &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;dotnet pack -c Release -o ../drop /p:Version="0.1.$Env:GITHUB_RUN_NUMBER"&lt;/span&gt;
      &lt;span class="na"&gt;shell&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;pwsh&lt;/span&gt;
      &lt;span class="na"&gt;working-directory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;src&lt;/span&gt;

    &lt;span class="c1"&gt;# The command `dotnet nuget push` takes the package we made in the previous&lt;/span&gt;
    &lt;span class="c1"&gt;# step in the `drop` directory and pushes it to the GitHub Package Registry.&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Push to GitHub Packages&lt;/span&gt;
      &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;dotnet nuget push (Join-Path "drop" "*.nupkg")&lt;/span&gt;
      &lt;span class="na"&gt;shell&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;pwsh&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The line you will have to change for your repo is the &lt;code&gt;source-url: https://nuget.pkg.github.com/qsharp-community/index.json&lt;/code&gt; line.&lt;br&gt;
Change the &lt;code&gt;qsharp-community&lt;/code&gt; to the repo owner of the repo you are working in.&lt;br&gt;
For more information on this configuration see the &lt;a href="https://help.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-dotnet-cli-for-use-with-github-packages"&gt;docs&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;FIXME&lt;/code&gt;: So the numbering of the packages here is still not perfect, and is keyed off of the &lt;code&gt;GITHUB_RUN_NUMBER&lt;/code&gt; of the action.&lt;br&gt;
In order to be &lt;a href=""&gt;SemVer 2.0 compliant&lt;/a&gt;, it needs to start over when the minor or major version is incremented but I haven't figured out a good way to do this yet. 😆&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Next steps: Templates and NuGet.org
&lt;/h2&gt;

&lt;p&gt;So if you made it here and haven't made your repo yet, I saved you some time by making a &lt;a href="https://github.com/crazy4pi314/qsharp-library-template"&gt;template repo on GitHub&lt;/a&gt;.&lt;br&gt;
I will keep it up to date while we continue with the qRAM project and when I figure out how to increment versions numbers better, I'll push the fix there too.&lt;br&gt;
Also when the qRAM library is ready to go to version 1.0 and publish it on NuGet.org, I will add another workflow to the template repo to publish your library there too!&lt;/p&gt;

&lt;p&gt;Hopefully you found this post helpful, and are ready to start making your own library for Q# today! 💖&lt;/p&gt;

</description>
      <category>quantumprogramming</category>
      <category>qsharp</category>
      <category>quantumcomputing</category>
      <category>gettingstarted</category>
    </item>
    <item>
      <title>Quantum Sweepstakes Machine</title>
      <dc:creator>Sarah Kasier</dc:creator>
      <pubDate>Fri, 15 May 2020 01:40:25 +0000</pubDate>
      <link>https://dev.to/crazy4pi314/quantum-sweepstakes-machine-4504</link>
      <guid>https://dev.to/crazy4pi314/quantum-sweepstakes-machine-4504</guid>
      <description>&lt;p&gt;&lt;em&gt;TL;DR I wrote a quantum random number generator in Q# to play games. Run the code in your browser here:&lt;/em&gt; &lt;a href="https://mybinder.org/v2/gist/crazy4pi314/90c74fd23f084de8e78b150ba1987c1c/master?filepath=START-HERE.ipynb"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8b2vQaO9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://mybinder.org/badge_logo.svg" alt="Binder" width="109" height="20"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;I have really been enjoying working on some of my open source projects on &lt;a href="//twitch.tv/crazy4pi314"&gt;Twitch&lt;/a&gt; lately, and to try and drive more viewership I thought I would do a giveaway/sweepstakes on a stream. It came time to select the winner and I realized I simply could not do this with a boring old random number generator online. So I decided to write up a quick snippet in Q#, Microsoft's new quantum programming language, on the stream and wanted to post a quick write up with the code here.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You can find the code for this post in this &lt;a href="https://gist.github.com/crazy4pi314/90c74fd23f084de8e78b150ba1987c1c"&gt;Gist&lt;/a&gt;, and run it all in your browser on &lt;a href="https://mybinder.org/v2/gist/crazy4pi314/90c74fd23f084de8e78b150ba1987c1c/master?filepath=START-HERE.ipynb"&gt;myBinder&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There are two main files included in this gist, the first is a Jupyter Notebook that allows you to run the snippet and use it to select random integers yourself!&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;It currently is setup to select a random integer from 0 to 6 inclusive (7 total players), which index the list of viewers I had at the time. If you want to change the number of players you can just edit the argument in the first cell and re-run it by hitting shift and enter at the same time.&lt;/p&gt;

&lt;p&gt;The Q# code here can be found in the &lt;code&gt;operations.qs&lt;/code&gt; file:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;This file defines a namespace &lt;code&gt;Sweepstakes&lt;/code&gt; and one operation, &lt;code&gt;SelectWinner&lt;/code&gt; that takes an integer argument that defines the number of players.&lt;br&gt;
The main steps to this pretty short operation are as follows:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Figure out how many qubits you need to represent the number of players you have.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.microsoft.com/en-us/quantum/techniques/working-with-qubits#allocating-qubits"&gt;Allocate&lt;/a&gt; your qubits with &lt;code&gt;using&lt;/code&gt;, and put them all in superposition by applying the &lt;a href="https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.intrinsic.h"&gt;&lt;code&gt;H&lt;/code&gt; operation&lt;/a&gt; (short for Hadamard) to each qubit in the register.&lt;/li&gt;
&lt;li&gt;Measure the register and interpret the bit string of measurement results as a binary value (&lt;a href="https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.arithmetic.measureinteger"&gt;&lt;code&gt;MeasureInteger&lt;/code&gt;&lt;/a&gt;). I did have to also specify whether the register was to be interpreted as a little endian register so it knew how to parse it.&lt;/li&gt;
&lt;li&gt;Lastly, if that measured integer was outside of the range of players (this will happen if the number of players is not a power of 2) then just repeat steps 2 and 3 until you get a valid player index.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And that's pretty much it!&lt;br&gt;
A random integer generator written in the quantum programming language Q# that you can use to make all of the hard decisions in your life 😋&lt;br&gt;
If you want to learn more about developing for quantum computers or how they work, you can check out these links:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="//docs.microsoft.com/quantum"&gt;Q# docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="//bit.ly/qsharp-book"&gt;Learn Quantum Computing with Python and Q#&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="//twitch.tv/crazy4pi314"&gt;Quantum Develop with Me on Twitch&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>quantumdevelopment</category>
      <category>qsharp</category>
      <category>quantumcomputing</category>
      <category>twitch</category>
    </item>
    <item>
      <title>An array of facts on arrays in Q#</title>
      <dc:creator>Sarah Kasier</dc:creator>
      <pubDate>Sun, 15 Mar 2020 01:11:32 +0000</pubDate>
      <link>https://dev.to/crazy4pi314/an-array-of-facts-on-arrays-in-q-50m2</link>
      <guid>https://dev.to/crazy4pi314/an-array-of-facts-on-arrays-in-q-50m2</guid>
      <description>&lt;p&gt;&lt;em&gt;Post co-authored with &lt;a href="https://dev.to/cgranade"&gt;Chris Granade&lt;/a&gt;, my co-author on &lt;a href="https://www.manning.com/books/learn-quantum-computing-with-python-and-q-sharp?a_aid=learn-qc-granade&amp;amp;a_bid=ee23f338"&gt;Learn Quantum Computing with Python and Q#&lt;/a&gt;!&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;All of the Q#, C# and Python examples in this post can be run online &lt;a href="https://mybinder.org/v2/gist/cgranade/09dabfe1cc2e650cd88d2cfc98185791/master"&gt;on Binder&lt;/a&gt;. It may take a while to build the docker container so read ahead, and you can jump back when it's done. 😊&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Normally when you read a post or an article about a quantum programming language like Q#, you'll see stuff about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;what qubits are,&lt;/li&gt;
&lt;li&gt;what a quantum computer even is, or&lt;/li&gt;
&lt;li&gt;how superposition and entanglement can be used together to solve hard problems.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's all really important to help understand why quantum computing is so cool, and how you can get started with it, but there is something that's easily lost in all of that: &lt;strong&gt;quantum programs are just special kinds of classical programs&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;What do we mean by that?&lt;br&gt;
At their core, quantum programs are classical programs that send instructions to quantum devices. That means that &lt;em&gt;a lot of what you already know about classical programming still applies&lt;/em&gt;. In this post, we'll look at how Q# represents one incredibly common &lt;em&gt;classical&lt;/em&gt; data structure in what may seem to be a slightly unusual way, and how that helps make Q# a great classical language for controlling quantum devices.&lt;/p&gt;
&lt;h2&gt;
  
  
  Arrays in Q#
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/QfGYYVrbay6kssMrYn/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/QfGYYVrbay6kssMrYn/giphy.gif" alt="What is an array" width="480" height="268"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Whatever they might be called in a particular language, arrays are an incredibly common and useful data structure for developers. There can be differences in how they behave from language to language, so it might be helpful to take a look at how they work in Q#.&lt;/p&gt;

&lt;p&gt;Consider the following snippet where you are creating two arrays (&lt;code&gt;a&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt;) in Q#.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mutable a = [2, 4, 6];
let b = a;

// Change the first element of `a` to 1.
set a w/= 0 &amp;lt;- 1;

Message($"{b}");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What will the value of &lt;code&gt;b&lt;/code&gt; be after running all the code above? &lt;em&gt;Reminder you can run all the code in this post &lt;a href="https://mybinder.org/v2/gist/cgranade/09dabfe1cc2e650cd88d2cfc98185791/master"&gt;on Binder&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/nKOwn34gYokhi/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/nKOwn34gYokhi/giphy.gif" alt="Look around you" width="500" height="272"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The answer here comes down to the difference between whether we think of a variable as storing a &lt;em&gt;value&lt;/em&gt;, or as being a &lt;em&gt;reference&lt;/em&gt; to something. In Q#, everything is a value, so when we define a new variable with &lt;code&gt;let b = a&lt;/code&gt;, we tell the Q# compiler that we want the &lt;em&gt;value&lt;/em&gt; of &lt;code&gt;b&lt;/code&gt; to be equal to whatever the value of &lt;code&gt;a&lt;/code&gt; is.&lt;/p&gt;

&lt;p&gt;Therefore, the snippet above will print out the array &lt;code&gt;[2, 4, 6]&lt;/code&gt;, because after we defined &lt;code&gt;b&lt;/code&gt; as having the value that &lt;code&gt;a&lt;/code&gt; had at that moment (&lt;code&gt;[2, 4, 6]&lt;/code&gt;), not a reference to the variable &lt;code&gt;a&lt;/code&gt;. Put differently, &lt;code&gt;b&lt;/code&gt; does not know anything about &lt;code&gt;a&lt;/code&gt;, let alone any later changes to &lt;code&gt;a&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Thinking of arrays as values also helps explain what &lt;code&gt;w/=&lt;/code&gt; is all about in the code above. In Q#, &lt;code&gt;w/&lt;/code&gt; is a ternary operator (that is, one with three arguments) that makes a new array given: an old array, an index you want to replace, and a new element to put at that index. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let a = [2, 4, 6] w/ 0 &amp;lt;- 1;
Message($"{a}"); // Prints [1, 4, 6].
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since &lt;code&gt;w/&lt;/code&gt; is an operator, you can use it like &lt;code&gt;+&lt;/code&gt;, &lt;code&gt;*&lt;/code&gt;, or any other operator to make Q# values:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let a = ([2, 4, 6] w/ 0 &amp;lt;- 1 w/ 2 &amp;lt;- 10) + [20];
Message($"{a}"); // Prints [1, 4, 10, 20].
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When updating the value of a mutable variable, Q# provides helpful shorthand for using an operator in-place as an assignment operator:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mutable a = 10;
set a += 1;
Message($"{a}"); // Prints 11.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same exact shorthand works for &lt;code&gt;w/&lt;/code&gt;, so you can use &lt;code&gt;w/=&lt;/code&gt; as a shorthand:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mutable a = [2, 4, 6];
// Both of the following lines are equivalent:
set a = a w/ 0 &amp;lt;- 1;
set a w/= 0 &amp;lt;- 1;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What makes all of this work is that in Q#, everything is a value.&lt;br&gt;
The array &lt;code&gt;[2, 4, 6]&lt;/code&gt; is a value in precisely the same way as &lt;code&gt;2&lt;/code&gt; is a value, or that &lt;code&gt;true&lt;/code&gt;, &lt;code&gt;"foo"&lt;/code&gt;, and &lt;code&gt;3.14&lt;/code&gt; are values.&lt;/p&gt;
&lt;h2&gt;
  
  
  How do Q# arrays compare to similar concepts in other languages?
&lt;/h2&gt;

&lt;p&gt;In Python, there isn't exactly an array type, so let's look at some related types you might use in a similar way. Lists, tuples, and strings in Python are ways of organizing collections of elements, so let's compare how they work to Q# arrays.&lt;/p&gt;

&lt;p&gt;Tuples and strings are &lt;em&gt;immutable&lt;/em&gt;, meaning that they cannot be changed after they are created. What happens in the following snippet?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Hello world!"&lt;/span&gt;
&lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;
&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;[:&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;" Cruel"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;:]&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will print &lt;code&gt;Hello world!&lt;/code&gt;, because &lt;code&gt;b&lt;/code&gt; is immutable once created. The third line where we construct a new value for &lt;code&gt;a&lt;/code&gt; works because we are not trying to change &lt;code&gt;a&lt;/code&gt;'s previous value, but give an entirely new one.&lt;/p&gt;

&lt;p&gt;C# takes a very similar approach, treating strings as immutable. Try running the following example in a &lt;a href=""&gt;C# Notebook&lt;/a&gt; and see what you get!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"abc"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Remove&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;Insert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"B"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This immutability makes it really easy to reason about side-effects, since nothing else in your Python program can possibly mess with what &lt;code&gt;a&lt;/code&gt; is. Where immutability in Python gets inconvenient, though, is if you want to replace just one element of a tuple or string:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Hello, world!"&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"?"&lt;/span&gt;
&lt;span class="n"&gt;Traceback&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;most&lt;/span&gt; &lt;span class="n"&gt;recent&lt;/span&gt; &lt;span class="n"&gt;call&lt;/span&gt; &lt;span class="n"&gt;last&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="s"&gt;"&amp;lt;stdin&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;module&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nb"&gt;TypeError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'str'&lt;/span&gt; &lt;span class="nb"&gt;object&lt;/span&gt; &lt;span class="n"&gt;does&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;support&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="n"&gt;assignment&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To help with this, Python also provides &lt;em&gt;lists&lt;/em&gt;, which are really similar to tuples, but are mutable; that is, the contents of lists can be changed after they are created.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;
&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One way to think about Q# arrays, then, is as being similar to Python tuples, but with a cool operator (&lt;code&gt;w/&lt;/code&gt;) that lets you use them in the same ways as lists &lt;em&gt;even without needing mutable collections&lt;/em&gt;. That lets you get all the benefits and predictability of immutable collections like Python strings and tuples, and like C# strings, but with the flexibility that you would normally expect from mutable collections like Python lists and and C# arrays.&lt;/p&gt;

&lt;p&gt;You can use Q# arrays to implement a wide range of classical computing tasks from within your quantum programs, even including things like &lt;a href="https://en.wikipedia.org/wiki/Quicksort#Algorithm"&gt;the quicksort algorithm&lt;/a&gt;!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function Sorted&amp;lt;'T&amp;gt;(comparisonFunction : (('T, 'T) -&amp;gt; Bool), inputArray: 'T[]) : 'T[] {
    if (Length(inputArray) &amp;lt;= 1) {
        return inputArray;
    }
    let pivot = Head(inputArray);
    let left = Filtered(comparisonFunction(_, pivot), Rest(inputArray));
    let right = Filtered(Compose(Not, comparisonFunction(_, pivot)), Rest(inputArray));

    return Sorted(comparisonFunction, left) + [pivot] + Sorted(comparisonFunction, right);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because Q# arrays are values, it's really easy to predict how they'll behave in your quantum programs, even as you do things like use the &lt;a href="https://docs.microsoft.com/quantum/language/type-model#adjoint"&gt;&lt;code&gt;Adjoint&lt;/code&gt; functor&lt;/a&gt; to run parts of your programs backwards. Arrays are a great example of how the classical programming features of Q# are designed, making it easy to use for quantum computing 💖&lt;/p&gt;

&lt;h2&gt;
  
  
  More Resources!
&lt;/h2&gt;

&lt;p&gt;Want to learn more about arrays in Q# or Quantum Computing? Check out the links below for some good resources! 😀&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.manning.com/books/learn-quantum-computing-with-python-and-q-sharp?a_aid=learn-qc-granade&amp;amp;a_bid=ee23f338"&gt;Learn Quantum Computing with Python and Q#, Chapter 8&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.arrays"&gt;&lt;code&gt;Microsoft.Quantum.Arrays&lt;/code&gt; API Reference&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/quantum/language/type-model#array-types"&gt;Description of the type model for Q#&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/quantum/libraries/standard/data-structures"&gt;Discussion of data structures in the Q# Libraries&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/quantum/language/expressions#copy-and-update-expressions"&gt;Copy and update expression Q# docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://devblogs.microsoft.com/qsharp/qsharp-06-language-features-and-more/"&gt;Q# Blog post by Bettina Heim&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>qsharp</category>
      <category>quantumcomputing</category>
      <category>quantum</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
