Skip to main content

A C/C++ #include path normalizer that rewrites includes to resolve cleanly against a minimal -I set.

Project description

inclean

English | 简体中文

A C/C++ #include path normalizer.

Many legacy C/C++ libraries #include headers by bare filename (#include "bar.h") even though the actual header lives several directories deep (src/internal/bar.h). To consume such a library a caller must add every internal directory to their -I list — which pollutes their include namespace and breaks the library's encapsulation.

inclean does a one-shot, source-level normalization. It scans every source file in the library and rewrites each #include so it resolves cleanly against a small, explicit set of allowed include directories. After running inclean, consumers only -I the allowed directories.


Install

inclean is published to crates.io, PyPI, and as prebuilt binaries on GitHub Releases. Pick whichever ecosystem you already have on your machine.

Via PyPI (Python wheels — no Rust toolchain needed)

Three options:

uv tool install inclean      # isolated, fastest
pipx install inclean         # isolated
pip install inclean          # into the current environment

The wheels ship the native binary built by maturin; inclean lands on your PATH the same way ruff or uv do. Requires Python ≥ 3.8.

Via cargo

Two options:

cargo binstall inclean       # prebuilt binary from GitHub Releases (no compilation)
cargo install inclean        # build from crates.io

cargo binstall fetches inclean's binstall metadata from crates.io and downloads the matching prebuilt archive from this repo's GitHub Releases (no compilation). cargo binstall is a third-party cargo subcommand — install it first via cargo-bins/cargo-binstall if you don't already have it.

cargo install downloads the source from crates.io and compiles it locally.

Prebuilt binaries (no package manager)

Download a tarball for your platform from the latest GitHub Release and put inclean (or inclean.exe) on your PATH. Released targets:

  • x86_64-unknown-linux-gnu
  • aarch64-unknown-linux-gnu
  • x86_64-apple-darwin
  • aarch64-apple-darwin
  • x86_64-pc-windows-msvc

Quick start

inclean is driven by an inclean.toml placed at the root of the library you want to clean up. A typical workflow:

inclean init                # write a documented starter inclean.toml
$EDITOR inclean.toml        # tell it where your headers live
inclean check               # dry-run: report every proposed change
inclean diff                # see the rewrites as a unified diff
inclean apply               # write the rewrites in place

Every command except explain takes an optional [DIR] argument — the directory containing the root inclean.toml. It defaults to ..

Example

Take a "flat" library where headers live at include/mylib/internal/foo.h but internal #includes use just the basename. The fixture under tests/fixtures/flat-library/ ships this config:

[project]
root = "."

[[rule]]
name = "base"
paths = ["src/**", "include/**"]
forms = ["quote"]
allowed_include_dirs = ["include"]
original_include_dirs = ["include/mylib/internal"]

A source line #include "foo.h" is rewritten to #include "mylib/internal/foo.h" — so the consumer only needs -Iinclude.

Commands

Command Purpose
inclean init [DIR] Generate a documented starter inclean.toml. Refuses to overwrite.
inclean check [DIR] [-l/--level LEVEL] Read-only check at one of three depths. Never writes.
inclean diff [DIR] Print a unified diff of every proposed rewrite.
inclean apply [DIR] Apply rewrites in place. Refuses if any rule-tree conflict is present.
inclean explain FILE [INCLUDE] Trace, layer-by-layer, which rule matches a given #include — debugging aid.

inclean check runs at one of three levels (-l config | rules | full, default full). Each level is a strict superset of the previous; see docs/configuration.md for the full breakdown.

Documentation

  • docs/configuration.md — full inclean.toml schema: the five-layer matching model, inheritance, @std.* constants, actions, placeholders, exit codes.
  • docs/architecture.md — code-level architecture: module map, pipeline phases, key invariants.
  • CONTRIBUTING.md — toolchain, dev workflow, conventions, scope.
  • CHANGELOG.md — release history.

Status

0.1.1 — current. Includes a breaking change to the trailing_comment action schema; see CHANGELOG.md for the migration note. Feature-complete for v1.

License

BSD 3-Clause.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

inclean-0.1.1.tar.gz (96.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

inclean-0.1.1-py3-none-win_amd64.whl (1.5 MB view details)

Uploaded Python 3Windows x86-64

inclean-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

inclean-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.5 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

inclean-0.1.1-py3-none-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

inclean-0.1.1-py3-none-macosx_10_12_x86_64.whl (1.5 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file inclean-0.1.1.tar.gz.

File metadata

  • Download URL: inclean-0.1.1.tar.gz
  • Upload date:
  • Size: 96.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for inclean-0.1.1.tar.gz
Algorithm Hash digest
SHA256 30b4221a253f4c1efd11b92758c5833d1dbd48c2f0af796b789a74a98f8bea02
MD5 ec9f5fc439ee9ec61adb8510f7834eb9
BLAKE2b-256 b779bbacfe006f07fcec3dfe494ad3206d7fb89eaa090c132e1490dbdd13edac

See more details on using hashes here.

Provenance

The following attestation bundles were made for inclean-0.1.1.tar.gz:

Publisher: release.yml on inaku-Gyan/inclean

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file inclean-0.1.1-py3-none-win_amd64.whl.

File metadata

  • Download URL: inclean-0.1.1-py3-none-win_amd64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for inclean-0.1.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 b3d16e1a3d838d0d13d517ed213fa788512b2057a7be6a6b44a828fa5445b466
MD5 643b14a1682bae3a7d310a17d8954bb1
BLAKE2b-256 3cb1caefea0330d715a2499dee16f51ed519dd0fec25641bcaa84aa0a1a30468

See more details on using hashes here.

Provenance

The following attestation bundles were made for inclean-0.1.1-py3-none-win_amd64.whl:

Publisher: release.yml on inaku-Gyan/inclean

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file inclean-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for inclean-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7d000ad6f0e93af83cb3cdbb4eb1db65a9796ce3635f005cbbd06c8673bcff84
MD5 1edc35daa175a0b6d7d39187e188ef4e
BLAKE2b-256 829f0fc648d4bc081f3f7a015e1e7956ebe498d953b8fa1c1ae71bb015a5bcaf

See more details on using hashes here.

Provenance

The following attestation bundles were made for inclean-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on inaku-Gyan/inclean

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file inclean-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for inclean-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2e73650e72b8f1cd4ed59be7bffd3b8b83cac036723cce3571045c691f60a04f
MD5 a3a978fd5408f259936ec0d733bd1c6d
BLAKE2b-256 d263defaf2d8d142ae1ebb3061b5fc4f549a389a8e587e105627d591a423995b

See more details on using hashes here.

Provenance

The following attestation bundles were made for inclean-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on inaku-Gyan/inclean

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file inclean-0.1.1-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for inclean-0.1.1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 81d9956809b87312540ead13ceea1237419701e78bb75041e1b556b81cf9d224
MD5 e70b797cf1db3c139a3560a31299adac
BLAKE2b-256 c4d180c3ce1e53143745e29561bed57fec1426ea40bc536cafa9c71d138d125d

See more details on using hashes here.

Provenance

The following attestation bundles were made for inclean-0.1.1-py3-none-macosx_11_0_arm64.whl:

Publisher: release.yml on inaku-Gyan/inclean

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file inclean-0.1.1-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for inclean-0.1.1-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0704427e54628d2505e0f3167b09fbdaa526dc0cef300d8d859d515ac64c7704
MD5 a543959aa42ff4567587dcb3d0d13132
BLAKE2b-256 a4c06e7823305c1611240d02c83766f4402876b7962eee071ca699c85a67658c

See more details on using hashes here.

Provenance

The following attestation bundles were made for inclean-0.1.1-py3-none-macosx_10_12_x86_64.whl:

Publisher: release.yml on inaku-Gyan/inclean

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page