diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c3746bb..87e853e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,7 +16,7 @@ on: jobs: build: - name: ${{ matrix.os }}, Python ${{ matrix.python-version }} + name: ${{ matrix.os }}, Python ${{ matrix.python-version }} ${{ matrix.install-args }} ${{ matrix.viscm-flavor }} runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -29,7 +29,7 @@ jobs: - '3.11' - '3.12' - '3.13' - test-args: [viscm>=0.10] + install-args: [''] include: - os: ubuntu-20.04 @@ -45,7 +45,7 @@ jobs: python-version: '3.13' concurrency: - group: ${{ github.ref }}-${{ matrix.os }}-${{ matrix.python-version }}-build + group: ${{ github.ref }}-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.install-args }}-build cancel-in-progress: true steps: @@ -56,21 +56,24 @@ jobs: cache-dependency-glob: pyproject.toml - name: Build + shell: bash # for windows-compat run: | - uv venv --python ${{ matrix.python-version }} - uv pip install . ${{ matrix.install-args }} - uv pip install -r requirements/dev.txt ${{ matrix.test-args }} + uv venv -p ${{ matrix.python-version }} + uv pip install ${{ matrix.install-args }} . - run: uv pip list - name: Test package (no coverage) if: ${{ !startsWith( matrix.os , 'ubuntu' ) }} - run: uv run ${{ matrix.install-args }} pytest --color=yes --mpl + shell: bash # for windows-compat + run: | + uv run --verbose --group dev ${{ matrix.install-args }} \ + pytest --color=yes --mpl - name: Test package (with coverage) if: startsWith( matrix.os , 'ubuntu' ) run: | - uv run ${{ matrix.install-args }} \ + uv run --verbose --group dev ${{ matrix.install-args }} \ coverage run --parallel-mode -m pytest --color=yes --mpl - name: Upload coverage data @@ -79,7 +82,7 @@ jobs: if: startsWith( matrix.os , 'ubuntu' ) uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: - name: cmasher_coverage_data-${{ matrix.os }}-${{ matrix.python-version }} + name: cmasher_coverage_data-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.install-args }} path: .coverage.* if-no-files-found: ignore include-hidden-files: true @@ -119,6 +122,7 @@ jobs: name: type check w/ Python ${{ matrix.python-version }} strategy: + fail-fast: false matrix: python-version: - '3.10' @@ -138,10 +142,7 @@ jobs: cache-dependency-glob: pyproject.toml - name: Run mypy - run: | - uvx --python ${{ matrix.python-version }} \ - --with-requirements=requirements/typecheck.txt --with . \ - mypy src/cmasher + run: uv run -p ${{ matrix.python-version }} --group dev mypy src/cmasher docs: name: Build docs @@ -160,8 +161,8 @@ jobs: - name: Build run: | - uvx --python 3.12 --with-requirements=docs/requirements.txt --from sphinx \ - sphinx-build -M html docs/source site -W + uvx -p 3.13 --with-requirements=docs/requirements.txt --compile-bytecode \ + --from sphinx sphinx-build -M html docs/source site -W - name: Upload artifacts uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: diff --git a/MANIFEST.in b/MANIFEST.in index 35fe7ad..5bacba5 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,7 +2,6 @@ include LICENSE include CITATION include README.rst include MANIFEST.in -include requirements/*.txt include conftest.py recursive-include cmasher data/* recursive-exclude cmasher/colormaps * diff --git a/pyproject.toml b/pyproject.toml index d622f01..d777fd0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,13 +45,38 @@ Documentation = "https://cmasher.readthedocs.io" [project.scripts] cmr = "cmasher.cli_tools:main" +[dependency-groups] +test = [ + "coverage[toml]>=7.6.4", + "pytest>=4.6.0", + "pytest-mpl>=0.13.0", +] +typecheck = [ + "mypy>=1.7.1", +] +dev = [ + {include-group = "test"}, + {include-group = "typecheck"}, +] + [tool.hatch.build] exclude = [ "scripts", ] +[tool.setuptools] +package-dir = {cmasher = "cmasher"} +include-package-data = true +zip-safe = false +platforms = [ + "Windows", + "Mac OS-X", + "Linux", + "Unix", +] + [tool.pytest.ini_options] -addopts = "-v" +addopts = "-v -ra" filterwarnings = [ "error", "ignore:FigureCanvasAgg is non-interactive:UserWarning", diff --git a/requirements/dev.txt b/requirements/dev.txt deleted file mode 100644 index bae8351..0000000 --- a/requirements/dev.txt +++ /dev/null @@ -1,4 +0,0 @@ -coverage[toml]>=7.6.4 -pyqt5>=5.15.6 -pytest>=4.6.0 -pytest-mpl>=0.13.0 diff --git a/requirements/typecheck.txt b/requirements/typecheck.txt deleted file mode 100644 index 0aef747..0000000 --- a/requirements/typecheck.txt +++ /dev/null @@ -1,2 +0,0 @@ -mypy==1.7.1 -pytest==7.4.3 diff --git a/src/cmasher/utils.py b/src/cmasher/utils.py index 53fe17c..7f9a7d6 100644 --- a/src/cmasher/utils.py +++ b/src/cmasher/utils.py @@ -1545,7 +1545,7 @@ def take_cmap_colors( # Convert colors to proper format if return_fmt in ("float", "norm", "int", "8bit"): - colors = np.apply_along_axis(to_rgb, 1, colors) # type: ignore [arg-type] + colors = np.apply_along_axis(to_rgb, 1, colors) # type: ignore [call-overload] if return_fmt in ("int", "8bit"): colors = np.array(np.rint(colors * 255), dtype=int) colors = list(map(tuple, colors))