Skip to main content

nltbuild

PyPI version Python License: MIT

nltbuild 是面向 Python / 混合仓库的构建与发布辅助工具:根据项目结构自动选择构建策略(UV、Poetry、旧式 PyPI 脚本、package.json 前端包及混合模式等),串联版本递增、构建、安装校验、发布与 Git 标签等常见流程。

特性

  • 多构建策略:按仓库布局自动匹配 UVBuildPoetryBuildPypiBuildNpmFrontendBuildUvNpmHybridBuild 等实现,无需手写切换逻辑。
  • 版本同步:以根目录 pyproject.toml[project].version 为主源时,可将版本同步到仓内其它带 versionpyproject.tomlpackage.json(含子目录)。
  • 依赖与工具链:内置对 uvruff 等工具的调用约定;日志通过 nltlog,Shell 流程通过 funshell
  • Git 工作流pull / push / tags 等与远程协作;push 默认在提交阶段使用 aicommits 生成说明(需本机已安装该 CLI)。
  • 维护命令cleanclean_history 会改写 Git 状态或强制重写远程历史,使用前请确认团队规范与备份策略。

系统要求

  • Python 3.9+
  • Git(版本管理与标签推送)
  • 若使用 nltbuild push 的默认行为:本机需可用 aicommits(例如 npm install -g aicommits 并按其文档配置)

安装

从 PyPI 安装

pip install nltbuild

从源码安装

git clone https://github.com/farfarfun/nltbuild.git
cd nltbuild
pip install .

使用 uv 时,可在克隆后执行 uv syncuv pip install -e . 进行可编辑安装。

使用说明

在项目根目录执行 nltbuild 子命令(入口由 pyproject.toml[project.scripts] 注册为 nltbuild)。

版本

# 按内置策略自增并写回各清单文件
nltbuild upgrade

当前 CLI 未暴露「写入指定版本号」参数;需要固定版本时请直接编辑 pyproject.toml 等清单后再提交。

Git

nltbuild pull

# 默认按文件修改时间从旧到新排序,每 20 个文件生成一次提交,最后统一推送
nltbuild push

# 自定义每个提交的文件数
nltbuild push --batch-size 50

构建与发布

# 本地构建并安装 wheel、执行发布命令(依具体 Build 实现而定),随后 push 与打标签
nltbuild build

# 仅构建并安装到当前环境(不执行完整 publish + 推送流水线时,请直接调用底层工具,例如 uv build)
nltbuild install

nltbuild build 在基类实现中会依次触发:pullupgrade → 构建/安装/发布/清理 → pushtags。实际命令序列取决于选中的 Build 类型。

维护类(高风险)

# 清理 Git 缓存与索引(会生成提交)
nltbuild clean

# 清空标签并重写远程 master(破坏性操作,仅限明确需要「清历史」的仓库)
nltbuild clean_history

nltbuild tags

配置说明

  • Python 项目:在根目录 pyproject.toml 中维护 [project].version 与依赖;UV 类构建会读写该版本并同步到其它清单。
  • 纯前端 / 子包:在对应 package.json 中可使用 nltbuild 字段(对象或 true)扩展行为(例如自定义 build 命令、cleanDirs 等),具体逻辑见源码中 NpmFrontendBuild

构建类型的判定顺序见 src/nltbuild/core/registry.py 中的注册表;无需再使用旧文档中的 [tool.funbuild] 等虚构段名。

集成组件

  • uv — 包管理与构建
  • ruff — Lint / 格式化(按项目配置使用)
  • typertyper-slim)— CLI 框架
  • aicommits — 默认与 push 流水线集成的提交信息生成(以本机 CLI 为准)

仓库布局(摘要)

nltbuild/
├── src/
│   └── nltbuild/
│       ├── core/       # 构建注册与各策略实现
│       └── tool/       # 附加工具入口
├── pyproject.toml
└── README.md

参与贡献

  1. Fork nltbuild
  2. 新建分支并提交变更
  3. 发起 Pull Request

本地开发示例:

git clone https://github.com/farfarfun/nltbuild.git
cd nltbuild
uv pip install -e .
# 或: pip install -e .

ruff format .
ruff check . --fix

许可证

本项目以 MIT 许可证 发布。

链接

维护者

若 nltbuild 对你有帮助,欢迎点个 Star。

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

nltbuild-1.6.54-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

Details for the file nltbuild-1.6.54-py3-none-any.whl.

File metadata

  • Download URL: nltbuild-1.6.54-py3-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • 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":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for nltbuild-1.6.54-py3-none-any.whl
Algorithm Hash digest
SHA256 250a539e6088604e123637d76394c11abced8ee4d246e720db5bcef01418749b
MD5 82230d55e8c2c562e8504354f1f46ccc
BLAKE2b-256 5ea25994f4b64bca4d2758e387b2e97cf94082fe45279ad71998797c38790330

See more details on using hashes here.

Release history Release notifications | RSS feed

1.6.59

1 file

1.6.58

1 file

1.6.57

1 file

1.6.56

1 file

1.6.55

1 file

This release

1.6.54 This release

1 file

1.6.53

1 file

1.6.52

1 file

1.6.51

1 file

1.6.50

1 file

1.6.49

1 file

1.6.48

1 file

1.6.47

1 file

1.6.43

1 file

1.6.42

1 file

1.6.41

1 file

1.6.39

1 file

1.6.38

1 file

1.6.37

1 file

1.6.36

1 file

1.6.35

1 file

1.6.34

1 file

1.6.32

1 file

1.6.31

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page