From 0a8779b50e96bf994e2b526f096b1c4146da91ad Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Fri, 5 Jan 2024 11:25:21 -0700 Subject: [PATCH 01/13] Remove stubbed setup.py --- setup.py | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 setup.py diff --git a/setup.py b/setup.py deleted file mode 100644 index 6068493..0000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup() From 42bfcd70f81662ad89563176972408ee0fabd713 Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Fri, 5 Jan 2024 13:23:07 -0700 Subject: [PATCH 02/13] Move configurations from setup.cfg to pyproject.toml Also do some freshening of the metadata in pyproject.toml, such as updating maintainers and upping minimum Python version. --- pyproject.toml | 31 +++++++++++++++++++------------ setup.cfg | 10 ---------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4aa2941..668240c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,15 +7,16 @@ name = "bmi-heat" description = "BMI Python example" authors = [ {email = "eric.hutton@colorado.edu"}, - {name = "The CSDMS team"} + {name = "Eric Hutton"} ] maintainers = [ - {email = "eric.hutton@colorado.edu"}, - {name = "The CSDMS team"} + {name = "Mark Piper", email = "mark.piper@colorado.edu"}, + {name = "Eric Hutton", email = "eric.hutton@colorado.edu"}, ] keywords = [ "bmi", "component modeling", + "csdms", "earth science", ] license = {file = "LICENSE"} @@ -25,14 +26,14 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "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 :: Implementation :: CPython", "Topic :: Scientific/Engineering :: Physics", ] -requires-python = ">=3.7" +requires-python = ">=3.9" dependencies = [ "numpy", "scipy", @@ -41,12 +42,11 @@ dependencies = [ ] dynamic = ["readme", "version"] - [project.urls] -homepage = "https://github.com/csdms/bmi-example-python" -documentation = "https://github.com/csdms/bmi-example-python#readme" -repository = "https://github.com/csdms/bmi-example-python" -changelog = "https://github.com/csdms/bmi-example-python/blob/master/CHANGES.rst" +Homepage = "https://csdms.colorado.edu" +Documentation = "https://bmi.readthedocs.io" +Repository = "https://github.com/csdms/bmi-example-python" +Changelog = "https://github.com/csdms/bmi-example-python/blob/master/CHANGES.rst" [project.optional-dependencies] testing = [ @@ -72,7 +72,7 @@ norecursedirs = [".*", "*.egg*", "build", "dist"] addopts = """ --ignore setup.py --tb native - --strict + --strict-markers --durations 16 --doctest-modules -vvv @@ -89,3 +89,10 @@ include_trailing_comma = true force_grid_wrap = 0 combine_as_imports = true line_length = 88 + +[tool.coverage.run] +relative_files = true + +[tool.zest-releaser] +tag-format = "v{version}" +python-file-with-version = "heat/_version.py" diff --git a/setup.cfg b/setup.cfg index 5cc1af3..49d4279 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,16 +1,6 @@ -[coverage:run] -relative_files = True - [flake8] ignore = E203 E501 W503 max-line-length = 88 - -[pylint] -disable = missing-docstring,line-too-long - -[zest.releaser] -tag-format = v{version} -python-file-with-version = heat/_version.py From 6a1159c9e90da9e21c36f77aafbac13ab2d6f850 Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Fri, 5 Jan 2024 13:37:15 -0700 Subject: [PATCH 03/13] Remove obsolete six dependency --- pyproject.toml | 1 - tests/test_irf.py | 1 - 2 files changed, 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 668240c..5515724 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,7 +54,6 @@ testing = [ "flake8", "pytest", "pytest-cov", - "six", "bmi-tester", ] diff --git a/tests/test_irf.py b/tests/test_irf.py index 095c8e3..bfe2dc3 100644 --- a/tests/test_irf.py +++ b/tests/test_irf.py @@ -4,7 +4,6 @@ import numpy as np import yaml from numpy.testing import assert_almost_equal, assert_array_equal, assert_array_less -from six.moves import range from heat import BmiHeat From 085158dea07c2eeaa7b68ab68729d67efbca6f81 Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Fri, 5 Jan 2024 13:43:11 -0700 Subject: [PATCH 04/13] Get testing requirements from pyproject.toml --- requirements-testing.txt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/requirements-testing.txt b/requirements-testing.txt index 16911dd..92937fa 100644 --- a/requirements-testing.txt +++ b/requirements-testing.txt @@ -1,6 +1 @@ -coveralls -flake8 -pytest -pytest-cov -six -bmi-tester +-e .[testing] From 6eec9ba95446050aa970b7b99c9b611a55173e55 Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Fri, 5 Jan 2024 13:52:41 -0700 Subject: [PATCH 05/13] Use ruff instead of flake8 for linting The flake8 config was the last in setup.cfg, so I removed it. --- Makefile | 4 ++-- pyproject.toml | 9 ++++++++- setup.cfg | 6 ------ 3 files changed, 10 insertions(+), 9 deletions(-) delete mode 100644 setup.cfg diff --git a/Makefile b/Makefile index 74e6930..1510d24 100644 --- a/Makefile +++ b/Makefile @@ -51,8 +51,8 @@ clean-test: ## remove test and coverage artifacts rm -fr htmlcov/ rm -fr .pytest_cache -lint: ## check style with flake8 - flake8 heat tests +lint: ## check style with ruff + ruff check . --fix pretty: find heat -name '*.py' | xargs isort diff --git a/pyproject.toml b/pyproject.toml index 5515724..d0b518c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,7 +51,7 @@ Changelog = "https://github.com/csdms/bmi-example-python/blob/master/CHANGES.rst [project.optional-dependencies] testing = [ "coveralls", - "flake8", + "ruff", "pytest", "pytest-cov", "bmi-tester", @@ -89,6 +89,13 @@ force_grid_wrap = 0 combine_as_imports = true line_length = 88 +[tool.ruff] +line-length = 88 +ignore = [ + "E203", + "E501", +] + [tool.coverage.run] relative_files = true diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 49d4279..0000000 --- a/setup.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[flake8] -ignore = - E203 - E501 - W503 -max-line-length = 88 From c1d26408a11a0e212f0f515e9bc0bed4a7b9df7e Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Fri, 5 Jan 2024 13:57:53 -0700 Subject: [PATCH 06/13] Add black and isort to testing dependencies I thought about making a set of 'dev' dependencies, but it seemed like overkill. --- pyproject.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d0b518c..fd4dac2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,9 +51,11 @@ Changelog = "https://github.com/csdms/bmi-example-python/blob/master/CHANGES.rst [project.optional-dependencies] testing = [ "coveralls", - "ruff", "pytest", "pytest-cov", + "black", + "isort", + "ruff", "bmi-tester", ] From 8a77505693a543571e1483adcc25d9334af83005 Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Fri, 5 Jan 2024 14:02:47 -0700 Subject: [PATCH 07/13] Rename workflow files based on topic They had been named based on package; e.g., flake8, which we no longer use. --- .github/workflows/{black.yml => format.yml} | 0 .github/workflows/{flake8.yml => lint.yml} | 0 .github/workflows/{build-test-ci.yml => test.yml} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{black.yml => format.yml} (100%) rename .github/workflows/{flake8.yml => lint.yml} (100%) rename .github/workflows/{build-test-ci.yml => test.yml} (100%) diff --git a/.github/workflows/black.yml b/.github/workflows/format.yml similarity index 100% rename from .github/workflows/black.yml rename to .github/workflows/format.yml diff --git a/.github/workflows/flake8.yml b/.github/workflows/lint.yml similarity index 100% rename from .github/workflows/flake8.yml rename to .github/workflows/lint.yml diff --git a/.github/workflows/build-test-ci.yml b/.github/workflows/test.yml similarity index 100% rename from .github/workflows/build-test-ci.yml rename to .github/workflows/test.yml From 20cada45c03d18533cacb27b5c060665b9ee0a73 Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Fri, 5 Jan 2024 14:18:58 -0700 Subject: [PATCH 08/13] Revert "Get testing requirements from pyproject.toml" This reverts commit 085158dea07c2eeaa7b68ab68729d67efbca6f81. I need the actual list of requirements in the 'test' CI workflow because bmi-tester needs to be install through conda. --- requirements-testing.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/requirements-testing.txt b/requirements-testing.txt index 92937fa..16911dd 100644 --- a/requirements-testing.txt +++ b/requirements-testing.txt @@ -1 +1,6 @@ --e .[testing] +coveralls +flake8 +pytest +pytest-cov +six +bmi-tester From b7e2894975a5a2006428db0bb0d4c23483a47dbe Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Fri, 5 Jan 2024 14:20:53 -0700 Subject: [PATCH 09/13] Add black, isort, and ruff dependencies --- requirements-testing.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/requirements-testing.txt b/requirements-testing.txt index 16911dd..fc11c86 100644 --- a/requirements-testing.txt +++ b/requirements-testing.txt @@ -1,6 +1,7 @@ coveralls -flake8 pytest pytest-cov -six +black +isort +ruff bmi-tester From fa2a5dcbe36500d2abea0662e305139554988c6f Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Fri, 5 Jan 2024 14:21:49 -0700 Subject: [PATCH 10/13] Freshen the CI workflows --- .github/workflows/format.yml | 6 +++--- .github/workflows/lint.yml | 13 +++++-------- .github/workflows/test.yml | 24 +++++++++--------------- 3 files changed, 17 insertions(+), 26 deletions(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 0a161f5..2d7a6b9 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -1,4 +1,4 @@ -name: Black +name: Format on: [push, pull_request] @@ -14,8 +14,8 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 - uses: psf/black@stable with: args: ". --check" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index df6879f..cd1822f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,4 +1,4 @@ -name: Flake8 +name: Lint on: [push, pull_request] @@ -14,13 +14,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.8 - uses: actions/setup-python@v2 - with: - python-version: 3.8 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 - name: Lint run: | - pip install flake8 - make lint + pip install ruff + ruff check . diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4b2e7e4..f6df638 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Build/Test CI +name: Test on: [push, pull_request] @@ -20,17 +20,16 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.8", "3.9", "3.10"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - uses: conda-incubator/setup-miniconda@v2 + - uses: conda-incubator/setup-miniconda@v3 with: - auto-update-conda: true + miniforge-variant: Mambaforge + miniforge-version: latest python-version: ${{ matrix.python-version }} - channels: conda-forge - channel-priority: true - name: Show conda installation info run: | @@ -39,21 +38,16 @@ jobs: - name: Install requirements run: | - conda install mamba - mamba install --file=requirements.txt - mamba list + mamba install --file=requirements.txt --file=requirements-testing.txt - name: Build and install package run: pip install -e . - - name: Install testing dependencies - run: mamba install --file=requirements-testing.txt - - name: Test run: | pytest --cov=heat --cov-report=xml:./coverage.xml -vvv bmi-test heat:BmiHeat --config-file=./examples/heat.yaml --root-dir=./examples -vvv - name: Coveralls - if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8' - uses: AndreMiras/coveralls-python-action@v20201129 + if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' + uses: AndreMiras/coveralls-python-action@develop From 1b87fc7927ed7851c18885efc97e513a920509c5 Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Fri, 5 Jan 2024 15:14:52 -0700 Subject: [PATCH 11/13] Update status badges --- README.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 8466379..595f0d3 100644 --- a/README.rst +++ b/README.rst @@ -2,14 +2,17 @@ :target: https://bmi.readthedocs.io/ :alt: Basic Model Interface -.. image:: https://github.com/csdms/bmi-example-python/workflows/Build/Test%20CI/badge.svg - :target: https://github.com/csdms/bmi-example-python/actions?query=workflow%3A%22Build%2FTest+CI%22 +.. image:: https://github.com/csdms/bmi-example-python/actions/workflows/test.yml/badge.svg + :target: https://github.com/csdms/bmi-example-python/actions/workflows/test.yml + :alt: CI status .. image:: https://coveralls.io/repos/csdms/bmi-example-python/badge.png?branch=master :target: https://coveralls.io/r/csdms/bmi-example-python?branch=master + :alt: Coverage status .. image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/csdms/bmi + :alt: Black bmi-example-python ================== From 8b43dc774a09fc8b33735d354f54cd99941f26b1 Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Fri, 5 Jan 2024 15:15:35 -0700 Subject: [PATCH 12/13] Fix link to BMI documentation --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 595f0d3..4c1425e 100644 --- a/README.rst +++ b/README.rst @@ -69,5 +69,5 @@ To run the tests, .. _Python bindings: https://github.com/csdms/bmi-python -.. _Basic Model Interface: https://bmi-spec.readthedocs.io +.. _Basic Model Interface: https://bmi.readthedocs.io .. _README: https://github.com/csdms/bmi-python/blob/master/README.rst From 3cabb0a993579849ec6ccc14e2855d2f8843b6ac Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Fri, 5 Jan 2024 15:21:50 -0700 Subject: [PATCH 13/13] Update changelog --- CHANGES.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index e1b2eff..80bc279 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,12 @@ Changelog for bmi-example-python 2.1.2 (unreleased) ------------------ -- Nothing changed yet. +- Build and test with Python 3.12 (#29) +- Use random subpackage from numpy instead of scipy (#26) +- Add example notebooks (#25) +- Move static project metadata to pyproject.toml (#23) +- Bundle maintenance tasks (#22) +- Use declarative setuptools configuration setup.cfg (#21) 2.1.1 (2021-08-26)