Skip to content

Commit 949b296

Browse files
authored
move setup.cfg to pyproject.toml (#5262)
* move setup.cfg to pyproject.toml * refactor after #5263 * refactor after #5259 * review actions - manifest pattern * review actions * add whatsnew entry * follow-thru with #5226
1 parent d58fca7 commit 949b296

File tree

9 files changed

+143
-146
lines changed

9 files changed

+143
-146
lines changed

.flake8

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
[flake8]
2+
# References:
3+
# https://flake8.readthedocs.io/en/latest/user/configuration.html
4+
# https://flake8.readthedocs.io/en/latest/user/error-codes.html
5+
# https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes
6+
7+
max-line-length = 80
8+
max-complexity = 50
9+
select = C,E,F,W,B,B950
10+
ignore =
11+
# E203: whitespace before ':'
12+
E203,
13+
# E226: missing whitespace around arithmetic operator
14+
E226,
15+
# E231: missing whitespace after ',', ';', or ':'
16+
E231,
17+
# E402: module level imports on one line
18+
E402,
19+
# E501: line too long
20+
E501,
21+
# E731: do not assign a lambda expression, use a def
22+
E731,
23+
# W503: line break before binary operator
24+
W503,
25+
# W504: line break after binary operator
26+
W504,
27+
exclude =
28+
#
29+
# ignore the following directories
30+
#
31+
.eggs,
32+
build,
33+
docs/src/sphinxext/*,
34+
tools/*,
35+
benchmarks/*,
36+
#
37+
# ignore auto-generated files
38+
#
39+
_ff_cross_refrences.py,
40+
std_names.py,
41+
um_cf_map.py,
42+
#
43+
# ignore third-party files
44+
#
45+
gitwash_dumper.py,
46+
#
47+
# convenience imports
48+
#
49+
lib/iris/common/__init__.py

.pre-commit-config.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ repos:
4747
hooks:
4848
- id: flake8
4949
types: [file, python]
50-
args: [--config=./setup.cfg]
5150

5251
- repo: https://github.com/pycqa/isort
5352
rev: 5.12.0

MANIFEST.in

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ prune docs
44
prune etc
55
recursive-include lib *.cdl *.cml *.json *.md *.py *.template *.txt *.xml
66
prune requirements
7+
recursive-include requirements *.txt
78
prune tools
9+
exclude .flake8
810
exclude .git-blame-ignore-revs
911
exclude .git_archival.txt
1012
exclude .gitattributes
@@ -20,8 +22,8 @@ exclude Makefile
2022
exclude noxfile.py
2123

2224
# files required to build iris.std_names module
23-
include tools/generate_std_names.py
2425
include etc/cf-standard-name-table.xml
26+
include tools/generate_std_names.py
2527

2628
global-exclude *.py[cod]
2729
global-exclude __pycache__

docs/src/whatsnew/latest.rst

+5
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ This document explains the changes made to Iris for this release
8989
#. `@rcomer`_ removed a now redundant copying workaround from Resolve testing.
9090
(:pull:`5267`)
9191

92+
#. `@bjlittle`_ and `@trexfeathers`_ (reviewer) migrated ``setup.cfg`` to
93+
``pyproject.toml``, as motivated by `PEP-0621`_. (:pull:`5262`)
94+
95+
9296
.. comment
9397
Whatsnew author names (@github name) in alphabetical order. Note that,
9498
core dev names are automatically included by the common_links.inc:
@@ -102,3 +106,4 @@ This document explains the changes made to Iris for this release
102106
.. _sphinx-panels: https://github.com/executablebooks/sphinx-panels
103107
.. _sphinx-design: https://github.com/executablebooks/sphinx-design
104108
.. _check-manifest: https://github.com/mgedmin/check-manifest
109+
.. _PEP-0621: https://peps.python.org/pep-0621/

lib/iris/tests/test_coding_standards.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_python_versions():
7979
benchmarks_dir = root_dir / "benchmarks"
8080

8181
# Places that are checked:
82-
setup_cfg_file = root_dir / "setup.cfg"
82+
pyproject_toml_file = root_dir / "pyproject.toml"
8383
requirements_dir = root_dir / "requirements"
8484
nox_file = root_dir / "noxfile.py"
8585
ci_wheels_file = workflows_dir / "ci-wheels.yml"
@@ -89,10 +89,10 @@ def test_python_versions():
8989

9090
text_searches: List[Tuple[Path, str]] = [
9191
(
92-
setup_cfg_file,
92+
pyproject_toml_file,
9393
"\n ".join(
9494
[
95-
"Programming Language :: Python :: " + ver
95+
f'"Programming Language :: Python :: {ver}",'
9696
for ver in all_supported
9797
]
9898
),

pyproject.toml

+63
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,69 @@ requires = [
88
# Defined by PEP 517
99
build-backend = "setuptools.build_meta"
1010

11+
[project]
12+
authors = [
13+
{name = "Iris Contributors", email = "[email protected]"}
14+
]
15+
classifiers = [
16+
"Development Status :: 5 - Production/Stable",
17+
"Intended Audience :: Science/Research",
18+
"License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",
19+
"Operating System :: MacOS",
20+
"Operating System :: POSIX",
21+
"Operating System :: POSIX :: Linux",
22+
"Operating System :: Unix",
23+
"Programming Language :: Python",
24+
"Programming Language :: Python :: 3 :: Only",
25+
"Programming Language :: Python :: 3.8",
26+
"Programming Language :: Python :: 3.9",
27+
"Programming Language :: Python :: 3.10",
28+
"Programming Language :: Python :: 3.11",
29+
"Programming Language :: Python :: Implementation :: CPython",
30+
"Topic :: Scientific/Engineering",
31+
"Topic :: Scientific/Engineering :: Atmospheric Science",
32+
"Topic :: Scientific/Engineering :: Visualization",
33+
]
34+
dynamic = [
35+
"dependencies",
36+
"readme",
37+
"version",
38+
]
39+
description = "A powerful, format-agnostic, community-driven Python package for analysing and visualising Earth science data"
40+
keywords = [
41+
"cf-metadata",
42+
"data-analysis",
43+
"earth-science",
44+
"grib",
45+
"netcdf",
46+
"meteorology",
47+
"oceanography",
48+
"space-weather",
49+
"ugrid",
50+
"visualisation",
51+
]
52+
license = {text = "LGPL-3.0-or-later"}
53+
name = "scitools-iris"
54+
requires-python = ">=3.8"
55+
56+
[project.urls]
57+
Code = "https://github.com/SciTools/iris"
58+
Discussions = "https://github.com/SciTools/iris/discussions"
59+
Documentation = "https://scitools-iris.readthedocs.io/en/stable/"
60+
Issues = "https://github.com/SciTools/iris/issues"
61+
62+
[tool.setuptools]
63+
license-files = ["COPYING", "COPYING.LESSER"]
64+
zip-safe = false
65+
66+
[tool.setuptools.dynamic]
67+
dependencies = {file = "requirements/pypi-core.txt"}
68+
readme = {file = "README.md", content-type = "text/markdown"}
69+
70+
[tool.setuptools.packages.find]
71+
include = ["iris*"]
72+
where = ["lib"]
73+
1174
[tool.setuptools_scm]
1275
write_to = "lib/iris/_version.py"
1376
local_scheme = "dirty-tag"

requirements/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# ⚠️
2+
3+
This directory contains:
4+
5+
- The `locks` directory which contains auto-generated `conda-lock` environment files for each `python` distribution and `platform` supported by `iris`.
6+
- The **top-level** `conda` environment `*.yml` files for each `python` distribution supported by `iris`.
7+
- The `pip` core package dependencies (`pypi-core.txt`) for the [scitools-iris](https://pypi.org/project/scitools-iris/) package on PyPI. Please reference the `pyproject.toml` in the repository root directory for further details.
8+

requirements/pypi-core.txt

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
cartopy>=0.21
2+
cf-units>=3.1
3+
cftime>=1.5.0
4+
dask[array]>=2022.9.0
5+
# libnetcdf<4.9 (not available on PyPI)
6+
matplotlib>=3.5
7+
netcdf4
8+
numpy>=1.19
9+
pyproj
10+
scipy
11+
shapely!=1.8.3
12+
xxhash

setup.cfg

-141
This file was deleted.

0 commit comments

Comments
 (0)