StemCode Python Wrapper
This package is a thin Python facade over the StemCode.Sdk .NET API. It uses
pythonnet to load a published StemCode.dll
and keeps the .NET SDK as the source of truth.
Requirements
- Python 3.10 or newer
- .NET runtime that can run the StemCode target framework
Setup From This Repository
From the repository root, enter the Python wrapper folder:
cd python
Create a virtual environment and install the wrapper:
py -3.12 -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -e .
The package loads the StemCode .NET SDK from STEMCODE_DOTNET_PATH, a bundled
payload if one was built, or a NuGet-backed cache. On first use, the wrapper can
download the NuGet package into that cache when no local payload is present.
Set your provider credentials:
$env:STEMCODE_PROVIDER = "openai"
$env:STEMCODE_API_KEY = "PASTE_NEW_ROTATED_KEY_HERE"
$env:STEMCODE_MODEL = "gpt-5"
Run the example:
python .\examples\basic_chat.py "Explain this repository in one paragraph."
Basic Usage
from stemcode import StemCodeClient
with (
StemCodeClient.builder()
.use_openai("PASTE_NEW_ROTATED_KEY_HERE", "gpt-5")
.use_build_tool()
.with_workspace(r"F:\Projects\GrowBitLabs\StemCode")
.auto_approve_tools()
.build()
) as client:
client.on_assistant_message_chunk(print, end="")
session = client.initialize()
print(f"Using {session.provider_name} / {session.model_id}")
result = client.run_turn("Summarize the SDK entry points.")
print(result.response_text)
The wrapper exposes synchronous convenience methods around the .NET async API. Callbacks are kept alive for the lifetime of the Python client.
Runtime Path
The package resolves the StemCode .NET SDK in this order:
load_stemcode(runtime_path=...),StemCodeClient.builder(runtime_path=...), orSTEMCODE_DOTNET_PATH- a bundled
stemcode/_dotnetpayload, when the wheel was built with one - a NuGet package downloaded into the StemCode Python cache
The runtime path can be:
- a folder containing
StemCode.dll - the full path to
StemCode.dll
Publish output is preferred over copying a single assembly because pythonnet must resolve StemCode's dependency assemblies too.
NuGet download settings:
STEMCODE_NUGET_PACKAGE: package ID, defaultStemCodeSTEMCODE_NUGET_VERSION: package version, default matchingstemcode-sdkSTEMCODE_NUGET_SOURCE: flat-container source, default NuGet.orgSTEMCODE_DOTNET_CACHE: cache folder override
The NuGet package must contain StemCode.dll and its dependency DLLs in one of
these layouts:
tools/stemcode/<rid>/tools/stemcode/any/tools/<rid>/tools/lib/net10.0/
To build a wheel with the .NET payload bundled instead of downloaded, set:
$env:STEMCODE_BUNDLE_DOTNET = "1"
python -m build
To verify the NuGet download path end to end:
python .\scripts\test_nuget_runtime.py --version 1.1.22
Metadata
Release files for stemcode-sdk 1.1.23
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| stemcode_sdk-1.1.23.tar.gz | 13.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| stemcode_sdk-1.1.23-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.1 kB
Release files / stemcode_sdk-1.1.23.tar.gz
| Download URL | stemcode_sdk-1.1.23.tar.gz |
|---|---|
| Size | 13.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ebbe990df9e43a19821a1adc02e6bf1d5e5301946315d17b7997829fadd789fe
|
|
BLAKE2b-256 checksum How to use checksums |
3e7318c20ad60c7abad3e2ff823b59d56dfce8ba4e9cb12091facce51f169534
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.
Transparency logRelease files / stemcode_sdk-1.1.23-py3-none-any.whl
| Download URL | stemcode_sdk-1.1.23-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c6f7dcd077ae4571ed248a5b1c3cac2f85e22915f9618d59e56e36fc00a5a3db
|
|
BLAKE2b-256 checksum How to use checksums |
04ba14b49e7bd4d0bfa1f0fdaecf874d0911de4fa9e7bd6c09fea6911d88b15d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.
Transparency log