Skip to main content

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

Published package: https://pypi.org/project/stemcode-sdk/

pip install stemcode-sdk

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:

  1. load_stemcode(runtime_path=...), StemCodeClient.builder(runtime_path=...), or STEMCODE_DOTNET_PATH
  2. a bundled stemcode/_dotnet payload, when the wheel was built with one
  3. 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, default StemCode
  • STEMCODE_NUGET_VERSION: package version, default matching stemcode-sdk
  • STEMCODE_NUGET_SOURCE: flat-container source, default NuGet.org
  • STEMCODE_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.24

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stemcode-sdk 1.1.24
File Size Uploaded Provenance Actions
stemcode_sdk-1.1.24.tar.gz 13.5 kB With provenance Details for stemcode_sdk-1.1.24.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for stemcode-sdk 1.1.24
File Interpreter ABI Platform Actions
stemcode_sdk-1.1.24-py3-none-any.whl Python 3 none any Details for stemcode_sdk-1.1.24-py3-none-any.whl

Total release size: 22.2 kB

Release files / stemcode_sdk-1.1.24.tar.gz

Download URL stemcode_sdk-1.1.24.tar.gz
Size 13.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2942fe3f62369f138dd68e97aa0335e6e5a8aeb21790e7e7face224f9310463d
BLAKE2b-256 checksum
How to use checksums
bf32ab549007f3a17e33d97f40c0efe4cfe03c20612b83001d1bd45c997092e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Release files / stemcode_sdk-1.1.24-py3-none-any.whl

Download URL stemcode_sdk-1.1.24-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3deed6a8182f426f8813074822c9dcaca6e05a7111db1c90c39ec08932011da5
BLAKE2b-256 checksum
How to use checksums
119ee24cb15309a8165d3dc38570b1d464419c9fa3bc9f065daf708d4c8fc599
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Security for stemcode-sdk 1.1.24

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for stemcode_sdk-1.1.24.tar.gz

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 Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.24 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page