Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
python313-sys
Raw Rust bindings for the CPython 3.13.15 C API.
This crate provides low-level FFI access to CPython internals and is intended to be used as a foundation layer for building safe and idiomatic Rust abstractions over Python.
Features
- ✅ CPython 3.13.15 C API bindings
- ✅ Generated automatically using
bindgen - ✅ Native linking against Python 3.13
- ✅ Access to raw
PyObjectAPIs - ✅ Compatible with Rust 2024 edition
Requirements
- Python 3.13.15
- C compiler toolchain
- LLVM/Clang (required by
bindgen)
The crate automatically searches for Python installation using pyconfig.
Installation
Add this to your Cargo.toml:
[]
= "3.13.15"
Usage
use *;
About
python313-sys is a low-level binding layer.
It intentionally does not provide:
- safe Rust wrappers
- automatic reference counting
- ownership management
- Rust-friendly error handling
The API mirrors CPython's C interface as closely as possible.
Higher-level abstractions should be built on top of this crate.
Example:
your_application
|
v
safe Python wrapper
|
v
python313-sys
|
v
CPython C API
Building
During compilation, build.rs:
- Finds Python 3.13.15 installation
- Locates Python headers and libraries
- Runs
bindgen - Generates Rust FFI bindings
- Links against
python313
Versioning
The crate version follows the supported CPython version:
python313-sys 3.13.15
|
+-- CPython 3.13.15
Only this Python version is supported.
Safety
This crate exposes unsafe CPython APIs.
Users must follow CPython's reference counting rules:
unsafe
Incorrect usage may cause memory leaks, use-after-free, or interpreter crashes.
License
MIT License