# tbenthompson/cppimport

Import C++ files directly from Python!

Repository: https://github.com/tbenthompson/cppimport
Canonical: https://ross.abutalabs.com/products/cppimport
Language: Python
License: MIT
License Family: permissive
Last push: 2026-04-17T14:13:19+00:00

## Health v2 (maintenance only)
Score: 71/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 77, release rhythm 48, longevity 100
- inputs: {"age_days": 3765, "days_push": 138, "days_rel": 138, "gap_med": null, "n_releases_24m": 1}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1228, forks 74 (observed 2026-08-28T04:04:03.465343+00:00)

## What it is
cppimport is a Python library that lets you import C++ files directly as Python extension modules, compiling them transparently on first import using pybind11. It supports Mako-templated build configuration and automatic recompilation when source files change.

## Use cases
- import c++ code from python directly
- speed up slow python functions with c++
- compile pybind11 extension modules on import
- transparent recompilation of c++ files in python workflow
- quickly build python bindings for c++ code

## When to choose
- you want to call C++ code from Python without writing a separate build system
- you're prototyping performance-critical functions and want edit-and-run iteration
- you already use pybind11 and want a frictionless import workflow

## When to avoid
- you need a production build system with fine-grained control - use CMake or setuptools instead
- your project doesn't involve C++ extensions
- compile-on-import latency is unacceptable for your deployment

## Facets
- artifact type: library
- maturity: active
- function: build-tool, developer-tools, compiler
- domain: developer-tools, programming-languages, performance
- platform: python, cpp, cross-platform
- tags: pybind11, import-hook, python-c-bindings, jit-compilation, extension-modules

## Member repositories
- tbenthompson/cppimport (main) score 71

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:03.465343+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-30T06:15:12.994175+00:00, confidence not recorded.
  - readme: https://github.com/tbenthompson/cppimport (fetched 2026-08-28T04:04:03.465343+00:00, sha 7b09111dfb5e)
  - registry_pypi: https://pypi.org/pypi/cppimport/json (fetched 2026-08-29T12:23:09.236244+00:00, sha 7b1d947f78dd)
- Data as of 2026-08-30T08:39:29.467469+00:00.
