Skip to main content

Generates a professional PDF source code annex with Smart Index, Images and Emoji support.

Project description

📂 codeannex

Generates a professional PDF annex from a project's source code — featuring syntax highlighting, a hierarchical table of contents, image rendering, and version tracking.

🚀 Key Features

  • Interactive Wizard 2.0 — Step-by-step configuration with smart sections (Project, Style, Typography, Layout, Filters) and explicit default prompts.
  • Smart Emoji Support — Automatic discovery of standard emoji fonts (Segoe UI Emoji on Windows, DejaVu Sans on Linux).
  • Graceful Emoji Fallback — If no emoji font is found, it uses official Unicode names (e.g., [ROCKET]) for perfect readability.
  • Git Version Tracking — Automatically detects Repository URL, Branch, and Commit SHA. Smart root detection avoids Git metadata on subdirectories.
  • Smart SVG Rendering — Files are rendered as both a high-quality image and XML code. Entries are intelligently deduplicated in the summary.
  • Improved Document Structure — Subdirectories and their contents are listed before root files for better organization.
  • High-Contrast Design — Redesigned cover page, thickened image frames, and optimized line number legibility.
  • Intelligent Font Discovery — Automatically finds fonts from your system or custom directories via --font-path.
  • Flexible File Filtering — Multi-pattern include and exclude glob filters (e.g., --include "src/*" --exclude "tests/*").
  • Pro-Level UI — Control paper size (mm), margins (cm), accent colors (HEX), and font sizes.

🛠 Installation

The recommended way to install codeannex is via pipx:

pipx install codeannex

For full SVG support (required for crisp line numbers and SVG image rendering):

pipx install "codeannex[svg]"

Note: For best emoji rendering on Linux, you may want to install fonts-noto-color-emoji or ttf-dejavu.

📖 Usage

Interactive Mode (Wizard)

Simply run without arguments to start the configuration:

python3 -m codeannex

Automation / CI

python3 -m codeannex . \
  --cover-title "Technical Annex" \
  --primary-color "#0f4761" \
  --code-size 9 \
  --include "src/*" \
  --exclude "*.log" \
  --no-input

Default output filename is {project_name}_code_annex.pdf.

⚙️ Configuration Options

Git & Metadata

  • --repo-url URL — Manual repository URL.
  • --branch NAME — Manual branch name.
  • --no-git — Force disable Git integration.
  • --repo-label LABEL — Label for repo (default: "Repository: ").

File Selection

  • --include PATTERN — Include glob pattern (can be used multiple times).
  • --exclude PATTERN — Exclude glob pattern (can be used multiple times).

Design & Layout

  • --page-width MM / --page-height MM — Custom paper size in mm (default: A4).
  • --margin CM — General margin (top, bottom, left, right).
  • --primary-color HEX — Accent color for headers, summary icons, and links.
  • --code-size N — Font size for code and line numbers.

Fonts

  • --font-path PATH — Additional directory to search for .ttf/.otf files.
  • --title-font / --normal-font / --mono-font — System font names.
  • --emoji-font NAME — Custom font for emojis.
  • --emoji-description — Force textual descriptions (e.g., [GRINNING FACE]) instead of glyphs.

🧪 Testing

PYTHONPATH=. pytest tests --cov=codeannex

📄 License

MIT

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

codeannex-0.4.4.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

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

codeannex-0.4.4-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

Details for the file codeannex-0.4.4.tar.gz.

File metadata

  • Download URL: codeannex-0.4.4.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for codeannex-0.4.4.tar.gz
Algorithm Hash digest
SHA256 6c531a514418c92f4c70ce277a5d91d1e16e53c4cdfa9d38de69e808c0b0f239
MD5 fb3d582402a0205324798b939c51296e
BLAKE2b-256 8c001dfcffd0403252c8a0feb48b2f13f49b7ab2b11903619459cea31b80476a

See more details on using hashes here.

Provenance

The following attestation bundles were made for codeannex-0.4.4.tar.gz:

Publisher: publish.yml on tanhleno/codeannex

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

File details

Details for the file codeannex-0.4.4-py3-none-any.whl.

File metadata

  • Download URL: codeannex-0.4.4-py3-none-any.whl
  • Upload date:
  • Size: 24.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for codeannex-0.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b0debadd6b9704f6ab7d59c774df45a9559809dc91c1083cc03a7c40f42ed067
MD5 20f1fd6dda18ffb6815403c3d5546516
BLAKE2b-256 dc236e402ca6b55018c3f7b3609ce5354b1acb6220fe0c7c8a34ff65f5ad7445

See more details on using hashes here.

Provenance

The following attestation bundles were made for codeannex-0.4.4-py3-none-any.whl:

Publisher: publish.yml on tanhleno/codeannex

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