codeannex 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- codeannex/__init__.py +0 -0
- codeannex/__main__.py +157 -0
- codeannex/config.py +65 -0
- codeannex/file_utils.py +116 -0
- codeannex/fonts.py +271 -0
- codeannex/highlight.py +21 -0
- codeannex/pdf_builder.py +446 -0
- codeannex/text_utils.py +128 -0
- codeannex-0.1.1.dist-info/METADATA +147 -0
- codeannex-0.1.1.dist-info/RECORD +14 -0
- codeannex-0.1.1.dist-info/WHEEL +5 -0
- codeannex-0.1.1.dist-info/entry_points.txt +2 -0
- codeannex-0.1.1.dist-info/licenses/LICENSE +21 -0
- codeannex-0.1.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: codeannex
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Generates a professional PDF source code annex with Smart Index, Images and Emoji support.
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Repository, https://github.com/tanhleno/codeannex
|
|
7
|
+
Keywords: pdf,source-code,documentation,annex,reportlab,emoji
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: Documentation
|
|
17
|
+
Classifier: Topic :: Software Development :: Documentation
|
|
18
|
+
Requires-Python: >=3.11
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: reportlab>=4.0
|
|
22
|
+
Requires-Dist: Pillow>=10.0
|
|
23
|
+
Requires-Dist: Pygments>=2.16
|
|
24
|
+
Requires-Dist: pdfminer.six>=20231228
|
|
25
|
+
Provides-Extra: svg
|
|
26
|
+
Requires-Dist: cairosvg>=2.7; extra == "svg"
|
|
27
|
+
Requires-Dist: svglib>=1.5; extra == "svg"
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# 📂 codeannex
|
|
33
|
+
|
|
34
|
+
Generates a professional PDF annex from a project's source code — with syntax highlighting, a clickable table of contents, image rendering, non-selectable line numbers, and configurable fonts.
|
|
35
|
+
|
|
36
|
+
## Features
|
|
37
|
+
|
|
38
|
+
- **Syntax highlighting** via Pygments (Catppuccin Mocha theme)
|
|
39
|
+
- **Clickable table of contents** with page numbers (two-pass layout)
|
|
40
|
+
- **Smart word wrap** — breaks at word boundaries, respects emoji codepoints
|
|
41
|
+
- **Non-selectable line numbers** rendered as images
|
|
42
|
+
- **Image support** — embeds PNG, JPG, GIF, WebP, BMP, ICO, and SVG files
|
|
43
|
+
- **Git-aware** — uses `git ls-files` when available; falls back to manual `.gitignore` parsing
|
|
44
|
+
- **Cross-platform font discovery** — finds monospace and emoji fonts on Windows, macOS, and Linux
|
|
45
|
+
- **Emoji support** — configurable fonts for emojis, with fallback for better rendering.
|
|
46
|
+
- *Tip for Linux:* Install `fonts-symbola` for high-coverage monochromatic emoji support that works reliably with ReportLab.
|
|
47
|
+
- **Emoji descriptions** — option to print `[EMOJI NAME]` instead of glyphs for systems without emoji fonts.
|
|
48
|
+
- **Configurable fonts** — customize normal, bold, monospace, and emoji fonts.
|
|
49
|
+
- **Page numbering** — customizable font size and position.
|
|
50
|
+
- **Repository Link** — show a clickable repository link on the cover page.
|
|
51
|
+
- **Fast binary file detection** — quickly ignores common binary extensions.
|
|
52
|
+
|
|
53
|
+
## Requirements
|
|
54
|
+
|
|
55
|
+
- Python >= 3.11
|
|
56
|
+
- `reportlab`, `Pillow`, `Pygments`
|
|
57
|
+
|
|
58
|
+
Optional SVG rendering (install at least one):
|
|
59
|
+
- `cairosvg` (preferred)
|
|
60
|
+
- `svglib`
|
|
61
|
+
|
|
62
|
+
For development and testing:
|
|
63
|
+
- `pytest` (install with `pip install -e ".[dev]"`)
|
|
64
|
+
|
|
65
|
+
## Installation
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pip install codeannex
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
With SVG support:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
pip install "codeannex[svg]"
|
|
75
|
+
```
|
|
76
|
+
## Requirements
|
|
77
|
+
|
|
78
|
+
- Python >= 3.11
|
|
79
|
+
- `reportlab`, `Pillow`, `Pygments`, `pdfminer.six`
|
|
80
|
+
|
|
81
|
+
Optional SVG rendering (install at least one):
|
|
82
|
+
...
|
|
83
|
+
## Usage
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Annotate current directory
|
|
87
|
+
codeannex
|
|
88
|
+
|
|
89
|
+
# Annotate a specific project
|
|
90
|
+
codeannex /path/to/project
|
|
91
|
+
|
|
92
|
+
# Custom output filename
|
|
93
|
+
codeannex /path/to/project -o my_annex.pdf
|
|
94
|
+
|
|
95
|
+
# Customized configuration (margins in cm)
|
|
96
|
+
codeannex /path/to/project \
|
|
97
|
+
--name "My Project" \
|
|
98
|
+
--repo-url "https://github.com/user/repo" \
|
|
99
|
+
--margin 1.5 \
|
|
100
|
+
--margin-top 2.5 \
|
|
101
|
+
--page-number-size 10 \
|
|
102
|
+
--show-project
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Configuration Options
|
|
106
|
+
|
|
107
|
+
- `--name NAME` — Custom project name (default: directory name).
|
|
108
|
+
- `--repo-url URL` — Repository URL to show as a clickable link on the cover.
|
|
109
|
+
- `--start-page N` — Starting page number (default: 1).
|
|
110
|
+
- `--margin CM` — General margin in cm for all sides.
|
|
111
|
+
- `--margin-left CM` — Left margin in cm (default: 1.5).
|
|
112
|
+
- `--margin-right CM` — Right margin in cm (default: 1.5).
|
|
113
|
+
- `--margin-top CM` — Top margin in cm (default: 2.0).
|
|
114
|
+
- `--margin-bottom CM` — Bottom margin in cm (default: 2.0).
|
|
115
|
+
- `--show-project` — Show project name in page footer (default: off).
|
|
116
|
+
- `--page-number-size N` — Font size for page numbers (default: 8).
|
|
117
|
+
- `--normal-font FONT` — Font for normal text (default: Helvetica).
|
|
118
|
+
- `--bold-font FONT` — Font for bold text (default: Helvetica-Bold).
|
|
119
|
+
- `--mono-font FONT` — Monospace font for code (default: auto-detect).
|
|
120
|
+
- `--emoji-font FONT` — Font for emojis (default: auto-detect).
|
|
121
|
+
- `--emoji-description` — Print `[DESCRIPTION]` instead of emoji glyphs.
|
|
122
|
+
- `--check-emoji-font` — Check current emoji font style and exit.
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
## Testing
|
|
126
|
+
|
|
127
|
+
Run the test suite with pytest:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
pytest
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Output
|
|
134
|
+
|
|
135
|
+
The generated PDF contains:
|
|
136
|
+
|
|
137
|
+
1. **Cover page** — project name with page number
|
|
138
|
+
2. **Table of contents** — tree-structured, with clickable links to each file
|
|
139
|
+
3. **File pages** — syntax-highlighted source, with file path headers and line numbers
|
|
140
|
+
|
|
141
|
+
Files are ordered: root files first (alphabetical), then directories recursively (alphabetical).
|
|
142
|
+
|
|
143
|
+
Binary files (e.g., .pdf, .exe) are automatically ignored with warnings if not in .gitignore.
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
MIT
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
codeannex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
codeannex/__main__.py,sha256=_4uZKaXNXOEnFBXVbpBV0GbQH5nKGck4thDzs7Kr-O0,6882
|
|
3
|
+
codeannex/config.py,sha256=SjvoOLbyoboe7vQWzCKG0T0dOxTyYgCpnRcdvyiBns4,2853
|
|
4
|
+
codeannex/file_utils.py,sha256=ABo5fZXSjx56iRuH0secM_9kHu2uHUBY1KZp8HiXRr0,4423
|
|
5
|
+
codeannex/fonts.py,sha256=rGb_iEebovAYrhHdk83tU0EviqEHIpfzYZPi-_xVgII,9624
|
|
6
|
+
codeannex/highlight.py,sha256=3wAXeFn2d60YY4W9GIXtC0r5QxNjPTOtyKWeHo0MBZA,602
|
|
7
|
+
codeannex/pdf_builder.py,sha256=FEf-s-h8YnKWpVZ5no4MHRlYi6sHfRRAlm9RafKEXPk,20600
|
|
8
|
+
codeannex/text_utils.py,sha256=tgIH5Qtu3hAswUHkipnWf6-LMV3b2Mt6IPgv7Po7AOM,5380
|
|
9
|
+
codeannex-0.1.1.dist-info/licenses/LICENSE,sha256=gfz2fEQx_KbzZUIsJMctbuixaITXXl9_Q6uKuoB5Sl0,1083
|
|
10
|
+
codeannex-0.1.1.dist-info/METADATA,sha256=WBTcK1A-8Os7PjBnZCX2q2lwqmUoFnjpchY_FeD1KqM,5094
|
|
11
|
+
codeannex-0.1.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
12
|
+
codeannex-0.1.1.dist-info/entry_points.txt,sha256=xlUIEdNxk24viV-kCqMmN-eJ2ahMu7QGPnwqz7A1ofg,54
|
|
13
|
+
codeannex-0.1.1.dist-info/top_level.txt,sha256=AZs8rICsPbgAe4_7pAHKgqEDw378hWwKk8jZDdgFSs4,10
|
|
14
|
+
codeannex-0.1.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tanhleno Teixeira de Sousa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
codeannex
|