Skip to main content

srcdocgen

软著源代码材料生成器。第一版提供可安装的 Python CLI/TUI 骨架,从 Git 仓库扫描被跟踪源码,剥离注释和空行,按模板给出文件纳入建议,并导出:

  • source-code.pdf
  • source-code.docx
  • manifest.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.

Release files for srcdocgen 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for srcdocgen 0.1.1
File Size Uploaded
srcdocgen-0.1.1.tar.gz 19.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for srcdocgen 0.1.1
File Interpreter ABI Platform
srcdocgen-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 38.3 MB

Release files / srcdocgen-0.1.1.tar.gz

Download URL srcdocgen-0.1.1.tar.gz
Size 19.1 MB
Tags Source
SHA-256 checksum
How to use checksums
4b3a78351deb0fbda1d5e78a0e74bae09e87f8369ae9f8cf05af00d0e322e737
BLAKE2b-256 checksum
How to use checksums
dea0d93785a7cbcc075c1154abf58450386d942383790dbf8b1190aa4796a5b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

Release files / srcdocgen-0.1.1-py3-none-any.whl

Download URL srcdocgen-0.1.1-py3-none-any.whl
Size 19.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
1ebb5b38ff616d425f064a638d9e2f7c240af2c420bfdbcb0f44e362acbe368b
BLAKE2b-256 checksum
How to use checksums
9bf8b028d6e88ecb688b4171d5bfbf2be1b7189e223cc34c46fd0cd414247948
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page