add tool to synchronize add-on repository with latest addonTemplate - #46
Open
abdel792 wants to merge 3 commits into
Open
add tool to synchronize add-on repository with latest addonTemplate#46abdel792 wants to merge 3 commits into
abdel792 wants to merge 3 commits into
Conversation
Introduces the syncAddonWithTemplate.py automation tool to streamline synchronizing add-on metadata and infrastructure with upstream template updates. Detailed changes: - Added `syncAddonWithTemplate.py` at repository root to handle AST-aware merging of buildVars.py and pyproject.toml configuration. - Configured `PROTECTED_ELEMENTS` in the sync script to prevent overwriting template-specific files (e.g., `.github/workflows/unitTests.yml` and `tests/`). - Added `.addonmergeignore` support for defining project-specific file exclusion rules during synchronization. - Added dependencies for the sync tool to `pyproject.toml`. - Added `tests/unit/test_syncAddonWithTemplate.py` to validate metadata parsing, AST transformations, TOML formatting, and execution ordering. - Updated `pyproject.toml` to exclude `syncAddonWithTemplate.py` alongside the `tests/` directory from ruff and pyright checks. - Updated `docs/managementFromGit/updatingExistingAddons.md` with full usage instructions, CLI flags, and execution modes for the sync script. - Updated `docs/unitTesting.md` with guidelines for running unit tests locally using unittest and uv.
Update testFormatAuthorList in test_syncAddonWithTemplate.py to assert that empty author email keys are omitted rather than expecting an empty string, matching syncAddonWithTemplate.py behavior.
…umentation Update description of testFormatAuthorList to document that empty email fields are omitted for PEP 621 compliance.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to issue number:
Replaces #41.
Summary of the issue:
While upgrading an existing add-on using standard Git commands remains fully supported, some add-on developers prefer an automated and dedicated tool to streamline the process. Manual step-by-step migration of metadata (from
buildVars.pytopyproject.toml) and file merges can require extra care and verification. Providing an automated script offers a convenient alternative for developers who wish to perform these updates quickly and with built-in AST-based metadata handling.Description of developer facing changes:
syncAddonWithTemplate.pyat the repository root as an automated alternative to Git-based manual upgrades for add-on developers..github/workflows/unitTests.ymlandtests/, ensuring they are excluded from add-on synchronization.syncAddonWithTemplate.pyand thetests/directory from static analysis inpyproject.toml(ruffandpyright).tests/unit/test_syncAddonWithTemplate.py).Description of development approach:
syncAddonWithTemplate.pyusing an AST-aware approach to seamlessly migrate legacybuildVars.pymetadata or modernAddonInfosetups intopyproject.toml. It supports timestamped backups, custom exclusions via.addonmergeignore, and includes.github/workflows/unitTests.ymlinPROTECTED_ELEMENTS.pyproject.tomlto excludesyncAddonWithTemplate.pyandtests/fromruffandpyrightchecks.tests/unit/test_syncAddonWithTemplate.py) usingunittestandtempfile, utilizing aload_testshook to guarantee deterministic test execution order.Testing strategy:
Validated the synchronization script and unit test suite locally using
uv:syncAddonWithTemplate.pyacross various CLI modes:-adis optional):<addon>_bak_<timestamp>) were generated,.addonmergeignorerules were respected, and protected elements (including.github/workflows/unitTests.ymlandtests/) were not pushed to target add-on repositories.unittest:Confirmed all tests passed successfully.
4. Confirmed
ruffandpyrightignoresyncAddonWithTemplate.pyandtests/.Known issues with pull request:
None.
Code Review Checklist