From 60ffc3fd147855ce7191eb431bc219623599f422 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Thu, 25 Jun 2026 17:14:54 -0400 Subject: [PATCH 1/3] chore(python): Add project optional dependency extras Expose dev, c, lint, locale, and test extras in `pyproject.toml` and update `uv.lock` metadata so the dependency groups are installable as package extras. --- pyproject.toml | 29 +++++++++++++++++++++++++++++ uv.lock | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index c1e084b..cb2213a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,35 @@ authors = [ ] dependencies = [] +[project.optional-dependencies] +dev = [ + "lizardbyte-common[c]", + "lizardbyte-common[lint-python]", + "lizardbyte-common[test-python]", +] +c = [ + "lizardbyte-common[lint-c]", + "lizardbyte-common[locale]", + "lizardbyte-common[test-c]", +] +lint-c = [ + "clang-format==21.1.8", + "cmakelang==0.6.13", +] +lint-python = [ + "flake8==7.3.0", +] +locale = [ + "babel==2.18.0", +] +test-c = [ + "gcovr==8.6", +] +test-python = [ + "pytest==9.0.3", + "pytest-cov==7.1.0", +] + [dependency-groups] dev = [ {include-group = "c"}, diff --git a/uv.lock b/uv.lock index 229aa6d..acea930 100644 --- a/uv.lock +++ b/uv.lock @@ -163,6 +163,40 @@ name = "lizardbyte-common" version = "0.0.0" source = { editable = "." } +[package.optional-dependencies] +c = [ + { name = "babel" }, + { name = "clang-format" }, + { name = "cmakelang" }, + { name = "gcovr" }, +] +dev = [ + { name = "babel" }, + { name = "clang-format" }, + { name = "cmakelang" }, + { name = "flake8" }, + { name = "gcovr" }, + { name = "pytest" }, + { name = "pytest-cov" }, +] +lint-c = [ + { name = "clang-format" }, + { name = "cmakelang" }, +] +lint-python = [ + { name = "flake8" }, +] +locale = [ + { name = "babel" }, +] +test-c = [ + { name = "gcovr" }, +] +test-python = [ + { name = "pytest" }, + { name = "pytest-cov" }, +] + [package.dev-dependencies] c = [ { name = "babel" }, @@ -198,6 +232,22 @@ test-python = [ ] [package.metadata] +requires-dist = [ + { name = "babel", marker = "extra == 'locale'", specifier = "==2.18.0" }, + { name = "clang-format", marker = "extra == 'lint-c'", specifier = "==21.1.8" }, + { name = "cmakelang", marker = "extra == 'lint-c'", specifier = "==0.6.13" }, + { name = "flake8", marker = "extra == 'lint-python'", specifier = "==7.3.0" }, + { name = "gcovr", marker = "extra == 'test-c'", specifier = "==8.6" }, + { name = "lizardbyte-common", extras = ["c"], marker = "extra == 'dev'" }, + { name = "lizardbyte-common", extras = ["lint-c"], marker = "extra == 'c'" }, + { name = "lizardbyte-common", extras = ["lint-python"], marker = "extra == 'dev'" }, + { name = "lizardbyte-common", extras = ["locale"], marker = "extra == 'c'" }, + { name = "lizardbyte-common", extras = ["test-c"], marker = "extra == 'c'" }, + { name = "lizardbyte-common", extras = ["test-python"], marker = "extra == 'dev'" }, + { name = "pytest", marker = "extra == 'test-python'", specifier = "==9.0.3" }, + { name = "pytest-cov", marker = "extra == 'test-python'", specifier = "==7.1.0" }, +] +provides-extras = ["dev", "c", "lint-c", "lint-python", "locale", "test-c", "test-python"] [package.metadata.requires-dev] c = [ From 53c79a55dbbbfc63e4db61c811402851dcd84b55 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Thu, 25 Jun 2026 17:22:15 -0400 Subject: [PATCH 2/3] Convert scripts to CLI entry points Register `lizardbyte-localize` and `lizardbyte-update-clang-format` as project script entry points in pyproject.toml. Update workflows and documentation to use the CLI commands instead of invoking Python scripts directly. Add scripts package initialization. This makes the scripts installable as standard CLI tools. --- .github/workflows/localize.yml | 5 ++--- README.md | 4 ++-- pyproject.toml | 6 +++++- scripts/__init__.py | 1 + 4 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 scripts/__init__.py diff --git a/.github/workflows/localize.yml b/.github/workflows/localize.yml index fbb96f1..9489183 100644 --- a/.github/workflows/localize.yml +++ b/.github/workflows/localize.yml @@ -58,8 +58,7 @@ jobs: run: | uv sync --project .lizardbyte-common --frozen --only-group locale \ --python "${PYTHON_VERSION}" \ - --no-python-downloads \ - --no-install-project + --no-python-downloads - name: Set up xgettext run: | @@ -87,7 +86,7 @@ jobs: echo "NEW_FILE=${new_file}" >> "${GITHUB_ENV}" uv run --project .lizardbyte-common --frozen --only-group locale --no-sync \ - python .lizardbyte-common/scripts/localize.py --root-dir "${GITHUB_WORKSPACE}" --extract + lizardbyte-localize --root-dir "${GITHUB_WORKSPACE}" --extract - name: git diff if: env.NEW_FILE == 'false' diff --git a/README.md b/README.md index a07fe43..ea19b83 100644 --- a/README.md +++ b/README.md @@ -29,13 +29,13 @@ uv sync --locked Run the clang-format helper: ```bash -uv run --locked python scripts/update_clang_format.py +uv run --locked --only-group c lizardbyte-update-clang-format ``` Run gettext extraction: ```bash -uv run --locked --only-group locale python scripts/localize.py --extract +uv run --locked --only-group locale lizardbyte-localize --extract ``` ## Workflows diff --git a/pyproject.toml b/pyproject.toml index cb2213a..b1a3ce3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,10 @@ authors = [ ] dependencies = [] +[project.scripts] +lizardbyte-localize = "scripts.localize:main" +lizardbyte-update-clang-format = "scripts.update_clang_format:main" + [project.optional-dependencies] dev = [ "lizardbyte-common[c]", @@ -77,7 +81,7 @@ Repository = "https://github.com/LizardByte/lizardbyte-common" Issues = "https://github.com/LizardByte/lizardbyte-common/issues" [tool.setuptools] -py-modules = [] +packages = ["scripts"] [tool.pytest.ini_options] testpaths = ["tests"] diff --git a/scripts/__init__.py b/scripts/__init__.py new file mode 100644 index 0000000..4f558a7 --- /dev/null +++ b/scripts/__init__.py @@ -0,0 +1 @@ +"""Shared LizardByte command modules.""" From 8631b3073cb73da85a1c108ef7d0a41caa2195bc Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Thu, 25 Jun 2026 17:28:18 -0400 Subject: [PATCH 3/3] Rename CLI scripts to lb-* commands Update the Python entry points from `lizardbyte-*` to `lb-*`, switch the localization workflow to use the new command name, and refresh README usage examples accordingly. The README now also documents how consuming projects can use this repo as a local path dependency with uv (with and without a `pyproject.toml`). --- .github/workflows/localize.yml | 2 +- README.md | 42 ++++++++++++++++++++++++++++++++-- pyproject.toml | 4 ++-- 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/.github/workflows/localize.yml b/.github/workflows/localize.yml index 9489183..7fe31a7 100644 --- a/.github/workflows/localize.yml +++ b/.github/workflows/localize.yml @@ -86,7 +86,7 @@ jobs: echo "NEW_FILE=${new_file}" >> "${GITHUB_ENV}" uv run --project .lizardbyte-common --frozen --only-group locale --no-sync \ - lizardbyte-localize --root-dir "${GITHUB_WORKSPACE}" --extract + lb-localize --root-dir "${GITHUB_WORKSPACE}" --extract - name: git diff if: env.NEW_FILE == 'false' diff --git a/README.md b/README.md index ea19b83..728bc0b 100644 --- a/README.md +++ b/README.md @@ -29,13 +29,51 @@ uv sync --locked Run the clang-format helper: ```bash -uv run --locked --only-group c lizardbyte-update-clang-format +uv run --locked --only-group c lb-update-clang-format ``` Run gettext extraction: ```bash -uv run --locked --only-group locale lizardbyte-localize --extract +uv run --locked --only-group locale lb-localize --extract +``` + +## Consuming Projects + +Projects with a `pyproject.toml` can use this repository as a local path dependency. For a submodule at +`third-party/lizardbyte-common`, add the dependency and source to the consuming project's `pyproject.toml`: + +```toml +[project] +dependencies = [ + "lizardbyte-common[c]", +] + +[tool.uv.sources] +lizardbyte-common = { path = "third-party/lizardbyte-common" } +``` + +Then sync and run the installed commands from the consuming project root: + +```bash +uv sync --python 3.14 +uv run lb-update-clang-format +uv run lb-localize --extract +``` + +Projects without a `pyproject.toml` can still create a `.venv` in the consuming project root and install +the local checkout into it: + +```bash +uv venv --python 3.14 +uv pip install --editable "third-party/lizardbyte-common[c]" +``` + +Then run the commands from the consuming project root: + +```bash +lb-update-clang-format +lb-localize --extract ``` ## Workflows diff --git a/pyproject.toml b/pyproject.toml index b1a3ce3..6b74937 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,8 +14,8 @@ authors = [ dependencies = [] [project.scripts] -lizardbyte-localize = "scripts.localize:main" -lizardbyte-update-clang-format = "scripts.update_clang_format:main" +lb-localize = "scripts.localize:main" +lb-update-clang-format = "scripts.update_clang_format:main" [project.optional-dependencies] dev = [