Skip to content

Commit c6d2d5b

Browse files
committed
[DevOps]: CDAT Migration: Replace setup.py with pyproject.toml for modern Python packaging (#895)
1 parent a243ab5 commit c6d2d5b

File tree

6 files changed

+159
-10
lines changed

6 files changed

+159
-10
lines changed

.github/workflows/build_workflow.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ jobs:
2929
uses: actions/checkout@v3
3030

3131
- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
32-
name: Set up Python 3.10
32+
name: Set up Python 3.11
3333
uses: actions/setup-python@v3
3434
with:
35-
python-version: "3.10"
35+
python-version: "3.11"
3636

3737
- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
3838
# Run all pre-commit hooks on all the files.
@@ -50,7 +50,7 @@ jobs:
5050
shell: bash -l {0}
5151
strategy:
5252
matrix:
53-
python-version: ["3.9", "3.10"]
53+
python-version: ["3.9", "3.10", "3.11", "3.12"]
5454
steps:
5555
- id: skip_check
5656
uses: fkirc/skip-duplicate-actions@master

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
exclude: "docs|node_modules|migrations|.git|.tox|examples|analysis_data_preprocess|auxiliary_tools|conda/meta.yaml|e3sm_diags/driver/utils/zwf_functions.py"
2-
default_stages: [commit]
2+
default_stages: [pre-commit]
33
fail_fast: true
44

55
repos:

conda-env/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies:
1818
- esmpy >=8.4.0
1919
- lxml
2020
- mache >=0.15.0
21-
- matplotlib-base
21+
- matplotlib-base >=3.8.2
2222
- netcdf4
2323
- output_viewer >=1.3.0
2424
- numpy >=2.0.0,<3.0.0

conda-env/dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dependencies:
1616
- esmpy >=8.4.0
1717
- lxml
1818
- mache >=0.15.0
19-
- matplotlib-base
19+
- matplotlib-base >=3.8.2
2020
- netcdf4
2121
- output_viewer >=1.3.0
2222
- numpy >=2.0.0,<3.0.0

pyproject.toml

Lines changed: 153 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,155 @@
1+
[build-system]
2+
requires = ["setuptools>=42", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "e3sm_diags"
7+
dynamic = ["version"]
8+
description = "E3SM Diagnostics"
9+
authors = [
10+
{ name = "Chengzhu (Jill) Zhang", email = "[email protected]" },
11+
{ name = "Tom Vo" },
12+
{ name = "Ryan Forsyth" },
13+
{ name = "Chris Golaz" },
14+
{ name = "Zeshawn Shaheen" },
15+
]
16+
license = { text = "BSD 3-Clause" }
17+
readme = "README.md"
18+
requires-python = ">=3.9"
19+
classifiers = [
20+
"Development Status :: 5 - Production/Stable",
21+
"Intended Audience :: Developers",
22+
"License :: OSI Approved :: BSD 3-Clause License",
23+
"Natural Language :: English",
24+
"Programming Language :: Python :: 3",
25+
"Programming Language :: Python :: 3.9",
26+
"Programming Language :: Python :: 3.10",
27+
"Programming Language :: Python :: 3.11",
28+
"Programming Language :: Python :: 3.12",
29+
]
30+
dependencies = [
31+
"beautifulsoup4",
32+
"cartopy >=0.17.0",
33+
# This package is not available on PyPI.
34+
# "cartopy_offlinedata",
35+
"cf-units",
36+
"dask",
37+
"esmpy >=8.4.0",
38+
"lxml",
39+
"mache >=0.15.0",
40+
"matplotlib >=3.8.2",
41+
"netcdf4",
42+
"output_viewer >=1.3.0",
43+
"numpy >=2.0.0,<3.0.0",
44+
"shapely >=2.0.0,<3.0.0",
45+
"xarray >=2024.03.0",
46+
"xcdat >=0.7.3,<1.0.0",
47+
"xesmf >=0.8.7",
48+
"xskillscore >=0.0.20",
49+
]
50+
51+
[project.optional-dependencies]
52+
test = ["pytest", "pytest-cov"]
53+
docs = ["sphinx", "sphinx_rtd_theme", "sphinx-multiversion"]
54+
dev = [
55+
"black",
56+
"flake8",
57+
"flake8-isort",
58+
"isort",
59+
"mypy",
60+
"pre-commit",
61+
"types-PyYAML",
62+
]
63+
64+
[project.urls]
65+
Documentation = "https://docs.e3sm.org/e3sm_diags/_build/html/main/index.html"
66+
"Issue Tracker" = "https://github.com/E3SM-Project/e3sm_diags/issues"
67+
68+
[project.scripts]
69+
e3sm_diags = "e3sm_diags.e3sm_diags_driver:main"
70+
e3sm_diags_vars = "e3sm_diags.e3sm_diags_vars:main"
71+
72+
[tool.setuptools.packages.find]
73+
include = ["e3sm_diags", "e3sm_diags.*"]
74+
75+
[tool.setuptools.dynamic]
76+
version = { attr = "e3sm_diags.__version__" }
77+
78+
[tool.setuptools.data-files]
79+
"share/e3sm_diags" = [
80+
"e3sm_diags/driver/acme_ne30_ocean_land_mask.nc",
81+
"misc/e3sm_logo.png",
82+
]
83+
84+
"share/e3sm_diags/viewer" = ["e3sm_diags/viewer/index_template.html"]
85+
86+
"share/e3sm_diags/zonal_mean_xy" = [
87+
"e3sm_diags/driver/default_diags/zonal_mean_xy*",
88+
"e3sm_diags/driver/default_diags/legacy_diags/zonal_mean_xy*",
89+
]
90+
"share/e3sm_diags/zonal_mean_2d" = [
91+
"e3sm_diags/driver/default_diags/zonal_mean_2d_model*",
92+
"e3sm_diags/driver/default_diags/legacy_diags/zonal_mean_2d*",
93+
]
94+
"share/e3sm_diags/zonal_mean_2d_stratosphere" = [
95+
"e3sm_diags/driver/default_diags/zonal_mean_2d_stratosphere*",
96+
]
97+
"share/e3sm_diags/meridional_mean_2d" = [
98+
"e3sm_diags/driver/default_diags/meridional_mean_2d*",
99+
]
100+
"share/e3sm_diags/lat_lon" = [
101+
"e3sm_diags/driver/default_diags/lat_lon*",
102+
"e3sm_diags/driver/default_diags/legacy_diags/lat_lon*",
103+
]
104+
"share/e3sm_diags/polar" = [
105+
"e3sm_diags/driver/default_diags/polar*",
106+
"e3sm_diags/driver/default_diags/legacy_diags/polar*",
107+
]
108+
"share/e3sm_diags/lat_lon_vector" = [
109+
"e3sm_diags/driver/default_diags/lat_lon_vector*",
110+
]
111+
"share/e3sm_diags/lat_lon_land" = [
112+
"e3sm_diags/driver/default_diags/lat_lon_land*",
113+
]
114+
"share/e3sm_diags/lat_lon_river" = [
115+
"e3sm_diags/driver/default_diags/lat_lon_river*",
116+
]
117+
"share/e3sm_diags/cosp_histogram" = [
118+
"e3sm_diags/driver/default_diags/cosp_histogram*",
119+
"e3sm_diags/driver/default_diags/legacy_diags/cosp_histogram*",
120+
]
121+
"share/e3sm_diags/area_mean_time_series" = [
122+
"e3sm_diags/driver/default_diags/area_mean_time_series*",
123+
]
124+
"share/e3sm_diags/enso_diags" = ["e3sm_diags/driver/default_diags/enso_*"]
125+
"share/e3sm_diags/qbo" = ["e3sm_diags/driver/default_diags/qbo*"]
126+
"share/e3sm_diags/streamflow" = ["e3sm_diags/driver/default_diags/streamflow*"]
127+
"share/e3sm_diags/diurnal_cycle" = [
128+
"e3sm_diags/driver/default_diags/diurnal_cycle_*",
129+
]
130+
"share/e3sm_diags/arm_diags" = ["e3sm_diags/driver/default_diags/arm_diags_*"]
131+
"share/e3sm_diags/tc_analysis" = [
132+
"e3sm_diags/driver/default_diags/tc_analysis_*",
133+
]
134+
"share/e3sm_diags/annual_cycle_zonal_mean" = [
135+
"e3sm_diags/driver/default_diags/annual_cycle_zonal_mean_*",
136+
]
137+
"share/e3sm_diags/aerosol_aeronet" = [
138+
"e3sm_diags/driver/default_diags/aerosol_aeronet*cfg",
139+
"e3sm_diags/driver/default_diags/aerosol_aeronet_data/*.txt",
140+
]
141+
"share/e3sm_diags/aerosol_budget" = [
142+
"e3sm_diags/driver/default_diags/aerosol_budget*cfg",
143+
]
144+
"share/e3sm_diags/mp_partition" = [
145+
"e3sm_diags/driver/default_diags/mp_partition*cfg",
146+
]
147+
"share/e3sm_diags/tropical_subseasonal" = [
148+
"e3sm_diags/driver/default_diags/tropical_subseasonal*cfg",
149+
]
150+
"share/e3sm_diags/colormaps" = ["e3sm_diags/plot/colormaps/*.rgb"]
151+
"share/e3sm_diags/control_runs" = ["e3sm_diags/driver/control_runs/*"]
152+
1153
[tool.black]
2154
# Docs: https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html
3155
line-length = 88
@@ -20,7 +172,7 @@ exclude = '''
20172
| config
21173
| conda
22174
| analysis_data_preprocess
23-
)/
175+
)/
24176
'''
25177

26178
[tool.isort]

tbump.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ tag_template = "v{new_version}"
2222
# For each file to patch, add a [[file]] config
2323
# section containing the path of the file, relative to the
2424
# tbump.toml location.
25-
[[file]]
26-
src = "setup.py"
27-
2825
[[file]]
2926
src = "e3sm_diags/__init__.py"
3027

0 commit comments

Comments
 (0)