Python Bindings and Frontend
This component provides Python bindings via pybind11 to build SDFGs with Python.
Additionally, this component provides the @native decorator, which automatically
converts Python functions into SDFGs and codegens them for the available target.
- Bindings: Build SDFGs programmatically with Python
- AST Parser: Automatically compile Python/NumPy code to optimized native code
- Targets: Support for CPU (sequential, OpenMP), CUDA GPUs, and other accelerators
Build from Sources
To build the Python component from sources run pip on the component's directory:
pip install -e python/
Requirements
Python Dependencies
- Python >= 3.11
- NumPy >= 1.19.0
System Dependencies
The following system dependencies must be installed (same as core components):
sudo apt-get install -y libgmp-dev libzstd-dev
sudo apt-get install -y nlohmann-json3-dev
sudo apt-get install -y libboost-graph-dev libboost-graph1.74.0
sudo apt-get install -y libisl-dev
Compiler Requirements
Clang/LLVM 21 is required for code generation. Install it with:
# Ubuntu/Debian
sudo apt-get install -y clang-21 llvm-21
For CUDA support, you also need the NVIDIA CUDA Toolkit installed.
Usage
The @native Decorator
The @native decorator is the primary way to use the Python frontend. It automatically:
- Parses the Python function's AST
- Converts it to an SDFG representation
- Applies optimizations based on the target
- Compiles to native code
- Executes and returns results
Basic Example
from docc.python import native
import numpy as np
@native
def vector_add(A, B, C, N):
for i in range(N):
C[i] = A[i] + B[i]
# Usage
N = 1024
A = np.random.rand(N).astype(np.float64)
B = np.random.rand(N).astype(np.float64)
C = np.zeros(N, dtype=np.float64)
vector_add(A, B, C, N) # JIT compiles and executes
Compilation Targets
The @native decorator accepts a target parameter to specify the code generation backend:
target="none" (Default)
No scheduling or optimization is applied. The SDFG is compiled as-is without parallelization. Useful for debugging or when you want to manually control the generated code.
@native(target="none")
def simple_loop(A, B, N):
for i in range(N):
B[i] = A[i] * 2.0
target="sequential"
Generates optimized sequential code with SIMD vectorization.
import math
@native(target="sequential")
def vectorized_sin(A, B):
for i in range(A.shape[0]):
B[i] = math.sin(A[i])
N = 128
A = np.random.rand(N).astype(np.float64)
B = np.zeros(N, dtype=np.float64)
vectorized_sin(A, B)
target="openmp"
Generates parallel code using OpenMP. Suitable for multi-core CPUs. Loops are automatically parallelized with appropriate scheduling.
@native(target="openmp", category="desktop")
def parallel_add(A, B, C, N):
for i in range(N):
C[i] = A[i] + B[i]
# Executes in parallel across CPU cores
N = 1000000
A = np.random.rand(N).astype(np.float64)
B = np.random.rand(N).astype(np.float64)
C = np.zeros(N, dtype=np.float64)
parallel_add(A, B, C, N)
target="cuda"
Generates CUDA code for NVIDIA GPUs. Loops are mapped to GPU thread blocks and threads.
@native(target="cuda", category="server")
def gpu_add(A, B, C, N):
for i in range(N):
C[i] = A[i] + B[i]
# Executes on GPU (data is automatically transferred)
N = 1024
A = np.random.rand(N).astype(np.float64)
B = np.random.rand(N).astype(np.float64)
C = np.zeros(N, dtype=np.float64)
gpu_add(A, B, C, N)
The category Parameter
The category parameter provides hints to the scheduler about the target hardware:
"edge""desktop""server"
@native(target="openmp", category="desktop")
def cpu_kernel(A, B):
...
@native(target="cuda", category="server")
def gpu_kernel(A, B):
...
Advanced: Manual Compilation
For more control, you can manually compile and cache the SDFG:
@native(target="openmp")
def my_kernel(A, B, C, N):
for i in range(N):
C[i] = A[i] + B[i]
# Pre-compile with sample arguments
compiled = my_kernel.compile(A, B, C, N)
# Reuse compiled version
result = compiled(A, B, C, N)
# Access the underlying SDFG
sdfg = my_kernel.last_sdfg
License
This component is part of docc and is published under the BSD-3-Clause license. See LICENSE for details.
Metadata
Release files for docc-compiler 0.8.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 147.6 MB
Release files / docc_compiler-0.8.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | docc_compiler-0.8.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 16.2 MB |
| Tags | CPython 3.14 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
354bd411a987b179da170264fe4ff23bea6f9595e49ba0650ffcacb6258c927c
|
|
BLAKE2b-256 checksum How to use checksums |
b68561162aa3c9ab21ecf2f7fb24b8f1b39d1b5c31ad1108fc49cccbde930883
|
| 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 10, 2026.
Transparency logRelease files / docc_compiler-0.8.4-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
| Download URL | docc_compiler-0.8.4-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 15.2 MB |
| Tags | CPython 3.14 Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
39105b6efb0adae88482f0342baa2402ff66d20ece75b86500f27731a47104f8
|
|
BLAKE2b-256 checksum How to use checksums |
42b348c085a08c8c413ab8df547a3a9886314615c2a8e4cf0bb52039c9ff5272
|
| 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 10, 2026.
Transparency logRelease files / docc_compiler-0.8.4-cp314-cp314-macosx_15_0_arm64.whl
| Download URL | docc_compiler-0.8.4-cp314-cp314-macosx_15_0_arm64.whl |
|---|---|
| Size | 5.5 MB |
| Tags | CPython 3.14 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
60159a1ddb78df004173182cd76b167f03acc1dd6bf4bf5cbb17cce651451923
|
|
BLAKE2b-256 checksum How to use checksums |
6aba8b36536f19bcd8e609a4c036daff14e75a1e9edd9a5c8a49a8e2e9462d83
|
| 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 10, 2026.
Transparency logRelease files / docc_compiler-0.8.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | docc_compiler-0.8.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 16.2 MB |
| Tags | CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
e20fe0a7fffa8273a942cad5e2cdb307038e72efef44aaae10e016b48245f3fc
|
|
BLAKE2b-256 checksum How to use checksums |
f68dd6897d466dde820b1b30c13115cfa6fa6e2f4b1456d4b503d181e511ebf6
|
| 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 10, 2026.
Transparency logRelease files / docc_compiler-0.8.4-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
| Download URL | docc_compiler-0.8.4-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 15.2 MB |
| Tags | CPython 3.13 Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
59ab5b906ce0903cf5e44573d2c11a74f9f74c077de9c7475f4e7abf2107aa2d
|
|
BLAKE2b-256 checksum How to use checksums |
7b894f13c12a4b8b270d976e7e729faa5983b3352fd534e43a6d1143fd33d4c7
|
| 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 10, 2026.
Transparency logRelease files / docc_compiler-0.8.4-cp313-cp313-macosx_15_0_arm64.whl
| Download URL | docc_compiler-0.8.4-cp313-cp313-macosx_15_0_arm64.whl |
|---|---|
| Size | 5.5 MB |
| Tags | CPython 3.13 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
2d9fff8435ab3f348cc9d3a2f91af0371ed39e137c978e151e763e4ad8b8afd3
|
|
BLAKE2b-256 checksum How to use checksums |
0c3bed88aa056867507935b64b737d107aef6ba591ba2afbeef0949d637e7b17
|
| 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 10, 2026.
Transparency logRelease files / docc_compiler-0.8.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | docc_compiler-0.8.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 16.2 MB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
f7a1ce49024da94b5caf2684db286c3d9e6d234a3e7ddabaf6cf36657cf08d1c
|
|
BLAKE2b-256 checksum How to use checksums |
b7c46ef592f18d13ff227145b19daa445a6f73f47e408d5f9eff3a5e1b9c48bd
|
| 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 10, 2026.
Transparency logRelease files / docc_compiler-0.8.4-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
| Download URL | docc_compiler-0.8.4-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 15.2 MB |
| Tags | CPython 3.12 Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
598c944c4fb9001c0898c9d39c2ae8817b0922743a5546991e4e832f32cbf056
|
|
BLAKE2b-256 checksum How to use checksums |
8931cf2a8eebf2461c2c687857c2f101c133993d98b96ce3029a2feb70a1aa6b
|
| 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 10, 2026.
Transparency logRelease files / docc_compiler-0.8.4-cp312-cp312-macosx_15_0_arm64.whl
| Download URL | docc_compiler-0.8.4-cp312-cp312-macosx_15_0_arm64.whl |
|---|---|
| Size | 5.5 MB |
| Tags | CPython 3.12 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
feb8409667533a92f5a25d0717086778b24354989e109e0273a824c41f3b61f9
|
|
BLAKE2b-256 checksum How to use checksums |
ed529fa1863aaec9f063b76235db09b8df70a36570fada6a29680ae6fbcaca6a
|
| 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 10, 2026.
Transparency logRelease files / docc_compiler-0.8.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | docc_compiler-0.8.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 16.2 MB |
| Tags | CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
f56f534ed4dd4be4f8d36e4248fe2cc0de6c4bd8bda0a53dca7e7d4b8a46dd56
|
|
BLAKE2b-256 checksum How to use checksums |
5404f1c054fa90195e5d595348bfe5870e691bf5d0f43e15bbc91446b28f75ec
|
| 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 10, 2026.
Transparency logRelease files / docc_compiler-0.8.4-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
| Download URL | docc_compiler-0.8.4-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 15.2 MB |
| Tags | CPython 3.11 Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
c02283dd06484b5c26635aa8fc1480360610ff12aa1acfbe926c2e32908e23a1
|
|
BLAKE2b-256 checksum How to use checksums |
ab117197d8344bc6b5147c0d4b2068f57a7c64a5597e6e9f8fb415419385d07e
|
| 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 10, 2026.
Transparency logRelease files / docc_compiler-0.8.4-cp311-cp311-macosx_15_0_arm64.whl
| Download URL | docc_compiler-0.8.4-cp311-cp311-macosx_15_0_arm64.whl |
|---|---|
| Size | 5.5 MB |
| Tags | CPython 3.11 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
6dfbc062348e667797b355d8285d30dd7c13f5d28167c7feb3a05541b680b090
|
|
BLAKE2b-256 checksum How to use checksums |
a620d43510bae9f8d2422601a901f57ada87fedef15b1f1f40748169db42c770
|
| 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 10, 2026.
Transparency logSecurity for docc-compiler 0.8.4
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
All 12 files in this release have been uploaded with provenance metadata.
Attestation for docc_compiler-0.8.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
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 10, 2026.
Transparency logA 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.