From 6ee7143e5d1b0f99a05b649ead533c059a0c8c1e Mon Sep 17 00:00:00 2001 From: danielcristho Date: Thu, 26 Feb 2026 18:12:36 +0700 Subject: [PATCH 01/11] ci: add pre-commit --- .github/workflows/check.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/check.yml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..9adef0c --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,20 @@ +name: Pre-Commit +on: + pull_request: + branches: [main] + workflow_dispatch: + workflow_call: + +permissions: + contents: write + pull-requests: write + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.13" + - uses: pre-commit/action@v3.0.0 \ No newline at end of file From 9fe1c37d834e0983e3348c45b0804f3cefb23ddb Mon Sep 17 00:00:00 2001 From: danielcristho Date: Thu, 26 Feb 2026 18:17:17 +0700 Subject: [PATCH 02/11] ci: add pytest --- .github/workflows/test.yml | 73 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..d4f56a0 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,73 @@ +name: PyTest +on: + workflow_call: + workflow_dispatch: + push: + branches: + - main + pull_request: + paths: + - ".github/workflows/test.yml" + - "render_engine_api/**" + - "tests/**" + - "pyproject.toml" + # - "requirements.txt" + +jobs: + gen-coverage-badge: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: astral-sh/setup-uv@v7 + with: + python-version: "3.14" + enable-cache: true + + - name: run coverage and generate cov-report + run: | + uv run --dev pytest --cov-report xml + - name: genbadge coverage + run: | + uvx --with "genbadge[coverage]" genbadge coverage -i coverage.xml + - name: Commit Badge + uses: stefanzweifel/git-auto-commit-action@v7 + with: + commit_message: Update coverage badge [skip ci] + file_pattern: coverage.svg + + test-against-python-matrix: + # Only test all the supported versions when a pull request is made or the workflow is called + if: ${{github.event_name == 'workflow_call'}} || ${{github.event_name == 'pull_request'}} + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10", "3.11", "3.12", "3.13"] + fail-fast: true + steps: + - uses: actions/checkout@v6.0.1 + - name: Install uv + uses: astral-sh/setup-uv@v7 + with: + python-version: ${{ matrix.python-version }} + enable-cache: true # caching dependencies + - name: Run tests + run: | + uv run --dev pytest tests + + test-against-latest-os: + # Always run against the latest version on both Windows, Linux, MacOS + if: github.event.pull_request.user.login != 'dependabot[bot]' + strategy: + matrix: + os: [windows-latest, macos-latest] + fail-fast: true + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v6.0.1 + - name: Install uv + uses: astral-sh/setup-uv@v7 + with: + python-version: "3.14" + enable-cache: true # caching dependencies + - name: run tests + run: uv run --dev pytest tests \ No newline at end of file From ee13c0774bd5109eabc94636b24423e95fe2d08b Mon Sep 17 00:00:00 2001 From: danielcristho Date: Thu, 26 Feb 2026 18:21:57 +0700 Subject: [PATCH 03/11] ci: update pre-commit --- .github/workflows/check.yml | 13 ++++++++----- .github/workflows/test.yml | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 9adef0c..1aeeff9 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,10 +1,13 @@ name: Pre-Commit on: - pull_request: - branches: [main] - workflow_dispatch: workflow_call: - + workflow_dispatch: + push: + branches: + - main + pull_request: + branches: + - main permissions: contents: write pull-requests: write @@ -17,4 +20,4 @@ jobs: - uses: actions/setup-python@v5 with: python-version: "3.13" - - uses: pre-commit/action@v3.0.0 \ No newline at end of file + - uses: pre-commit/action@v3.0.0 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d4f56a0..c033965 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ on: - "render_engine_api/**" - "tests/**" - "pyproject.toml" - # - "requirements.txt" + - "requirements.txt" jobs: gen-coverage-badge: @@ -70,4 +70,4 @@ jobs: python-version: "3.14" enable-cache: true # caching dependencies - name: run tests - run: uv run --dev pytest tests \ No newline at end of file + run: uv run --dev pytest tests From 04eea2ecb2433992a1aefee70355170981f106d9 Mon Sep 17 00:00:00 2001 From: danielcristho Date: Thu, 5 Mar 2026 11:16:34 +0700 Subject: [PATCH 04/11] chore: update just recipe --- .pre-commit-config.yaml | 8 ++-- justfile | 81 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 justfile diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c4b541b..d09345f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,13 +1,13 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.3.0 + rev: v6.0.0 hooks: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.15.1 + rev: v0.15.4 hooks: # Run the linter. - id: ruff-check @@ -16,12 +16,12 @@ repos: - id: ruff-format - repo: https://github.com/allganize/ty-pre-commit # Ty version. - rev: v0.0.17 + rev: v0.0.20 hooks: # Run the type checker. - id: ty-check - repo: https://github.com/DavidAnson/markdownlint-cli2 - rev: v0.6.0 + rev: v0.21.0 hooks: - id: markdownlint-cli2 - repo: local diff --git a/justfile b/justfile new file mode 100644 index 0000000..d8e21a2 --- /dev/null +++ b/justfile @@ -0,0 +1,81 @@ +# Render Engine API - Just recipes +# Run tasks with: just + +DEFAULT_PYTHON_VERSION := "3.14" + +# Default recipe to display available commands +default: + @just --list + +# Sync dependencies using uv +sync: + uv sync --dev + +# Run pytest +test *FLAGS='': + pytest {{ DEFAULT_PYTHON_VERSION }} {{ FLAGS }} + +# Install pre-commit hooks +pre-commit-install: + uvx pre-commit install + +# Run pre-commit on all files +pre-commit: + uvx pre-commit run --all-files + +# Run pre-commit on staged files (default git behavior) +pre-commit-run: + uvx pre-commit run + +# Update pre-commit hook versions +pre-commit-update: + uvx pre-commit autoupdate + +# Run tests in arbitrary Python version. +pytest VERSION *FLAGS='': + uv run -p {{ VERSION }} --dev pytest {{ FLAGS }} + +# Run pytest with coverage report (defaults to XML) +test-cov-report REPORT='xml': + uv run --dev pytest --cov-report={{ REPORT }} + +# Run all nox sessions +nox: + uvx nox + +# Run ruff linter without fixing +lint DIRECTORY='.': + uvx ruff check {{ DIRECTORY }} + +# Run ruff linter with auto-fix +lint-fix DIRECTORY='.': + uvx ruff check --fix {{ DIRECTORY }} + +# Run ruff formatter as check +format DIRECTORY='.': + uvx ruff format --check {{ DIRECTORY }} + +# Run ruff formatter and fix issues +format-fix DIRECTORY='.': + uvx ruff format --check {{ DIRECTORY }} + +ruff: lint format + +# Run both linter and formatter, fixing issues. +ruff-fix DIRECTORY='.': + @# Prefacing with `-` to ignore any errors that might be fixed by formatting. + -uvx ruff check --fix {{ DIRECTORY }} + uvx ruff format {{ DIRECTORY }} + uvx ruff check {{ DIRECTORY }} + @echo "\nEverything looks good!" + +# Run ty type checker +ty PATH='src': + uv run ty check {{ PATH }} # For the moment we have way too many issues in ty so not having it fail. + +# Generate coverage badge +badge: (test-cov-report 'xml') + uvx --with "genbadge[coverage]" genbadge coverage -i coverage.xml + +# Run full CI workflow (sync, lint, test, badge) +ci: sync nox ruff ty badge From 243029a65ab46e8ceb85982951cd2ac9cb247b16 Mon Sep 17 00:00:00 2001 From: danielcristho Date: Thu, 5 Mar 2026 11:22:25 +0700 Subject: [PATCH 05/11] ci(check): add uv --- .github/workflows/check.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 1aeeff9..6ee4921 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -15,9 +15,13 @@ permissions: jobs: pre-commit: runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6.0.1 - uses: actions/setup-python@v5 with: python-version: "3.13" + # install uv + - uses: astral-sh/setup-uv@v7 + # run pre-commit - uses: pre-commit/action@v3.0.0 From 15c024af546ab156d6653179232300a325e30e9b Mon Sep 17 00:00:00 2001 From: danielcristho Date: Thu, 5 Mar 2026 11:26:57 +0700 Subject: [PATCH 06/11] ci(check): add uv --- .github/workflows/check.yml | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 6ee4921..6c49b1c 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,13 +1,13 @@ name: Pre-Commit + on: workflow_call: workflow_dispatch: push: - branches: - - main + branches: [main] pull_request: - branches: - - main + branches: [main] + permissions: contents: write pull-requests: write @@ -17,11 +17,19 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6.0.1 - - uses: actions/setup-python@v5 + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 with: python-version: "3.13" - # install uv - - uses: astral-sh/setup-uv@v7 - # run pre-commit - - uses: pre-commit/action@v3.0.0 + + - name: Add uv + uses: astral-sh/setup-uv@v3 + + - name: Install dependencies + run: uv sync --dev + + - name: Run pre-commit + uses: pre-commit/action@v3.0.0 From 7419f50f1d52d881deced273404d450411657716 Mon Sep 17 00:00:00 2001 From: danielcristho Date: Thu, 5 Mar 2026 11:29:29 +0700 Subject: [PATCH 07/11] ci(check): update git checkout, update python version --- .github/workflows/check.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 6c49b1c..bca3588 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -18,15 +18,15 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6.0.1 - name: Setup Python uses: actions/setup-python@v5 with: - python-version: "3.13" + python-version: "3.14" - name: Add uv - uses: astral-sh/setup-uv@v3 + uses: astral-sh/setup-uv@v7 - name: Install dependencies run: uv sync --dev From 39f3ad90d54b71e632b34f1e18559dd8772f5b35 Mon Sep 17 00:00:00 2001 From: danielcristho Date: Thu, 5 Mar 2026 11:37:02 +0700 Subject: [PATCH 08/11] adjust(test-config): update toml_safe --- tests/test_config.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_config.py b/tests/test_config.py index c8b8c83..8d767d2 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -16,7 +16,10 @@ def _write_config(tmp_path, content): # Strategy for valid TOML-safe identifier strings (no quotes, newlines, etc.) toml_safe_text = st.text( - alphabet=st.characters(categories=("L", "N"), include_characters="_-"), + alphabet=st.characters( + whitelist_categories=("Lu", "Ll", "Nd"), + whitelist_characters="_-", + ), min_size=1, max_size=50, ) From 1a567108669502503961b248d1d2703787e90b4c Mon Sep 17 00:00:00 2001 From: danielcristho Date: Thu, 5 Mar 2026 11:38:23 +0700 Subject: [PATCH 09/11] revert: test config --- tests/test_config.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/test_config.py b/tests/test_config.py index 8d767d2..c8b8c83 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -16,10 +16,7 @@ def _write_config(tmp_path, content): # Strategy for valid TOML-safe identifier strings (no quotes, newlines, etc.) toml_safe_text = st.text( - alphabet=st.characters( - whitelist_categories=("Lu", "Ll", "Nd"), - whitelist_characters="_-", - ), + alphabet=st.characters(categories=("L", "N"), include_characters="_-"), min_size=1, max_size=50, ) From 8e4b2462ec6727acea748f66f66cb2940f332d08 Mon Sep 17 00:00:00 2001 From: danielcristho Date: Sat, 7 Mar 2026 16:49:20 +0700 Subject: [PATCH 10/11] feat(pre-commit config): downgrade ruff version --- .pre-commit-config.yaml | 62 ++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d09345f..dc2be5c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,34 +1,34 @@ repos: -- repo: https://github.com/pre-commit/pre-commit-hooks + - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: - - id: check-yaml - - id: end-of-file-fixer - - id: trailing-whitespace -- repo: https://github.com/astral-sh/ruff-pre-commit - # Ruff version. - rev: v0.15.4 - hooks: - # Run the linter. - - id: ruff-check - args: [ --fix ] - # Run the formatter. - - id: ruff-format -- repo: https://github.com/allganize/ty-pre-commit - # Ty version. - rev: v0.0.20 - hooks: - # Run the type checker. - - id: ty-check -- repo: https://github.com/DavidAnson/markdownlint-cli2 - rev: v0.21.0 - hooks: - - id: markdownlint-cli2 -- repo: local - hooks: - - id: deptry - name: deptry - entry: uv run deptry . - language: system - always_run: true - pass_filenames: false + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + - repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. + rev: v0.15.4 + hooks: + # Run the linter. + - id: ruff-check + args: [--fix] + # Run the formatter. + - id: ruff-format + - repo: https://github.com/allganize/ty-pre-commit + # Ty version. + rev: v0.0.20 + hooks: + # Run the type checker. + - id: ty-check + - repo: https://github.com/DavidAnson/markdownlint-cli2 + rev: v0.21.0 + hooks: + - id: markdownlint-cli2 + - repo: local + hooks: + - id: deptry + name: deptry + entry: uv run deptry . + language: system + always_run: true + pass_filenames: false From 347571d3fade5412dc8606d93327e074fd240725 Mon Sep 17 00:00:00 2001 From: danielcristho Date: Sat, 7 Mar 2026 17:13:24 +0700 Subject: [PATCH 11/11] docs: init contribute guidelines --- CONTRIBUTING.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..716a701 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,38 @@ +# Contributing to the Render Engine Projects + +Render Engine API is a unifying API layer for managing and working with [render-engine][render-engine]. +The [CLI][cli], [TUI][tui], and custom tools can use this module as a shared API layer. Please refer to +the main [CONTRIBUTING.md](https://github.com/render-engine/render-engine/blob/main/CONTRIBUTING.md) +for more details on how to contribute. + +## Render Engine API Specific Topics + +Render Engine API is a `uv` based project. For more information on installing `uv` and using it +please see the [uv documentation](https://docs.astral.sh/uv/#installation). To get started, fork +this repository and check out your fork. + +```shell +git clone +``` + +Once you have checked out the repository, run `uv sync --dev` and then activate the `venv` that was +created: + +```shell +uv sync --dev +source .venv/bin/activate +``` + +Once you have done this you will be in the virtual environment and ready to work. It is recommended +that you do a local, editable install of the API in your virtual environment so that you can easily +work with the changes you have made. + +```shell +uv pip install -e . +``` + +This will allow you to test your changes locally. + +[render-engine]: https://github.com/render-engine/render-engine +[cli]: https://github.com/render-engine/render-engine-cli +[tui]: https://github.com/render-engine/render-engine-tui