maturin-import-hook
Import hook to load rust projects built with maturin
Decision gist · record as of 2026-08-14
Yes, if you are actively developing mixed Python/Rust code with maturin. The low install friction, permissive licensing, active maintenance, and zero known vulnerabilities make it a safe choice. The import hook genuinely reduces development friction by automating rebuilds. Not necessary if you are only consuming pre-built Rust extensions or not using maturin.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires maturin to be installed separately; Python >= 3.9 required.
- Low friction install with only filelock and tomli as runtime dependencies.
- Actively maintained with recent releases; last commit on 2026-07-11.
License · maintenance · safety
permissive license (permissive) — Dual-licensed under Apache 2.0 or MIT at your option—both permissive licenses with no copyleft obligations, making it safe for commercial and proprietary projects.
last release 2025-06-08 (432 days) · last repo commit 2026-07-11 · 19 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 99,072 downloads/mo, #13,040 on PyPI
Alternatives
Verify before relying
pip install maturin_import_hook
import maturin_import_hook
maturin_import_hook.install()
# Rust changes now rebuild automatically on import- Whether the hook works with all maturin project configurations or has known limitations with certain build setups.
- Performance impact of automatic rebuilds on large Rust codebases during development.
- Compatibility with different Python virtual environment managers beyond standard venv.
What it is and what it does
Maturin Import Hook is a Python import hook that intercepts imports of Rust projects built with maturin and automatically recompiles them if their source has changed. It bridges the development experience gap between Python and Rust by making Rust changes take effect on import, just like Python code does. The hook works in two modes: it can rebuild editable-installed maturin packages on import, or compile standalone .rs files into temporary projects in a build cache. This reduces friction when working on mixed Python/Rust codebases by eliminating manual rebuild steps.
The package integrates into Python's import system and can be activated either globally or per-script by calling maturin_import_hook.install(). It requires maturin to be installed separately and depends on filelock and tomli for its own operation. The hook also supports importlib.reload() for recompiling projects during development and includes a CLI for managing the build cache and installation state.
Use it for
- Developing a Python package with Rust extensions where you want Rust changes to take effect immediately on re-import without manual rebuilds.
- Writing standalone .rs files as importable modules in a Python project to test or prototype Rust code without a full package structure.
- Iterating on performance-critical Python functions by rewriting them in Rust and testing them in the same development loop.
- Managing a monorepo with multiple editable-installed maturin packages that need to rebuild on demand during active development.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are actively developing mixed Python/Rust code with maturin.
The low install friction, permissive licensing, active maintenance, and zero known vulnerabilities make it a safe choice. The import hook genuinely reduces development friction by automating rebuilds. Not necessary if you are only consuming pre-built Rust extensions or not using maturin.
Install
maturin-import-hook on PyPI
Before you install
Low friction install with only filelock and tomli as runtime dependencies. Actively maintained with recent releases; last commit on 2026-07-11.
Requires maturin to be installed separately; Python >= 3.9 required.
License in practice
Dual-licensed under Apache 2.0 or MIT at your option—both permissive licenses with no copyleft obligations, making it safe for commercial and proprietary projects.
Quickstart
pip install maturin_import_hook
import maturin_import_hook
maturin_import_hook.install()
# Rust changes now rebuild automatically on import
Verify before relying
- Whether the hook works with all maturin project configurations or has known limitations with certain build setups.
- Performance impact of automatic rebuilds on large Rust codebases during development.
- Compatibility with different Python virtual environment managers beyond standard venv.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagesfilelocktomli |
| Maintenance | Actively maintained 432 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 99,072 / month, #13,040 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: RustTopic :: Software Development :: Build Tools |
Evidence: maturin_import_hook-0.3.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “maturin import hook”
- maturin-import-hookAutomatically rebuilds Rust components in maturin projects during…
- absolufy-importsAutomatically converts relative imports to absolute imports in Python…
- maturinMaturin builds and publishes Python packages containing Rust code…
Give your agent the search over MCP, or paste the wish link into any chat.
More Build Tools packages
Provides reusable utilities for Python packaging interoperability, including version handling, specifiers, markers, requirements, tags, and metadata parsing according to standards like PEP 440 and PEP 425.
Wraps any iterable to display a real-time progress bar in the terminal or Jupyter notebook, showing iteration count, elapsed time, and estimated time remaining.
pip is the standard installer for Python packages, enabling you to download and install packages from the Python Package Index and other indexes into your Python environment.
Hatchling is a standards-compliant Python build backend that handles packaging, metadata, and distribution of Python projects when configured in a project's pyproject.toml file.
Generates Python gRPC service stubs and message classes from Protocol Buffer definitions, enabling developers to build gRPC clients and servers.
pre-commit is a framework for installing and running git hooks written in any language before commits are made, automating code quality and validation checks across multi-language projects.
Install it if your team needs consistent, automated validation at commit time.
See also maturin · puccinialin · moviepilot-rust · setuptools-rust · delta-kernel-rust-sharing-wrapper · rustworkx · ignore-python · chia-rs · hogql-parser-rs