Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
770ed19
move rust code into qdk
ScottCarda-MS Apr 29, 2026
98ab354
add python defs to qdk
ScottCarda-MS Apr 29, 2026
bed4e6a
remove python definitions from `qsharp`
ScottCarda-MS Apr 29, 2026
a500e0a
Started to deal with tests
ScottCarda-MS Apr 29, 2026
f61fcab
move non-integration tests into qdk
ScottCarda-MS Apr 29, 2026
3fbc879
migrate integration tests into qdk from qsharp
ScottCarda-MS Apr 30, 2026
c95fe04
move benchmark to qdk
ScottCarda-MS Apr 30, 2026
dd997be
fix test option in build.py
ScottCarda-MS Apr 30, 2026
8b4eb34
minor change to pyproject.toml
ScottCarda-MS May 1, 2026
729d22d
Merge branch 'main' into sccarda/MoveQsharpToQdk
ScottCarda-MS May 1, 2026
494c6c1
merge conflicts resolve
ScottCarda-MS May 1, 2026
9a73092
update notebook
ScottCarda-MS May 1, 2026
c1af9b0
update test notebooks
ScottCarda-MS May 1, 2026
dd745c1
updated codeowners to use the new paths
ScottCarda-MS May 1, 2026
052c29f
update copilot instructions
ScottCarda-MS May 1, 2026
a298cb8
reorganize internals
ScottCarda-MS May 4, 2026
792ef7b
style
ScottCarda-MS May 4, 2026
8e514e9
fixed some internal circular dependencies
ScottCarda-MS May 4, 2026
05e54f2
Updates to the pipeline
ScottCarda-MS May 4, 2026
d6890dd
Start keeping track of PR changes
ScottCarda-MS May 4, 2026
ac00b61
Add API Surface description and update difficult test
ScottCarda-MS May 4, 2026
9a19b51
import _ipython magic
ScottCarda-MS May 4, 2026
727b7da
move magic registration to qdk instead of qdk.qsharp
ScottCarda-MS May 4, 2026
c241973
updated notebook test
ScottCarda-MS May 5, 2026
0afafc3
Updated Readmes
ScottCarda-MS May 5, 2026
9df4562
removed temp PR description file
ScottCarda-MS May 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 5 additions & 6 deletions .ado/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,10 @@ extends:
python ./prereqs.py --skip-wasm && python ./version.py
displayName: Install Prereqs and set version

# The jupyterlab and widgets packages have no tests. The qdk package has minimal tests but
# they also depend on the qsharp package which is platform-dependent. So we skip tests here
# and rely on the GitHub CI to run the few `qdk` tests on every PR.
# Build platform-agnostic Python wheels: jupyterlab, widgets, and the
# qsharp shim (pure Python). The qdk native wheel is built per-platform.
- script: |
python ./build.py --jupyterlab --widgets --qdk --no-check --no-test --no-check-prereqs
python ./build.py --jupyterlab --widgets --pip --no-check --no-test --no-check-prereqs
displayName: Build Platform-Agnostic Packages

- script: |
Expand Down Expand Up @@ -398,13 +397,13 @@ extends:

# Windows arm64
- script: |
python build.py --pip --no-check-prereqs --no-integration-tests --no-optional-dependencies
python build.py --qdk --no-check-prereqs --no-integration-tests --no-optional-dependencies
displayName: Build Platform-Dependent Py Packages
condition: and(eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['arch'], 'aarch64'))

# every other platform
- script: |
python build.py --pip --no-check-prereqs --integration-tests
python build.py --qdk --no-check-prereqs --integration-tests
displayName: Build Platform-Dependent Py Packages
condition: not(and(eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['arch'], 'aarch64')))

Expand Down
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
/library @swernli @orpuente-MS
/source/npm @billti @minestarks @ScottCarda-MS
/source/pip @billti @idavis @minestarks
/source/pip/qsharp/qre @msoeken @brad-lackey @jwhogabo
/source/qdk_package @billti @idavis @minestarks
/source/qdk_package/qdk/qre @msoeken @brad-lackey @jwhogabo
/source/playground @billti @minestarks
/source/qre @msoeken @brad-lackey @jwhogabo
/source/resource_estimator @billti @swernli
Expand Down
8 changes: 5 additions & 3 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ All internal source code for the compiler and related tooling has been moved und

Most of the core components are implemented in Rust. These components are packaged in two ways:

1. Compiled as a native Python module and packaged into the `qsharp` Python package
1. Compiled as a native Python module and packaged into the `qdk` Python package
2. Compiled into WebAssembly and packaged into the `qsharp-lang` npm package

## Repo Contents
Expand Down Expand Up @@ -52,7 +52,8 @@ Most of the core components are implemented in Rust. These components are packag

**Python**

- **pip/**: The `qsharp` Python package
- **qdk_package/**: The `qdk` Python package (core package with native Rust extension)
- **pip/**: The `qsharp` Python package (thin deprecation shim that re-exports from `qdk`)
- **jupyterlab/**: JupyterLab extension for Q#
- **widgets/**: Q# Jupyter widgets

Expand Down Expand Up @@ -82,7 +83,8 @@ Most of the core components are implemented in Rust. These components are packag

- `./build.py` runs full CI checks, including lints and unit tests.
- `./build.py --wasm --npm --vscode` only builds the VS Code extension, including its dependencies the WASM module and the `qsharp-lang` npm package.
- `./build.py --pip` only builds the `qsharp` Python package, including its native dependencies.
- `./build.py --qdk` only builds the `qdk` Python package, including its native dependencies.
- `./build.py --pip` only builds the `qsharp` shim package (requires `qdk` to be built first).
- Pass `--no-check` to `./build.py`, in combination with any other command line options, to skip the lints and formatting checks.
- When working in Rust parts of the codebase, using `cargo` commands is usually more efficient than building via `./build.py`.
- Many lints can be auto-fixed via `cargo clippy --fix`.
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ __pycache__/
/source/fuzz/coverage
/source/fuzz/Cargo.lock
/source/pip/doc
/source/pip/build/
/source/pip/*.egg-info/
/source/samples_test/src/tests/*_generated.rs
.mypy_cache/
.pytest_cache/
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ __pycache__/
/source/npm/qsharp/test/**/*.snapshot.*
/source/pip/
/source/pip/src/**/*.html
/source/qdk_package/
/source/qdk_package/src/**/*.html
/source/playground/public/libs/
/source/vscode/out/
/source/vscode/test/out/
Expand Down
48 changes: 24 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ members = [
"source/index_map",
"source/language_service",
"source/simulators",
"source/pip",
"source/qdk_package",
"source/qre",
"source/resource_estimator",
"source/samples_test",
Expand Down
123 changes: 56 additions & 67 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,20 +300,6 @@ def use_python_env(folder):
step_end()


def install_qsharp_python_package(cwd, wheelhouse, interpreter):
command_args = [
interpreter,
"-m",
"pip",
"install",
"--force-reinstall",
"--no-index",
"--find-links=" + wheelhouse,
"qsharp",
]
subprocess.run(command_args, check=True, text=True, cwd=cwd)


# If any package fails to install when using a requirements file, the entire
# process will fail with unpredicatable state of installed packages. To avoid
# this, we install each package individually from the requirements file.
Expand Down Expand Up @@ -346,7 +332,7 @@ def install_python_test_requirements(cwd, interpreter, check: bool = True):
subprocess.run(command_args, check=check, text=True, cwd=cwd)


def build_qsharp_wheel(cwd, interpreter, pip_env):
def build_maturin_wheel(cwd, interpreter, pip_env):
# Read the build dependencies out of the pyproject.toml and install them first.
with open(os.path.join(cwd, "pyproject.toml"), "rb") as f:
requires = tomllib.load(f)["build-system"]["requires"]
Expand Down Expand Up @@ -438,32 +424,64 @@ def run_ci_historic_benchmark():
f.write(result.stdout)


if build_pip:
step_start("Building the pip package")
if build_qdk:
step_start("Building the qdk python package")

(python_bin, pip_env) = use_python_env(pip_src)
# Reuse (or create) the pip environment so qdk wheel can be built/installed consistently.
python_bin, pip_env = use_python_env(qdk_python_src)

build_qsharp_wheel(pip_src, python_bin, pip_env)
# Build the qdk wheel with maturin (it now owns the native extension).
build_maturin_wheel(qdk_python_src, python_bin, pip_env)
step_end()

if run_tests:
step_start("Running tests for the pip package")
step_start("Running tests for the qdk python package")
# Install per-package test requirements (pytest, etc.)
install_python_test_requirements(qdk_python_src, python_bin)

install_python_test_requirements(pip_src, python_bin)
install_qsharp_python_package(pip_src, wheels_dir, python_bin)
run_python_tests(os.path.join(pip_src, "tests"), python_bin, pip_env)
# Install qdk from the freshly built wheel.
# Use --no-deps because dependencies (pyqir, etc.) are already installed
# via test_requirements, and --no-index can't resolve them from PyPI.
install_args = [
python_bin,
"-m",
"pip",
"install",
"--force-reinstall",
"--no-deps",
"--no-index",
"--find-links=" + wheels_dir,
"qdk",
]
subprocess.run(install_args, check=True, text=True, cwd=qdk_python_src)

# Run its test suite
run_python_tests(os.path.join(qdk_python_src, "tests"), python_bin, pip_env)
step_end()

if args.integration_tests:
step_start("Setting up for integration tests for the pip package")
test_dir = os.path.join(pip_src, "tests-integration")
step_start("Setting up for integration tests for the qdk package")
test_dir = os.path.join(qdk_python_src, "tests-integration")
install_python_test_requirements(test_dir, python_bin, check=False)

# Install qdk from the freshly built wheel.
install_args = [
python_bin,
"-m",
"pip",
"install",
"--force-reinstall",
"--no-deps",
"--no-index",
"--find-links=" + wheels_dir,
"qdk",
]
subprocess.run(install_args, check=True, text=True, cwd=test_dir)
step_end()

for version in QISKIT_VERSION_MATRIX:
step_start(
f"Running integration tests for the pip package ({version['label']})"
f"Running integration tests for the qdk package ({version['label']})"
)

version_install_args = [
Expand All @@ -477,64 +495,35 @@ def run_ci_historic_benchmark():
] + version["requirements"]
subprocess.run(version_install_args, check=True, text=True, cwd=test_dir)

install_qsharp_python_package(pip_src, wheels_dir, python_bin)

run_python_integration_tests(test_dir, python_bin)

step_end()

if build_pip:
step_start("Building the pip package")

if build_qdk:
step_start("Building the qdk python package")

# Reuse (or create) the pip environment so qsharp wheel can be built/installed consistently.
(python_bin, pip_env) = use_python_env(qdk_python_src)
python_bin, pip_env = use_python_env(pip_src)

# Build the qdk wheel (no dependency build needed; it's a thin meta-package)
qdk_build_args = [
# qsharp is now a pure-Python shim depending on qdk.
# Build with setuptools (no maturin needed).
pip_build_args = [
python_bin,
"-m",
"build",
"--wheel",
"-v",
"--outdir",
wheels_dir,
qdk_python_src,
pip_src,
]
subprocess.run(qdk_build_args, check=True, text=True, cwd=qdk_python_src)
subprocess.run(pip_build_args, check=True, text=True, cwd=pip_src, env=pip_env)
step_end()

if run_tests:
step_start("Running tests for the qdk python package")
# Install per-package test requirements (pytest, etc.)
install_python_test_requirements(qdk_python_src, python_bin)

# Install qsharp wheel first so dependency resolution is offline & version-synced.
install_qsharp_python_package(qdk_python_src, wheels_dir, python_bin)

# Install qdk itself from the freshly built wheel (force to ensure isolation)
install_args = [
python_bin,
"-m",
"pip",
"install",
"--force-reinstall",
"--no-index",
"--no-deps",
"--find-links=" + wheels_dir,
"qdk",
"qsharp",
]
subprocess.run(install_args, check=True, text=True, cwd=qdk_python_src)

# Run its test suite
run_python_tests(os.path.join(qdk_python_src, "tests"), python_bin, pip_env)
step_end()

if build_widgets:
step_start("Building the Python widgets")

(python_bin, _) = use_python_env(qdk_python_src)
python_bin, _ = use_python_env(qdk_python_src)

widgets_build_args = [
python_bin,
Expand Down Expand Up @@ -660,7 +649,7 @@ def run_ci_historic_benchmark():
if build_jupyterlab:
step_start("Building the JupyterLab extension")

(python_bin, _) = use_python_env(jupyterlab_src)
python_bin, _ = use_python_env(jupyterlab_src)

pip_build_args = [
python_bin,
Expand Down Expand Up @@ -697,7 +686,7 @@ def run_ci_historic_benchmark():
or f.startswith("benzene.")
)
]
(python_bin, pip_env) = use_python_env(samples_src)
python_bin, pip_env = use_python_env(samples_src)

# Install the qsharp package
pip_install_args = [
Expand Down Expand Up @@ -814,7 +803,7 @@ def _run_notebooks(files):
dir for dir, _, _ in project_directories if dir.find("testing") != -1
]

install_python_test_requirements(pip_src, python_bin)
install_python_test_requirements(os.path.join(samples_src, "testing"), python_bin)
for test_project_dir in test_projects_directories:
run_python_tests(test_project_dir, python_bin, pip_env)
step_end()
Expand Down
4 changes: 2 additions & 2 deletions samples/qre/1_qre_input.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,15 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"id": "24dad0bb",
"metadata": {},
"outputs": [],
"source": [
"# Load a pre-compiled QIR file for the Hidden Shift algorithm\n",
"qir_file = (\n",
" Path.cwd().parent.parent\n",
" / \"source\" / \"pip\" / \"tests-integration\" / \"resources\"\n",
" / \"source\" / \"qdk_package\" / \"tests-integration\" / \"resources\"\n",
" / \"adaptive_ri\" / \"output\" / \"HiddenShiftNISQ.ll\"\n",
")\n",
"qir_app = QIRApplication(qir_file.read_text(encoding=\"utf-8\"))"
Expand Down
2 changes: 1 addition & 1 deletion samples/qre/2_analysing_results.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
}
],
"source": [
"from qsharp.code import EstimateAdder\n",
"from qdk.code import EstimateAdder\n",
"\n",
"app = QSharpApplication(EstimateAdder)\n",
"arch = GateBased(error_rate=1e-4, gate_time=100, measurement_time=500)\n",
Expand Down
Loading
Loading