Package: pytket-qsharp
pytket-qsharpPytketis a python module for interfacing
with tket, a quantum computing toolkit and optimising compiler developed by Quantinuum.Azure Quantumis a portal for accessing
quantum computers via Microsoft Azure.Microsoft'sQDKis a
language and associated toolkit for quantum programming.pytket-qsharpis an extension topytketthat allowspytketcircuits to be
executed on remote devices and simulators via Azure Quantum,
as well as local simulators and resource estimators from the Microsoft QDK.Backends provided in this moduleThis module provides fourbackends, all deriving
from thepytketBackendclass:AzureBackend, for executing pytket circuits on targets the user has access to on Azure Quantum;QsharpSimulatorBackend, for simulating a general pure-quantum circuit using
the QDK;QsharpToffoliSimulatorBackend, for simulating a Toffoli circuit using the
QDK;[disabled]QsharpEstimatorBackend, for estimating various quantum resources of a
circuit using the QDK. This provides aget_resourcesmethod, which returns a
dictionary.Getting startedpytket-qsharpis available for Python 3.10, 3.11 and 3.12, on Linux, MacOS
and Windows. To install, run:pipinstallpytket-qsharpThis will installpytketif it isn't already installed, and add new classes
and methods into thepytket.extensionsnamespace.In order to usepytket-qsharpyou will first need to install thedotnetSDK
(6.0) and theiqsharptool. On some Linux systems it is also necessary to
modify yourPATH:Seethis pagefor
instructions on installing the SDK on your operating system.On Linux, ensure that thedotnettools directory is on your path. Typically
this will be~/.dotnet/tools.Rundotnet tool install -g Microsoft.Quantum.IQSharp.Rundotnet iqsharp install --user.Alternatively, you can set up an environment with all the required packages using conda:conda create -n qsharp-env -c quantum-engineering qsharp notebook

conda activate qsharp-envBugs, support and feature requestsPlease file bugs and feature requests on the Githubissue tracker.There is also a Slack channel for discussion and support. Clickhereto join.DevelopmentTo install an extension in editable mode, simply change to its subdirectory
within themodulesdirectory, and run:pipinstall-e.ContributingPull requests are welcome. To make a PR, first fork the repo, make your proposed
changes on thedevelopbranch, and open a PR from your fork. If it passes
tests and is accepted after review, it will be merged in.Code styleFormattingAll code should be formatted usingblack, with default options. This is
checked on the CI. The CI is currently using version 20.8b1.Type annotationOn the CI,mypyis used as a static
type checker and all submissions must pass its checks. You should therefore runmypylocally on any changed files before submitting a PR. Because of the way
extension modules embed themselves into thepytketnamespace this is a little
complicated, but it should be sufficient to run the scriptmodules/mypy-check(passing as a single argument the root directory of the module to test). The
script requiresmypy0.800 or above.LintingWe usepylinton the CI to check compliance
with a set of style requirements (listed in.pylintrc). You should runpylintover any changed files before submitting a PR, to catch any issues.TestsTo run the tests for a module:cdinto that module'stestsdirectory;ensure you have installedpytest,hypothesis, and any modules listed in
thetest-requirements.txtfile (all viapip);runpytest.When adding a new feature, please add a test for it. When fixing a bug, please
add a test that demonstrates the fix.