Skip to main content

Generate software copyright source-code materials from Git repositories.

Project description

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

生成规则

  • 文件列表来自 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

模板

内置模板:androidioswebnodepythonjavagogeneric

配置项支持软件名称、版本号、模板、包含/排除 glob、业务关键词、风险关键词、单文件最大行数、脱敏开关、页数和每页行数。

License

MIT License. See LICENSE.

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

srcdocgen-0.1.0.tar.gz (19.1 MB view details)

Uploaded Source

Built Distribution

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

srcdocgen-0.1.0-py3-none-any.whl (19.2 MB view details)

Uploaded Python 3

File details

Details for the file srcdocgen-0.1.0.tar.gz.

File metadata

  • Download URL: srcdocgen-0.1.0.tar.gz
  • Upload date:
  • Size: 19.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for srcdocgen-0.1.0.tar.gz
Algorithm Hash digest
SHA256 442ef44f14b3984774bc7b0a66a492f68113445ff1a6ecbf9f52e1e6e9a9bc36
MD5 426592979129e8fedbd47256a7e5de5f
BLAKE2b-256 d1a025d6e38892da46af24f2e4ea5688b9f27c47c29193d6e89b8bbecade0afd

See more details on using hashes here.

File details

Details for the file srcdocgen-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: srcdocgen-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for srcdocgen-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 976e718c0c8d328fceafc635123f4127271b864a432508a7ba6fed4c19591c93
MD5 edc7fa2cdcda1c8e79115f97fafe7e64
BLAKE2b-256 f4e4014ffdc6b2e7b7887a9a3bc34b04b708d5a178e3cc52d0f4d6e7e36fe633

See more details on using hashes here.

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