Move contents of qsharp python package to qdk python package#3192
Open
ScottCarda-MS wants to merge 26 commits intomainfrom
Open
Move contents of qsharp python package to qdk python package#3192ScottCarda-MS wants to merge 26 commits intomainfrom
qsharp python package to qdk python package#3192ScottCarda-MS wants to merge 26 commits intomainfrom
Conversation
qsharp python package to qdk python package
ScottCarda-MS
commented
May 4, 2026
ScottCarda-MS
commented
May 5, 2026
| @@ -0,0 +1,345 @@ | |||
| # `qdk` Package — Public API Surface | |||
|
|
|||
| > **Delete this file before merging.** | |||
Contributor
Author
There was a problem hiding this comment.
Remove this file before merging.
botechat
previously approved these changes
May 5, 2026
Accidentally did it with my personal account
joao-boechat
approved these changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR: Migrate
qsharppip package →qdkSummary
This PR migrates all Python source code, Rust native extension code, tests, and build infrastructure from the
qsharppip package (source/pip/) into theqdkpackage (source/qdk_package/). After this change:qdkis the primary Python package containing all source code and the native Rust extension.qsharpbecomes a thin, pure-Python deprecation shim that re-exports from theqdkpackage.Motivation
The repo is being rebranded from
qsharptoqdk. Rather than maintaining two packages with real code, all functionality consolidates intoqdk, andqsharpexists solely for backward compatibility during the transition period.What Changed
1. Rust native extension moved (
source/pip/src/→source/qdk_package/src/)The pyo3 native module (
_native) and all its Rust source files (interpreter, QIR simulation, noisy simulator bindings, resource estimator, etc.) were moved fromsource/pip/intosource/qdk_package/. TheCargo.tomlatsource/qdk_package/now defines theqdkcrate (previouslyqsharp), and the rootCargo.tomlworkspace member was updated accordingly.Files moved (all "pure" renames):
src/lib.rs,src/interpreter.rs,src/qir_simulation.rs,src/noisy_simulator.rs,src/qre.rs,src/fs.rs,src/interop.rs,src/generic_estimator/,src/displayable_output/,src/state_*_template.html, and all sub-modules.2. Python source reorganized (
source/pip/qsharp/→source/qdk_package/qdk/)All Python modules were moved from
qsharp.*toqdk.*with import paths updated throughout.Key structural changes:
qsharp.*)qdk.*)qsharp/__init__.pyqdk/__init__.pyqsharp/_qsharp.pyqdk/_interpreter.py+qdk/_types.pyqsharp/_simulation.pyqdk/simulation/_simulation.pysimulation/subpackageqsharp/noisy_simulator/qdk/simulation/_noisy_simulator.pysimulation/subpackageqsharp/interop/qiskit/qdk/qiskit/interopto top-level subpackageqsharp/interop/cirq/qdk/cirq/interopto top-level subpackageqsharp/utils/_utils.pydump_operationmoved into_interpreter.pyqsharp/estimator/qdk/estimator/qsharp/openqasm/qdk/openqasm/qsharp/code/qdk/code/qsharp/applications/qdk/applications/qsharp/qre/qdk/qre/qsharp/_device/qdk/_device/New
qdkpublic API surface:qdk.qsharp— Q# interpreter functions (init,eval,run,compile,circuit,estimate, etc.)qdk.simulation— Simulation APIs (NeutralAtomDevice,NoiseConfig, noisy simulator types)qdk.qiskit— Qiskit interop (QSharpBackend,NeutralAtomBackend, etc.)qdk.cirq— Cirq interopqdk.estimator— Resource estimatorqdk.openqasm— OpenQASM compilation/executionqdk.code— Code analysisqdk.applications— Domain applications (magnets, etc.)qdk.qre— QRE v33.
qsharppackage converted to deprecation shim (source/pip/)source/pip/qsharp/__init__.pynow:DeprecationWarningon import.qdk._types,qdk._interpreter, andqdk._native.qdk._ipython.All other Python files under
source/pip/qsharp/are now thin re-export wrappers that import from theirqdk.*counterparts. The package metadata insource/pip/pyproject.tomldeclaresdependencies = ["qdk==0.0.0"](version stamped at CI time).4. Tests moved
source/qdk_package/tests/— import paths updated fromqsharp.*toqdk.*.source/pip/tests-integration/tosource/qdk_package/tests-integration/— all imports updated to useqdk.*.5. Build script changes (
build.py)--qdkflag: Builds the maturin wheel (Rust + Python) and runs unit tests. Also runs integration tests when--integration-testsis passed.--pipflag: Builds only the pure-Pythonqsharpshim wheel via setuptools. No longer runs any tests (integration tests moved to--qdk).install_qsharp_python_package(): No longer needed since integration tests don't depend on theqsharpshim.--no-deps --no-indexto install from local wheels without reaching PyPI.6. CI/CD pipeline changes
GitHub Actions (
ci.yml) — No changes needed. Theintegration-testsjob already passed both--qdkand--integration-tests.Azure DevOps (
publish.yml) — Restructured for clean platform split:Platform_Agnostic_Python--jupyterlab --widgets --qdk--jupyterlab --widgets --pip--pip --integration-tests--qdk --integration-testsThis restructuring reflects the fact that
qdkis now the platform-specific package (it contains the native Rust extension), whileqsharpis now platform-agnostic (pure-Python shim). Previously it was the reverse:qsharpheld the native code andqdkwas a pure-Python meta-package. Each of the 6 OS/arch combinations now builds its own nativeqdkwheel, while the platform-agnostic wheels (qsharp, widgets, jupyterlab) are built once.7. Circular import fix (
_device._atom↔simulation)simulation/__init__.pyimportsNeutralAtomDevicefrom_device._atom, while_device._atomneedsNoiseConfigandrun_qir_*fromsimulation._simulation. This was resolved by:from __future__ import annotationsin_device/_atom/__init__.pyNoiseConfigimport behindTYPE_CHECKINGrun_qir_*into thesimulate()method body8. Miscellaneous
.prettierignore: Addedsource/qdk_package/src/**/*.htmlandsource/qdk_package/tests-integration/**/*.inc(these files moved fromsource/pip/which was fully ignored)..github/CODEOWNERS: Updated paths fromsource/pip/tosource/qdk_package/..github/copilot-instructions.md: Updated architecture documentation.Cargo.toml(root): Updated workspace member fromsource/piptosource/qdk_package.import qsharptoimport qdk/from qdk import qsharp.How to Review
Due to the large number of file moves, GitHub's diff may be hard to follow. Suggested approach:
build.py— understand the new build flow (--qdkbuilds native + runs tests,--pipjust builds the shim).source/qdk_package/qdk/__init__.py— see what the newqdkroot exposes.source/pip/qsharp/__init__.py— see the deprecation shim pattern.source/qdk_package/qdk/simulation/__init__.pyandsource/qdk_package/qdk/_device/_atom/__init__.py— these have the circular import fix..ado/publish.yml— verify the platform-agnostic vs. per-platform split.s/qsharp/qdk/gimport updates. GitHub should detect most as renames (95%+ similarity).Testing
source/qdk_package/tests/)source/qdk_package/tests-integration/), run against both Qiskit v1 (>=1.3,<2) and v2 (>=2,<3)qsharpshim wheel builds successfullyqdkPackage StructureFor a detailed breakdown of every public symbol exported by each
qdksubmodule, see API_SURFACE.md.Follow-up Work
qdk.simulation: ThePauliNoise,DepolarizingNoise,BitFlipNoise, andPhaseFlipNoiseclasses currently live inqdk._typesand are re-exported throughqdk.qsharp. These are simulation concepts and should canonically live inqdk.simulation, with backward-compatible re-exports fromqdk.qsharpandqdk._types. Deferred from this PR to avoid additional circular import complexity.NoiseConfiginqdk.qsharp: Similarly,NoiseConfig(from_native) is re-exported inqdk.qsharp.__all__but semantically belongs inqdk.simulation(where it's already exported). Theqdk.qsharpre-export should be removed in a follow-up.qsharpimport paths and naming conventions. These need to be audited and updated to reflect the newqdk.*namespace for accurate generated documentation.