From 456da48f4dc2b4cfb8ef02586b09e012f24bcf9a Mon Sep 17 00:00:00 2001 From: podhmo Date: Thu, 10 Jul 2025 22:54:48 +0900 Subject: [PATCH 1/8] chore: pyproject.toml, use hatch-test env --- pyproject.toml | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 012c66f..339bce5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,18 +33,12 @@ jsonknife = "dictknife.commands.jsonknife:main" swaggerknife = "dictknife.commands.swaggerknife:main" [project.optional-dependencies] -testing = [ - "ruamel.yaml", - "jsonpatch", - "pytest", -] lint = ["flake8", "black", "mypy"] docs = ["sphinx", "recommonmark", "sphinx_rtd_theme"] load = ["ruamel.yaml", "tomlkit"] command = ["ruamel.yaml", "magicalimport", "prestring"] spreadsheet = ["google-api-python-client", "google-auth-oauthlib"] dev = [ - "dictknife[testing]", "dictknife[lint]", "dictknife[load]", "dictknife[command]", @@ -66,7 +60,6 @@ dependencies = [ "dictknife[dev]", ] [tool.hatch.envs.default.scripts] -test = "pytest {args:src/dictknife/tests}" lint = "flake8 --show-source --ignore=E501,E121,W503 src/dictknife" type-check = "mypy --ignore-missing-imports --check-untyped-defs --no-strict-optional src/dictknife" format = "black src/dictknife" @@ -79,12 +72,15 @@ all = [ "test", ] -[tool.hatch.envs.test] +[tool.hatch.envs.hatch-test] dependencies = [ - "dictknife[testing]" + "ruamel.yaml", + "jsonpatch", + "pytest", ] +default-args = ["src/dictknife/tests"] -[[tool.hatch.envs.test.matrix]] +[[tool.hatch.envs.hatch-test.matrix]] python = ["3.10", "3.11", "3.12", "3.13"] # TODO: remove From 010e5399ce161a2d460b49c53076fa405b4429e0 Mon Sep 17 00:00:00 2001 From: podhmo Date: Thu, 10 Jul 2025 22:58:02 +0900 Subject: [PATCH 2/8] chore: ci, set concurrency --- .github/workflows/pythonpackage.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 0324015..42e90c1 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -9,6 +9,10 @@ on: pull_request: types: [ opened, synchronize, reopened ] +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + jobs: build: runs-on: ubuntu-latest From 73e30ab28b2adfab1aac37736ef1563f26621318 Mon Sep 17 00:00:00 2001 From: podhmo Date: Thu, 10 Jul 2025 22:58:50 +0900 Subject: [PATCH 3/8] chore: ci, set fail-fast to false --- .github/workflows/pythonpackage.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 42e90c1..2b2b115 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -17,8 +17,9 @@ jobs: build: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: - python-version: ["3.10", "3.11", "3.12", "3.13"] + python-version: ["3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 From 15758a1e1aab126b6db917bc5009698cd873c278 Mon Sep 17 00:00:00 2001 From: podhmo Date: Thu, 10 Jul 2025 22:59:25 +0900 Subject: [PATCH 4/8] chore: ci, set cache --- .github/workflows/pythonpackage.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 2b2b115..3f94714 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -27,6 +27,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + cache: pip - name: Install make run: sudo apt-get install make - name: Install Hatch From 851b901e0c060078879220af59b796f5870bdad4 Mon Sep 17 00:00:00 2001 From: podhmo Date: Thu, 10 Jul 2025 23:07:30 +0900 Subject: [PATCH 5/8] chore: ci, run unit test without make --- .github/workflows/pythonpackage.yml | 5 +++-- Makefile | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 3f94714..ccab9d8 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -34,11 +34,12 @@ jobs: uses: pypa/hatch@install - name: unit test run: | - make test + hatch test - name: e2e test run: | hatch env create - . "$(hatch env find)/bin/activate" + . "$(hatch env find default)/bin/activate" + python -V make ci - name: lint run: | diff --git a/Makefile b/Makefile index 9dcfc4c..edfb2ef 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ # Run tests using the 'test' environment defined in pyproject.toml test: - hatch run test + hatch test # Build the documentation using the 'docs' environment docs: From 42189c4c72ec5baa9520506412aeb6d7ef57163b Mon Sep 17 00:00:00 2001 From: podhmo Date: Thu, 10 Jul 2025 23:41:22 +0900 Subject: [PATCH 6/8] chore: pyproject.toml add e2e enviroment --- pyproject.toml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 339bce5..36b6781 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,13 +38,6 @@ docs = ["sphinx", "recommonmark", "sphinx_rtd_theme"] load = ["ruamel.yaml", "tomlkit"] command = ["ruamel.yaml", "magicalimport", "prestring"] spreadsheet = ["google-api-python-client", "google-auth-oauthlib"] -dev = [ - "dictknife[lint]", - "dictknife[load]", - "dictknife[command]", -# "dictknife[docs]", -# "dictknife[spreadsheet]", -] [tool.hatch.version] path = "src/dictknife/__version__.py" @@ -57,7 +50,11 @@ packages = ["src/dictknife"] [tool.hatch.envs.default] description = "Default environment for everyday tasks" dependencies = [ - "dictknife[dev]", + "dictknife[lint]", + "dictknife[load]", + "dictknife[command]", +# "dictknife[docs]", +# "dictknife[spreadsheet]", ] [tool.hatch.envs.default.scripts] lint = "flake8 --show-source --ignore=E501,E121,W503 src/dictknife" @@ -83,6 +80,12 @@ default-args = ["src/dictknife/tests"] [[tool.hatch.envs.hatch-test.matrix]] python = ["3.10", "3.11", "3.12", "3.13"] +# e2e +[tool.hatch.envs.e2e] + +[[tool.hatch.envs.e2e.matrix]] +python = ["3.10", "3.11", "3.12", "3.13"] + # TODO: remove [tool.hatch.envs.docs] description = "Environment for building documentation" From 1fee4220236d3abd54b153e98680ccc4a3268316 Mon Sep 17 00:00:00 2001 From: podhmo Date: Thu, 10 Jul 2025 23:58:39 +0900 Subject: [PATCH 7/8] chore: ci, select specific version --- .github/workflows/pythonpackage.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index ccab9d8..08d8135 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -34,13 +34,13 @@ jobs: uses: pypa/hatch@install - name: unit test run: | - hatch test + hatch test -py {{ matrix.python-version }} + - name: lint + run: | + hatch run +py={{ matrix.python-version }} e2e:lint - name: e2e test run: | - hatch env create - . "$(hatch env find default)/bin/activate" + hatch env create "e2e.py${{ matrix.python-version }}" + . "$(hatch env find "e2e.py${{ matrix.python-version }}")/bin/activate" python -V make ci - - name: lint - run: | - make lint From a171e2b08da88c9bd19b99b838d1196a0e19d3a6 Mon Sep 17 00:00:00 2001 From: podhmo Date: Fri, 11 Jul 2025 00:00:55 +0900 Subject: [PATCH 8/8] fix: ci, fix typo --- .github/workflows/pythonpackage.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 08d8135..f7b075c 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -34,10 +34,10 @@ jobs: uses: pypa/hatch@install - name: unit test run: | - hatch test -py {{ matrix.python-version }} + hatch test -py ${{ matrix.python-version }} - name: lint run: | - hatch run +py={{ matrix.python-version }} e2e:lint + hatch run +py=${{ matrix.python-version }} e2e:lint - name: e2e test run: | hatch env create "e2e.py${{ matrix.python-version }}"