Skip to main content

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

Project description

inclean

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

From source (Rust 1.91+):

cargo install --path .

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 — feature-complete for v1. See CHANGELOG.md.

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.0.tar.gz (92.0 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.0-py3-none-win_amd64.whl (1.5 MB view details)

Uploaded Python 3Windows x86-64

inclean-0.1.0-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.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.5 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

inclean-0.1.0-py3-none-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

inclean-0.1.0-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.0.tar.gz.

File metadata

  • Download URL: inclean-0.1.0.tar.gz
  • Upload date:
  • Size: 92.0 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.0.tar.gz
Algorithm Hash digest
SHA256 89ea8719f24df81acf31d26990cbba53ed6e646a278a995e02b4c4a93ff1696a
MD5 dad997333bf448b3d8abc0058f5eeada
BLAKE2b-256 1f918cb60c8a2a2fd3fc40af20d1a0ab44d067540ea1e3cb48ab083951eb19f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for inclean-0.1.0.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.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: inclean-0.1.0-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.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 f65af4399ff11fb3eb270c41bff44c2ff09bccb6022b33e124507fe00c8cc7ca
MD5 8341a39be70e45f0701ecce3b3362f60
BLAKE2b-256 e3cdb33604e1bcb7d9b736c4c34c6f1f0f71727e5b617af18a37a028e023349f

See more details on using hashes here.

Provenance

The following attestation bundles were made for inclean-0.1.0-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.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for inclean-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4648962ea299b9b2faf5fff663a2b0a4406514f6ed1094c80ae88ada4042763c
MD5 637958e81d2c4a999045747b4c754564
BLAKE2b-256 1ac6245bdbe556bd67523ced7cddeaab08521df261352779661fa9768e9358b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for inclean-0.1.0-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.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for inclean-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 08864959485b14015e27a4ee037bd220a203ff02ab8557d897e3a03603beda5c
MD5 fa64e1cc4e46688f3595c434d76984f8
BLAKE2b-256 f337091bbf6dcfb0b117bb1055a0b86ef82fb8904bf433fb6632c34b53a57e69

See more details on using hashes here.

Provenance

The following attestation bundles were made for inclean-0.1.0-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.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for inclean-0.1.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d951ec74ba261cb5ecff24fadecdaac0db01ae669e21709763c22c359f5b5014
MD5 cb48f54802105698409161d06dcc7bad
BLAKE2b-256 24e4eded506433e7321ab62c26b5155b32b79d19aee088405bfe3fb017e2cf3f

See more details on using hashes here.

Provenance

The following attestation bundles were made for inclean-0.1.0-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.0-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for inclean-0.1.0-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b4e22e687a424161d2a82e820d6fa27876a6a6856bf9f03a10abbf515a5029a4
MD5 d0dced3f1cae1ac9320426675689a165
BLAKE2b-256 69ecd6362ff2304e51000b22562a3056597e4f40c69c25bc05615071bd326fcc

See more details on using hashes here.

Provenance

The following attestation bundles were made for inclean-0.1.0-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