From ae9556e4e89f7a3f21bdf716d9ec38eed8ec41f0 Mon Sep 17 00:00:00 2001 From: zhouhy Date: Sun, 4 Jan 2026 19:02:42 +0800 Subject: [PATCH 1/7] Add GitHub Actions CI workflows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add CI workflow for linting and build tests on push/PR - Add publish workflow for PyPI releases on version tags 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .github/workflows/ci.yml | 47 +++++++++++++++++++++++++++++++++++ .github/workflows/publish.yml | 45 +++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a53788c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,47 @@ +name: CI + +on: + push: + branches: [master, main] + pull_request: + branches: [master, main] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install dependencies + run: | + pip install black isort + + - name: Check formatting with black + run: black --check configurize/ + + - name: Check imports with isort + run: isort --check-only configurize/ + + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.8', '3.10', '3.11', '3.12'] + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install package + run: pip install . + + - name: Test import + run: python -c "from configurize import Config, DataClass, Ref; print('Import successful')" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..67a400e --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,45 @@ +name: Publish to PyPI + +on: + push: + tags: + - 'v*' # Triggers on tags like v0.1.0, v1.0.0, etc. + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install build dependencies + run: pip install build + + - name: Build package + run: python -m build + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ + + publish: + needs: build + runs-on: ubuntu-latest + environment: pypi + permissions: + id-token: write # Required for trusted publishing + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 From 5a658f2e6af8434dd67ea35755d15c76dc5decc6 Mon Sep 17 00:00:00 2001 From: zhouhy Date: Sun, 4 Jan 2026 19:17:17 +0800 Subject: [PATCH 2/7] disable set new attr by default --- configurize/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configurize/config.py b/configurize/config.py index bfab046..449c8c8 100644 --- a/configurize/config.py +++ b/configurize/config.py @@ -43,7 +43,7 @@ class Config(DataClass): _modify_stack = [] """store modification in stack, enable push & pop""" - _allow_set_new_attr = None + _allow_set_new_attr = False """if set True, `cfg.aaa = 1` is allowed even if 'aaa' does not exists. None for allowed now.""" _buildin_functions = [ From 9169cd5e47fe01cbb311e90b102403c18487d0ec Mon Sep 17 00:00:00 2001 From: zhouhy Date: Sun, 4 Jan 2026 19:19:45 +0800 Subject: [PATCH 3/7] lint file --- configurize/cli.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/configurize/cli.py b/configurize/cli.py index 218e119..2f4aeb0 100644 --- a/configurize/cli.py +++ b/configurize/cli.py @@ -8,9 +8,7 @@ from configurize.utils import compare_in_vscode, get_object_from_file, show_or_compare -def cfshow( - ref: str | Config, exp: str | Config = None, key=None, query=None -): +def cfshow(ref: str | Config, exp: str | Config = None, key=None, query=None): """Show an Exp or compare two Exps Usage: @@ -86,6 +84,7 @@ def has_repetition(sequence): def main(): import fire + fire.Fire(cfshow) From 9abd5d069b3f0b2e655c826a879c490ae8fd00d3 Mon Sep 17 00:00:00 2001 From: zhouhy Date: Sun, 4 Jan 2026 19:25:50 +0800 Subject: [PATCH 4/7] fix ci --- .github/workflows/ci.yml | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a53788c..f86d1e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: run: black --check configurize/ - name: Check imports with isort - run: isort --check-only configurize/ + run: isort --check-only --profile black configurize/ build: runs-on: ubuntu-latest diff --git a/pyproject.toml b/pyproject.toml index cb76fdf..64d8391 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "configurize" version = "0.1.0" description = "Hierarchical configuration management with inheritance, cross-references, and diffing" readme = "README.md" -license = "MIT" +license = {text = "MIT"} authors = [ {name = "Zhou Hongyu", email = "rndj@outlook.com"} ] From 1b866e64b466a47affd7370419ba4dce10685784 Mon Sep 17 00:00:00 2001 From: zhouhy Date: Sun, 4 Jan 2026 19:30:23 +0800 Subject: [PATCH 5/7] fix anno --- configurize/config.py | 1 + 1 file changed, 1 insertion(+) diff --git a/configurize/config.py b/configurize/config.py index 449c8c8..93a8211 100644 --- a/configurize/config.py +++ b/configurize/config.py @@ -1,3 +1,4 @@ +from __future__ import annotations import ast import inspect import weakref From 93474536d042eaf159b94e4de716e918ea1b81ef Mon Sep 17 00:00:00 2001 From: zhouhy Date: Sun, 4 Jan 2026 19:31:33 +0800 Subject: [PATCH 6/7] lint --- configurize/config.py | 1 + 1 file changed, 1 insertion(+) diff --git a/configurize/config.py b/configurize/config.py index 93a8211..a9ce817 100644 --- a/configurize/config.py +++ b/configurize/config.py @@ -1,4 +1,5 @@ from __future__ import annotations + import ast import inspect import weakref From 0c5744d9ba069f5fb87307ef6a2d3ad0ffb088b1 Mon Sep 17 00:00:00 2001 From: zhouhy Date: Sun, 4 Jan 2026 19:32:14 +0800 Subject: [PATCH 7/7] fix ci --- configurize/data_class.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configurize/data_class.py b/configurize/data_class.py index 8d0419f..cddc407 100644 --- a/configurize/data_class.py +++ b/configurize/data_class.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from functools import cached_property