Generate software copyright source-code materials from Git repositories.
Project description
srcdocgen
软著源代码材料生成器。第一版提供可安装的 Python CLI/TUI 骨架,从 Git 仓库扫描被跟踪源码,剥离注释和空行,按模板给出文件纳入建议,并导出:
source-code.pdfsource-code.docxmanifest.json
安装与运行
完整使用流程见 使用指南。
pipx run srcdocgen --help
uv run srcdocgen --help
uv run srcdocgen init-config --repo ./project --template python --software-name "示例系统" --software-version "V1.0"
uv run srcdocgen --repo ./project
uv run srcdocgen generate --repo ./project --template python --out-dir ./softdoc
默认配置文件是目标仓库根目录下的 srcdocgen.toml。
发布
项目使用 GitHub Actions 自动发布版本。发布前先更新 pyproject.toml 中的 project.version,提交并推送到 main 后,创建并推送同名版本标签:
git tag v0.1.1
git push origin v0.1.1
推送 vX.Y.Z 标签会运行测试、构建 wheel/sdist、发布到 PyPI,并用同一批构建产物创建 GitHub Release。PyPI 发布使用 Trusted Publishing;PyPI 项目需要配置 GitHub publisher:owner ix64,repository srcdocgen,workflow release.yml,environment pypi。
生成规则
- 文件列表来自
git ls-files,不会修改目标仓库。 - 自动排除依赖目录、构建产物、测试文件、Markdown 文档、纯文本、数据文件、配置文件、规则文件、字体二进制、版本/依赖锁定文件、文件头带生成标记的文件和常见生成代码。
- 使用 Pygments token 剥离注释,避免误删字符串、URL、正则中的注释符号。
- PDF 使用 A4 页面、等宽字体、默认每页 50 行、共 60 页;短项目按实际行数生成页数。
- PDF 和 DOCX 页眉左侧会输出软件名称、版本号,右侧会输出
current / total格式页码,页眉和正文之间带横线。 - 当过滤后源码不足 3000 行时,生成全部可纳入源码并提示建议上传全部源代码;不会补空、不伪造代码。
- 当源码超过 3000 行时,按 PRD 取前 30 页连续源码和后 30 页连续源码。
- PDF 在缺少系统 CJK 字体时会使用内置 Noto Sans Mono CJK SC fallback;字体来源记录在
srcdocgen/assets/fonts/SOURCE.json。
模板
内置模板:android、ios、web、node、python、java、go、generic。
配置项支持软件名称、版本号、模板、包含/排除 glob、业务关键词、风险关键词、单文件最大行数、脱敏开关、页数和每页行数。
License
MIT License. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file srcdocgen-0.1.1.tar.gz.
File metadata
- Download URL: srcdocgen-0.1.1.tar.gz
- Upload date:
- Size: 19.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b3a78351deb0fbda1d5e78a0e74bae09e87f8369ae9f8cf05af00d0e322e737
|
|
| MD5 |
4d606e8fd84bb4a0000f182aa1dd669e
|
|
| BLAKE2b-256 |
dea0d93785a7cbcc075c1154abf58450386d942383790dbf8b1190aa4796a5b3
|
Provenance
The following attestation bundles were made for srcdocgen-0.1.1.tar.gz:
Publisher:
release.yml on ix64/srcdocgen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
srcdocgen-0.1.1.tar.gz -
Subject digest:
4b3a78351deb0fbda1d5e78a0e74bae09e87f8369ae9f8cf05af00d0e322e737 - Sigstore transparency entry: 1690697958
- Sigstore integration time:
-
Permalink:
ix64/srcdocgen@b7d2fe66a0827f1f0778d8d4b25b9649eb962ace -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/ix64
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b7d2fe66a0827f1f0778d8d4b25b9649eb962ace -
Trigger Event:
push
-
Statement type:
File details
Details for the file srcdocgen-0.1.1-py3-none-any.whl.
File metadata
- Download URL: srcdocgen-0.1.1-py3-none-any.whl
- Upload date:
- Size: 19.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ebb5b38ff616d425f064a638d9e2f7c240af2c420bfdbcb0f44e362acbe368b
|
|
| MD5 |
964f1bcad83cbb469c4c3c3c84189498
|
|
| BLAKE2b-256 |
9bf8b028d6e88ecb688b4171d5bfbf2be1b7189e223cc34c46fd0cd414247948
|
Provenance
The following attestation bundles were made for srcdocgen-0.1.1-py3-none-any.whl:
Publisher:
release.yml on ix64/srcdocgen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
srcdocgen-0.1.1-py3-none-any.whl -
Subject digest:
1ebb5b38ff616d425f064a638d9e2f7c240af2c420bfdbcb0f44e362acbe368b - Sigstore transparency entry: 1690697969
- Sigstore integration time:
-
Permalink:
ix64/srcdocgen@b7d2fe66a0827f1f0778d8d4b25b9649eb962ace -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/ix64
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b7d2fe66a0827f1f0778d8d4b25b9649eb962ace -
Trigger Event:
push
-
Statement type: