From 4ddefe5eaaa51f5ee9d65e7fb9933a4bc3358463 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 6 Dec 2023 09:07:21 -0500 Subject: [PATCH 1/5] CI: Enable colored output with FORCE_COLOR --- .github/workflows/test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 254fc816f..3acb06d33 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,6 +26,10 @@ defaults: run: shell: bash +# Force tox and pytest to use color +env: + FORCE_COLOR: true + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true From fb0ca55bf688c26f77afc93abc12e14e62ad3a04 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 6 Dec 2023 09:09:24 -0500 Subject: [PATCH 2/5] CI: Move to trusted publishing for PyPI uploads --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3acb06d33..fc9afdc21 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -199,6 +199,9 @@ jobs: runs-on: ubuntu-latest environment: "Package deployment" needs: [test, test-package] + permissions: + # Required for trusted publishing + id-token: write if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') steps: - uses: actions/download-artifact@v3 @@ -206,6 +209,3 @@ jobs: name: dist path: dist/ - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} From 72c3724089c65acc7c4cc2e83b0c8f875ff3bca4 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 6 Dec 2023 10:06:54 -0500 Subject: [PATCH 3/5] TOX: Make blue/isort fail on diff --- tox.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index cdf7879b2..4363dbf8e 100644 --- a/tox.ini +++ b/tox.ini @@ -139,8 +139,8 @@ deps = isort[colors] skip_install = true commands = - blue --diff --color nibabel - isort --diff --color nibabel + blue --check --diff --color nibabel + isort --check --diff --color nibabel flake8 nibabel [testenv:style-fix] From 7efda1bcce21625491a0932684c0e38249f6f3cf Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 6 Dec 2023 10:07:22 -0500 Subject: [PATCH 4/5] STY: Apply blue --- nibabel/nifti1.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nibabel/nifti1.py b/nibabel/nifti1.py index e0bdd2020..4cf1e5274 100644 --- a/nibabel/nifti1.py +++ b/nibabel/nifti1.py @@ -1637,9 +1637,7 @@ def set_slice_times(self, slice_times): labels.remove('unknown') matching_labels = [ - label - for label in labels - if np.all(st_order == self._slice_time_order(label, n_timed)) + label for label in labels if np.all(st_order == self._slice_time_order(label, n_timed)) ] if not matching_labels: From 432407f0546bd186974a68c81420d6520c0642fc Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 6 Dec 2023 11:34:52 -0500 Subject: [PATCH 5/5] TOX: Pass color preferences to tools --- tox.ini | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tox.ini b/tox.ini index 4363dbf8e..17a66b04e 100644 --- a/tox.ini +++ b/tox.ini @@ -63,6 +63,12 @@ pass_env = USERNAME # Environment variables we check for NIPY_EXTRA_TESTS + # Pass user color preferences through + PY_COLORS + FORCE_COLOR + NO_COLOR + CLICOLOR + CLICOLOR_FORCE extras = test deps = # General minimum dependencies: pin based on API usage