Skip to content

A cross-platform library for Swift/Kotlin/C#/Python, surfacing features of the Q# compiler and resource estimator.

License

Notifications You must be signed in to change notification settings

qsharp-community/qsharp-bridge

Repository files navigation

Q# Bridge

A cross-platform library for Swift/Kotlin/C#/Python, surfacing features of the Q# compiler and resource estimator.

Supported platforms and languages

Swift .NET Kotlin Python
Package Swift Package Nuget N/A Wheel
Manual Integration Bindings + XCFramework Bindings + native library Bindings + native library Bindings + native library Bindings + native library
Platforms macOS arm64
iOS
Windows x64
Windows arm64 (not via Nuget)
Linux x64
Linux arm64 (not via Nuget)
macOS arm64
Windows x64
Linux x64
macOS arm64
Windows x64
Windows arm64
Linux x64
Linux arm64
macOS arm64

Building instructions

Swift

Build the Swift Package (arm64 Mac required).

./build_swift.sh

This builds:

  • the Swift Package under platforms/swift/QSharp.Bridge
  • XCFramework under artifacts/swift/qsharp_bridge_framework.xcframework

Now run the Swift console app:

cd examples/swuft/console
./run.sh

C#

Install UniFFI C# bindings generator

cargo install uniffi-bindgen-cs --git https://github.com/NordSecurity/uniffi-bindgen-cs --tag v0.9.1+v0.28.3

Build the Nuget package for your platform:

cargo build --release

Now run the .NET console app:

cd examples/csharp/console
dotnet run -c Release

Kotlin

Go the Kotlin sample and run it from there:

cd samples/kotlin
./run.sh

Python

First build the Wheel:

cd platforms/python/qsharp-bridge
python -m pip install --upgrade pip setuptools wheel
python setup.py sdist bdist_wheel

You can then use the Jupyter Notebooks:

cd samples/python/jupyter

Make sure you have created a Virtual Environment or activated a Conda environment, and install the dependencies (including the Wheel):

pip install -r requirements.txt

Now open the Notebook and run the cells.

Compatibility notes

.NET

✅ Tested on Windows arm64

✅ Tested on Windows x64

✅ Tested on Linux arm64

✅ Tested on Linux x64

✅ Tested on macOS arm64

Swift

✅ Tested on macOS arm64.

✅ Tested on iPadOS

✅ Tested on iOS

Kotlin

✅ Tested on macOS arm64.

Python

✅ Tested on Windows arm64

✅ Tested on macOS arm64

About

A cross-platform library for Swift/Kotlin/C#/Python, surfacing features of the Q# compiler and resource estimator.

Resources

License

Stars

Watchers

Forks

Packages

No packages published