Skip to content

Commit 1663dbb

Browse files
authored
Build and test with Python 3.12 (#29)
* Remove stubbed setup.py * 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. * Remove obsolete six dependency * Get testing requirements from pyproject.toml * Use ruff instead of flake8 for linting The flake8 config was the last in setup.cfg, so I removed it. * Add black and isort to testing dependencies I thought about making a set of 'dev' dependencies, but it seemed like overkill. * Rename workflow files based on topic They had been named based on package; e.g., flake8, which we no longer use. * Revert "Get testing requirements from pyproject.toml" This reverts commit 085158d. I need the actual list of requirements in the 'test' CI workflow because bmi-tester needs to be install through conda. * Add black, isort, and ruff dependencies * Freshen the CI workflows * Update status badges * Fix link to BMI documentation * Update changelog
1 parent 44c7d4c commit 1663dbb

11 files changed

Lines changed: 63 additions & 68 deletions

File tree

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Black
1+
name: Format
22

33
on: [push, pull_request]
44

@@ -14,8 +14,8 @@ jobs:
1414

1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v2
18-
- uses: actions/setup-python@v2
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-python@v4
1919
- uses: psf/black@stable
2020
with:
2121
args: ". --check"
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Flake8
1+
name: Lint
22

33
on: [push, pull_request]
44

@@ -14,13 +14,10 @@ jobs:
1414

1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v2
18-
- name: Set up Python 3.8
19-
uses: actions/setup-python@v2
20-
with:
21-
python-version: 3.8
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-python@v4
2219

2320
- name: Lint
2421
run: |
25-
pip install flake8
26-
make lint
22+
pip install ruff
23+
ruff check .
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build/Test CI
1+
name: Test
22

33
on: [push, pull_request]
44

@@ -20,17 +20,16 @@ jobs:
2020
strategy:
2121
matrix:
2222
os: [ubuntu-latest, macos-latest, windows-latest]
23-
python-version: ["3.8", "3.9", "3.10"]
23+
python-version: ["3.9", "3.10", "3.11", "3.12"]
2424

2525
steps:
26-
- uses: actions/checkout@v2
26+
- uses: actions/checkout@v4
2727

28-
- uses: conda-incubator/setup-miniconda@v2
28+
- uses: conda-incubator/setup-miniconda@v3
2929
with:
30-
auto-update-conda: true
30+
miniforge-variant: Mambaforge
31+
miniforge-version: latest
3132
python-version: ${{ matrix.python-version }}
32-
channels: conda-forge
33-
channel-priority: true
3433

3534
- name: Show conda installation info
3635
run: |
@@ -39,21 +38,16 @@ jobs:
3938
4039
- name: Install requirements
4140
run: |
42-
conda install mamba
43-
mamba install --file=requirements.txt
44-
mamba list
41+
mamba install --file=requirements.txt --file=requirements-testing.txt
4542
4643
- name: Build and install package
4744
run: pip install -e .
4845

49-
- name: Install testing dependencies
50-
run: mamba install --file=requirements-testing.txt
51-
5246
- name: Test
5347
run: |
5448
pytest --cov=heat --cov-report=xml:./coverage.xml -vvv
5549
bmi-test heat:BmiHeat --config-file=./examples/heat.yaml --root-dir=./examples -vvv
5650
5751
- name: Coveralls
58-
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8'
59-
uses: AndreMiras/coveralls-python-action@v20201129
52+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
53+
uses: AndreMiras/coveralls-python-action@develop

CHANGES.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ Changelog for bmi-example-python
44
2.1.2 (unreleased)
55
------------------
66

7-
- Nothing changed yet.
7+
- Build and test with Python 3.12 (#29)
8+
- Use random subpackage from numpy instead of scipy (#26)
9+
- Add example notebooks (#25)
10+
- Move static project metadata to pyproject.toml (#23)
11+
- Bundle maintenance tasks (#22)
12+
- Use declarative setuptools configuration setup.cfg (#21)
813

914

1015
2.1.1 (2021-08-26)

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ clean-test: ## remove test and coverage artifacts
5151
rm -fr htmlcov/
5252
rm -fr .pytest_cache
5353

54-
lint: ## check style with flake8
55-
flake8 heat tests
54+
lint: ## check style with ruff
55+
ruff check . --fix
5656

5757
pretty:
5858
find heat -name '*.py' | xargs isort

README.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22
:target: https://bmi.readthedocs.io/
33
:alt: Basic Model Interface
44

5-
.. image:: https://github.com/csdms/bmi-example-python/workflows/Build/Test%20CI/badge.svg
6-
:target: https://github.com/csdms/bmi-example-python/actions?query=workflow%3A%22Build%2FTest+CI%22
5+
.. image:: https://github.com/csdms/bmi-example-python/actions/workflows/test.yml/badge.svg
6+
:target: https://github.com/csdms/bmi-example-python/actions/workflows/test.yml
7+
:alt: CI status
78

89
.. image:: https://coveralls.io/repos/csdms/bmi-example-python/badge.png?branch=master
910
:target: https://coveralls.io/r/csdms/bmi-example-python?branch=master
11+
:alt: Coverage status
1012

1113
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
1214
:target: https://github.com/csdms/bmi
15+
:alt: Black
1316

1417
bmi-example-python
1518
==================
@@ -66,5 +69,5 @@ To run the tests,
6669
6770
6871
.. _Python bindings: https://github.com/csdms/bmi-python
69-
.. _Basic Model Interface: https://bmi-spec.readthedocs.io
72+
.. _Basic Model Interface: https://bmi.readthedocs.io
7073
.. _README: https://github.com/csdms/bmi-python/blob/master/README.rst

pyproject.toml

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ name = "bmi-heat"
77
description = "BMI Python example"
88
authors = [
99
{email = "eric.hutton@colorado.edu"},
10-
{name = "The CSDMS team"}
10+
{name = "Eric Hutton"}
1111
]
1212
maintainers = [
13-
{email = "eric.hutton@colorado.edu"},
14-
{name = "The CSDMS team"}
13+
{name = "Mark Piper", email = "mark.piper@colorado.edu"},
14+
{name = "Eric Hutton", email = "eric.hutton@colorado.edu"},
1515
]
1616
keywords = [
1717
"bmi",
1818
"component modeling",
19+
"csdms",
1920
"earth science",
2021
]
2122
license = {file = "LICENSE"}
@@ -25,14 +26,14 @@ classifiers = [
2526
"License :: OSI Approved :: MIT License",
2627
"Operating System :: OS Independent",
2728
"Programming Language :: Python :: 3",
28-
"Programming Language :: Python :: 3.7",
29-
"Programming Language :: Python :: 3.8",
3029
"Programming Language :: Python :: 3.9",
3130
"Programming Language :: Python :: 3.10",
31+
"Programming Language :: Python :: 3.11",
32+
"Programming Language :: Python :: 3.12",
3233
"Programming Language :: Python :: Implementation :: CPython",
3334
"Topic :: Scientific/Engineering :: Physics",
3435
]
35-
requires-python = ">=3.7"
36+
requires-python = ">=3.9"
3637
dependencies = [
3738
"numpy",
3839
"scipy",
@@ -41,20 +42,20 @@ dependencies = [
4142
]
4243
dynamic = ["readme", "version"]
4344

44-
4545
[project.urls]
46-
homepage = "https://github.com/csdms/bmi-example-python"
47-
documentation = "https://github.com/csdms/bmi-example-python#readme"
48-
repository = "https://github.com/csdms/bmi-example-python"
49-
changelog = "https://github.com/csdms/bmi-example-python/blob/master/CHANGES.rst"
46+
Homepage = "https://csdms.colorado.edu"
47+
Documentation = "https://bmi.readthedocs.io"
48+
Repository = "https://github.com/csdms/bmi-example-python"
49+
Changelog = "https://github.com/csdms/bmi-example-python/blob/master/CHANGES.rst"
5050

5151
[project.optional-dependencies]
5252
testing = [
5353
"coveralls",
54-
"flake8",
5554
"pytest",
5655
"pytest-cov",
57-
"six",
56+
"black",
57+
"isort",
58+
"ruff",
5859
"bmi-tester",
5960
]
6061

@@ -72,7 +73,7 @@ norecursedirs = [".*", "*.egg*", "build", "dist"]
7273
addopts = """
7374
--ignore setup.py
7475
--tb native
75-
--strict
76+
--strict-markers
7677
--durations 16
7778
--doctest-modules
7879
-vvv
@@ -89,3 +90,17 @@ include_trailing_comma = true
8990
force_grid_wrap = 0
9091
combine_as_imports = true
9192
line_length = 88
93+
94+
[tool.ruff]
95+
line-length = 88
96+
ignore = [
97+
"E203",
98+
"E501",
99+
]
100+
101+
[tool.coverage.run]
102+
relative_files = true
103+
104+
[tool.zest-releaser]
105+
tag-format = "v{version}"
106+
python-file-with-version = "heat/_version.py"

requirements-testing.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
coveralls
2-
flake8
32
pytest
43
pytest-cov
5-
six
4+
black
5+
isort
6+
ruff
67
bmi-tester

setup.cfg

Lines changed: 0 additions & 16 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)