# m-ou-se/inline-python

Inline Python code directly in your Rust code

Repository: https://github.com/m-ou-se/inline-python
Canonical: https://ross.abutalabs.com/products/inline-python
Homepage: https://docs.rs/inline-python
Language: Rust
License: BSD-2-Clause
License Family: permissive
Last push: 2025-06-27T11:11:42+00:00

## Health v2 (maintenance only)
Score: 45/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 28, release rhythm 35, longevity 100
- inputs: {"age_days": 2695, "days_push": 432, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1250, forks 45 (observed 2026-08-28T04:04:08.037103+00:00)

## What it is
A Rust library providing a python!{} macro that lets you write Python code directly inside Rust source files. It uses pyo3 to embed the Python interpreter, allowing Rust variables to be passed in and results retrieved via a reusable Context object.

## Use cases
- embed python snippets in a rust program
- call python code from rust quickly
- share variables between rust and python
- prototype algorithms in python inside a rust app
- run python one-off scripts from rust

## When to choose
- you want quick, lightweight Python embedding in Rust without writing pyo3 bindings
- you need to mix small Python snippets into Rust code with variable sharing
- you want a minimal alternative to full FFI boilerplate

## When to avoid
- you need high-performance or frequent Rust-Python calls
- you need full control over the Python C API or complex object conversions
- your Python code must avoid the Rust tokenizer's syntax restrictions

## Facets
- artifact type: library
- maturity: active
- function: interpreter, sdk
- domain: programming-languages, developer-tools, cross-platform
- platform: rust, python, cross-platform
- tags: rust-macro, python-embedding, pyo3, inline-code, language-interoperability

## Member repositories
- m-ou-se/inline-python (main) score 45

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:08.037103+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T05:07:44.807955+00:00, confidence not recorded.
  - readme: https://github.com/m-ou-se/inline-python (fetched 2026-08-28T04:04:08.037103+00:00, sha 8ff9fec635b0)
  - homepage: https://docs.rs/inline-python (fetched 2026-08-29T12:18:43.737729+00:00, sha 2a67d9ddc30e)
  - site_page: https://docs.rs/ (fetched 2026-08-29T12:18:43.746872+00:00, sha 19f01efe996e)
  - site_page: https://docs.rs/crate/inline-python/latest (fetched 2026-08-29T12:18:43.748637+00:00, sha 930e0fd2690b)
  - site_page: https://docs.rs/crate/inline-python/latest/features (fetched 2026-08-29T12:18:43.751738+00:00, sha b90880bb16e4)
  - site_page: https://docs.rs/about (fetched 2026-08-29T12:18:43.753997+00:00, sha 29ab7986fbf5)
  - site_page: https://docs.rs/about/badges (fetched 2026-08-29T12:18:43.756165+00:00, sha 6588cac258af)
  - site_page: https://docs.rs/about/builds (fetched 2026-08-29T12:18:43.758034+00:00, sha 811231ca4680)
  - site_page: https://docs.rs/about/metadata (fetched 2026-08-29T12:18:43.759818+00:00, sha 0dcdccb2b2b2)
  - site_page: https://docs.rs/about/redirections (fetched 2026-08-29T12:18:43.761417+00:00, sha 1b1efd93105f)
- Data as of 2026-08-30T08:39:29.467469+00:00.
