From 6b9ad8737512f80e1217bcba53426580651d102d Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Tue, 23 Jul 2024 17:24:10 +0200 Subject: [PATCH 01/12] remove empry scripts --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index 95d68bc..2bd7d75 100644 --- a/setup.py +++ b/setup.py @@ -42,7 +42,6 @@ def run_tests(self): }, packages = ["cmocean"], ext_package='cmocean', - scripts = [], keywords = ['colormaps', 'oceanography', 'plotting', 'visualization'], setup_requires=['setuptools'], install_requires=['matplotlib', 'numpy', 'packaging'], From ccb9455ce62944e278eeae28a8882542f0ce39da Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Tue, 23 Jul 2024 17:24:32 +0200 Subject: [PATCH 02/12] sync with setup.py --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index db5d81e..80565db 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ matplotlib numpy +packaging From 22b27163cb91e424cbbaab8ea5e16bcedbc00e53 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Tue, 23 Jul 2024 17:31:29 +0200 Subject: [PATCH 03/12] simplify, add more pythons, use faster umamba --- .github/workflows/test.yaml | 38 +++++++++++++++++-------------------- ci/environment-py3.10.yml | 14 -------------- ci/environment-py3.8.yml | 14 -------------- ci/environment-py3.9.yml | 14 -------------- 4 files changed, 17 insertions(+), 63 deletions(-) delete mode 100644 ci/environment-py3.10.yml delete mode 100644 ci/environment-py3.8.yml delete mode 100644 ci/environment-py3.9.yml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index d7d6d29..49cab85 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -17,36 +17,32 @@ jobs: fail-fast: false matrix: os: ["macos-latest", "ubuntu-latest", "windows-latest"] - python-version: ["3.8", "3.9", "3.10"] + python-version: [ "3.8", "3.9", "3.10" ,"3.11", "3.12" ] + defaults: + run: + shell: bash -l {0} + steps: - uses: actions/checkout@v4 - - name: Cache conda - uses: actions/cache@v4 - env: - # Increase this value to reset cache if ci/environment.yml has not changed - CACHE_NUMBER: 0 - with: - path: ~/conda_pkgs_dir - key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/environment-py${{ matrix.python-version }}.yml') }} - - uses: conda-incubator/setup-miniconda@v3 + + - name: Setup Micromamba ${{ matrix.python-version }} + uses: mamba-org/setup-micromamba@v1 with: - # mamba-version: "*" # activate this to build with mamba. - python-version: ${{ matrix.python-version }} - miniforge-variant: Mambaforge - channels: conda-forge, defaults # These need to be specified to use mamba - channel-priority: true - environment-file: ci/environment-py${{ matrix.python-version }}.yml + environment-name: TEST + init-shell: bash + create-args: >- + python=${{ matrix.python-version }} pip + --file requirements.txt + --channel conda-forge - activate-environment: test_env_cmocean - use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! - name: Set up conda environment - shell: bash -l {0} run: | python -m pip install -e . --no-deps --force-reinstall + - name: Run Tests - shell: bash -l {0} run: | - pytest --cov=./ --cov-report=xml + python -m pytest -rxs --cov=./ --cov-report=xml + - name: Upload code coverage to Codecov uses: codecov/codecov-action@v4 with: diff --git a/ci/environment-py3.10.yml b/ci/environment-py3.10.yml deleted file mode 100644 index 3c9e6ab..0000000 --- a/ci/environment-py3.10.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: test_env_cmocean -channels: - - conda-forge -dependencies: - - python=3.10 - ############## These will have to be adjusted to your specific project - - matplotlib-base - - numpy - ############## - - pytest - - pip: - - codecov - - pytest-cov - - coverage[toml] diff --git a/ci/environment-py3.8.yml b/ci/environment-py3.8.yml deleted file mode 100644 index 431995c..0000000 --- a/ci/environment-py3.8.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: test_env_cmocean -channels: - - conda-forge -dependencies: - - python=3.8 - ############## These will have to be adjusted to your specific project - - matplotlib-base - - numpy - ############## - - pytest - - pip: - - codecov - - pytest-cov - - coverage[toml] diff --git a/ci/environment-py3.9.yml b/ci/environment-py3.9.yml deleted file mode 100644 index b2f681d..0000000 --- a/ci/environment-py3.9.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: test_env_cmocean -channels: - - conda-forge -dependencies: - - python=3.9 - ############## These will have to be adjusted to your specific project - - matplotlib-base - - numpy - ############## - - pytest - - pip: - - codecov - - pytest-cov - - coverage[toml] From 5d034f5a859bd64228523fb3384ddf8ac7c56170 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Tue, 23 Jul 2024 18:25:59 +0200 Subject: [PATCH 04/12] move to pyproject.toml --- .gitignore | 1 + pyproject.toml | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 2 -- setup.py | 51 ----------------------------------------- 4 files changed, 62 insertions(+), 53 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.gitignore b/.gitignore index 6cee59b..9b735f0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +cmocean/_version.py cmocean/rgb/drafts/ dist *.pyc diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..2f9f032 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,61 @@ +[build-system] +build-backend = "setuptools.build_meta" +requires = [ + "setuptools>=42", + "setuptools_scm", + "wheel", +] + +[project] +name = "cmocean" +description = "Colormaps for Oceanography" +readme = "README.md" +license = {file = "LICENSE.txt"} +maintainers = [ + {name = "Kristen Thyng", email = "kthyng@gmail.com"}, +] +requires-python = ">=3.8" +classifiers = [ + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", +] +dynamic = [ + "dependencies", + "version", +] +[project.optional-dependencies] +tests = [ + "pytest", +] +plots = [ + "colorspacious", + "viscm", +] + +[project.urls] +documentation = "https://matplotlib.org/cmocean/" +homepage = "https://github.com/matplotlib/cmocean" +repository = "https://github.com/matplotlib/cmocean" + +[tool.setuptools] +packages = ["cmocean"] +include-package-data = true + +[tool.setuptools.dynamic] +dependencies = {file = ["requirements.txt"]} + +[tool.setuptools_scm] +write_to = "cmocean/_version.py" +write_to_template = "__version__ = '{version}'" +tag_regex = "^(?Pv)?(?P[^\\+]+)(?P.*)?$" + +[tool.pytest.ini_options] +filterwarnings = [ + "error:::cmocean.*", + "ignore::UserWarning", + "ignore::RuntimeWarning", +] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 498ec14..0000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[metadata] -license_file = LICENSE.txt diff --git a/setup.py b/setup.py deleted file mode 100644 index 2bd7d75..0000000 --- a/setup.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env python - -""" -setup.py for cmocean - -""" -import sys -from setuptools import setup # to support "develop" mode -from setuptools.command.test import test as TestCommand - -class PyTest(TestCommand): - def finalize_options(self): - TestCommand.finalize_options(self) - self.verbose = True - - def run_tests(self): - import pytest - errno = pytest.main(self.test_args) - sys.exit(errno) - -extras_require={ - 'plots': ["colorspacious", "viscm"], -} -# # in case I add more later -# extras_require['complete'] = sorted(set(sum(extras_require.values(), []))) - -setup( - name = "cmocean", - version = "v4.0.3", - author = "Kristen Thyng", - author_email = "kthyng@gmail.com", - url = 'https://github.com/matplotlib/cmocean', - # download_url = 'https://github.com/matplotlib/cmocean/tarball/2.0', - description = ("Colormaps for Oceanography"), - long_description=open('README.md').read(), - long_description_content_type='text/markdown', - classifiers=[ - "Development Status :: 3 - Alpha", - ], - package_data={ - 'cmocean': ['rgb/*.txt', 'rgb/inverted/*.txt'], - }, - packages = ["cmocean"], - ext_package='cmocean', - keywords = ['colormaps', 'oceanography', 'plotting', 'visualization'], - setup_requires=['setuptools'], - install_requires=['matplotlib', 'numpy', 'packaging'], - tests_require=['pytest'], - python_requires=">=3.8", - extras_require=extras_require - ) From 1ec17e1c799370f562efb9db0ed524f241c23d80 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Tue, 23 Jul 2024 18:30:28 +0200 Subject: [PATCH 05/12] add pytest --- .github/workflows/test.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 49cab85..0d0e538 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -33,6 +33,7 @@ jobs: create-args: >- python=${{ matrix.python-version }} pip --file requirements.txt + pytest --channel conda-forge - name: Set up conda environment From df104183ff75305129eb6363e900109cdbbe2f46 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Tue, 23 Jul 2024 18:32:34 +0200 Subject: [PATCH 06/12] add codecov --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 0d0e538..9ab2729 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -33,7 +33,7 @@ jobs: create-args: >- python=${{ matrix.python-version }} pip --file requirements.txt - pytest + pytest codecov pytest-cov --channel conda-forge - name: Set up conda environment From 5c3cd54778302a6493b30b9c35160f7ddb294258 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Mon, 5 Aug 2024 18:24:12 +0200 Subject: [PATCH 07/12] add wheel tests --- .github/workflows/release.yaml | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index def820f..ac4e316 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,8 +1,13 @@ - ---- name: Release -on: [push] +on: + pull_request: + push: + # branches: + # - main + # release: + # types: + # - published jobs: release: @@ -18,11 +23,20 @@ jobs: - uses: actions/setup-python@v5 - name: Install dependencies run: | - python -m pip install -U pip wheel setuptools setuptools-scm twine - # python -m pip install -U pip wheel "setuptools<66.0.0" setuptools-scm twine + python -m pip install -U pip wheel setuptools setuptools-scm twine build check-manifest - name: Build distributions - run: python setup.py sdist bdist_wheel + run: python -m build --sdist --wheel . --outdir dist + + - name: CheckFiles + run: | + ls dist + check-manifest --verbose + + - name: Test wheels + run: | + cd dist && python -m pip install *.whl + python -m twine check * - name: Publish to PyPI - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + if: success() && github.event_name == 'release' uses: pypa/gh-action-pypi-publish@release/v1 From c9ea6da559e330d2324f0e311c507e318a6ea0f1 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Mon, 5 Aug 2024 18:27:44 +0200 Subject: [PATCH 08/12] fix manifest --- MANIFEST.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MANIFEST.in b/MANIFEST.in index 4fabd54..415288f 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,3 +2,8 @@ include README.md include *.txt recursive-include cmocean *.txt recursive-include cmocean *.py + +recursive-exclude cmocean/rgb *.jscm +prune docs +prune figures +exclude cmocean/_version.py From aeda1d354588928684467889bce6f45e23f1de2c Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Mon, 5 Aug 2024 18:39:07 +0200 Subject: [PATCH 09/12] run tests --- .github/workflows/release.yaml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ac4e316..a3de83b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -3,11 +3,11 @@ name: Release on: pull_request: push: - # branches: - # - main - # release: - # types: - # - published + branches: + - main + release: + types: + - published jobs: release: @@ -23,7 +23,7 @@ jobs: - uses: actions/setup-python@v5 - name: Install dependencies run: | - python -m pip install -U pip wheel setuptools setuptools-scm twine build check-manifest + python -m pip install -U build check-manifest pip pytest setuptools setuptools-scm twine wheel - name: Build distributions run: python -m build --sdist --wheel . --outdir dist @@ -31,11 +31,14 @@ jobs: run: | ls dist check-manifest --verbose - + - name: Test wheels - run: | - cd dist && python -m pip install *.whl - python -m twine check * + run: > + cd dist + && python -m twine check * + && python -m pip install *.whl + && cp --recursive ../tests . + && python -m pytest -rxs tests - name: Publish to PyPI if: success() && github.event_name == 'release' From ac57dc0ed51050d76c586968aceb3d78069c91b3 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Tue, 8 Oct 2024 11:47:46 +0200 Subject: [PATCH 10/12] review actions --- .github/workflows/test.yaml | 2 +- pyproject.toml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9ab2729..3c7bc0e 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -17,7 +17,7 @@ jobs: fail-fast: false matrix: os: ["macos-latest", "ubuntu-latest", "windows-latest"] - python-version: [ "3.8", "3.9", "3.10" ,"3.11", "3.12" ] + python-version: [ "3.9", "3.10" ,"3.11", "3.12", "3.13" ] defaults: run: shell: bash -l {0} diff --git a/pyproject.toml b/pyproject.toml index 2f9f032..570011e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,6 @@ build-backend = "setuptools.build_meta" requires = [ "setuptools>=42", "setuptools_scm", - "wheel", ] [project] @@ -17,11 +16,11 @@ maintainers = [ requires-python = ">=3.8" classifiers = [ "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ] dynamic = [ "dependencies", From 60b8d95a72aff345785c504a2181991b7f25bf10 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Thu, 10 Oct 2024 11:24:47 +0200 Subject: [PATCH 11/12] review actions --- .github/workflows/release.yaml | 2 +- .github/workflows/test.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index a3de83b..85c3358 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -23,7 +23,7 @@ jobs: - uses: actions/setup-python@v5 - name: Install dependencies run: | - python -m pip install -U build check-manifest pip pytest setuptools setuptools-scm twine wheel + python -m pip install -U build check-manifest pip pytest setuptools setuptools-scm twine - name: Build distributions run: python -m build --sdist --wheel . --outdir dist diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 3c7bc0e..70abc24 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -42,7 +42,7 @@ jobs: - name: Run Tests run: | - python -m pytest -rxs --cov=./ --cov-report=xml + pytest -rxs --cov=./ --cov-report=xml - name: Upload code coverage to Codecov uses: codecov/codecov-action@v4 From 05525aad1605a6983b48fa0dfcb2c9fce4726716 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Thu, 10 Oct 2024 11:47:07 +0200 Subject: [PATCH 12/12] review actions --- .github/workflows/release.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 85c3358..9ea2562 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -33,12 +33,12 @@ jobs: check-manifest --verbose - name: Test wheels - run: > + run: | cd dist - && python -m twine check * - && python -m pip install *.whl - && cp --recursive ../tests . - && python -m pytest -rxs tests + python -m twine check * + python -m pip install *.whl + cp --recursive ../tests . + python -m pytest -rxs tests - name: Publish to PyPI if: success() && github.event_name == 'release'