Registry / other / cpython

cpython

JSON →
library0.7.2rscratesunverified

Bindings to Python, allowing Rust to call Python code.

# Cargo.toml [dependencies] cpython = "0.7.2"
INSTALL
IMPORT
SIG · CPYTHON
C
cpython
otherrustv0.7.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Python
use cpython::Python;

Acquire the GIL and run Python code.

use cpython::{Python, PyResult}; fn main() -> PyResult<()> { let gil = Python::acquire_gil(); let py = gil.python(); let sys = py.import("sys")?; let version: String = sys.get(py, "version")?.extract(py)?; println!("Python version: {}", version); Ok(()) }
Debug
Known issues
gotchaRequires a compatible Python installation and may have linking issues.
fix
Ensure Python development headers are installed (e.g., `python3-dev` on Linux).
affects: *
Upgrade
Version history
0.7.2latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
6
Meta
1
Amazon
1
Resources
cpython — cargo add cpython · libregistry