Skip to content

Commit

Permalink
[DevOps]: CDAT Migration: Replace setup.py with pyproject.toml fo…
Browse files Browse the repository at this point in the history
…r modern Python packaging (#895)
  • Loading branch information
tomvothecoder authored Nov 20, 2024
1 parent cb1cfb2 commit 7b9b9be
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 184 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ jobs:
uses: actions/checkout@v3

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

- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
# Run all pre-commit hooks on all the files.
Expand All @@ -50,7 +50,7 @@ jobs:
shell: bash -l {0}
strategy:
matrix:
python-version: ["3.9", "3.10"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
exclude: "docs|node_modules|migrations|.git|.tox|examples|analysis_data_preprocess|auxiliary_tools|conda/meta.yaml|e3sm_diags/driver/utils/zwf_functions.py"
default_stages: [commit]
default_stages: [pre-commit]
fail_fast: true

repos:
Expand Down
2 changes: 1 addition & 1 deletion conda-env/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies:
- esmpy >=8.4.0
- lxml
- mache >=0.15.0
- matplotlib-base
- matplotlib-base >=3.8.2
- netcdf4
- output_viewer >=1.3.0
- numpy >=2.0.0,<3.0.0
Expand Down
2 changes: 1 addition & 1 deletion conda-env/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies:
- esmpy >=8.4.0
- lxml
- mache >=0.15.0
- matplotlib-base
- matplotlib-base >=3.8.2
- netcdf4
- output_viewer >=1.3.0
- numpy >=2.0.0,<3.0.0
Expand Down
154 changes: 153 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,155 @@
[build-system]
requires = ["setuptools>=42", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "e3sm_diags"
dynamic = ["version"]
description = "E3SM Diagnostics"
authors = [
{ name = "Chengzhu (Jill) Zhang", email = "[email protected]" },
{ name = "Tom Vo" },
{ name = "Ryan Forsyth" },
{ name = "Chris Golaz" },
{ name = "Zeshawn Shaheen" },
]
license = { text = "BSD 3-Clause" }
readme = "README.md"
requires-python = ">=3.9"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD 3-Clause License",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"beautifulsoup4",
"cartopy >=0.17.0",
# This package is not available on PyPI.
# "cartopy_offlinedata",
"cf-units",
"dask",
"esmpy >=8.4.0",
"lxml",
"mache >=0.15.0",
"matplotlib >=3.8.2",
"netcdf4",
"output_viewer >=1.3.0",
"numpy >=2.0.0,<3.0.0",
"shapely >=2.0.0,<3.0.0",
"xarray >=2024.03.0",
"xcdat >=0.7.3,<1.0.0",
"xesmf >=0.8.7",
"xskillscore >=0.0.20",
]

[project.optional-dependencies]
test = ["pytest", "pytest-cov"]
docs = ["sphinx", "sphinx_rtd_theme", "sphinx-multiversion"]
dev = [
"black",
"flake8",
"flake8-isort",
"isort",
"mypy",
"pre-commit",
"types-PyYAML",
]

[project.urls]
Documentation = "https://docs.e3sm.org/e3sm_diags/_build/html/main/index.html"
"Issue Tracker" = "https://github.com/E3SM-Project/e3sm_diags/issues"

[project.scripts]
e3sm_diags = "e3sm_diags.e3sm_diags_driver:main"
e3sm_diags_vars = "e3sm_diags.e3sm_diags_vars:main"

[tool.setuptools.packages.find]
include = ["e3sm_diags", "e3sm_diags.*"]

[tool.setuptools.dynamic]
version = { attr = "e3sm_diags.__version__" }

[tool.setuptools.data-files]
"share/e3sm_diags" = [
"e3sm_diags/driver/acme_ne30_ocean_land_mask.nc",
"misc/e3sm_logo.png",
]

"share/e3sm_diags/viewer" = ["e3sm_diags/viewer/index_template.html"]

"share/e3sm_diags/zonal_mean_xy" = [
"e3sm_diags/driver/default_diags/zonal_mean_xy*",
"e3sm_diags/driver/default_diags/legacy_diags/zonal_mean_xy*",
]
"share/e3sm_diags/zonal_mean_2d" = [
"e3sm_diags/driver/default_diags/zonal_mean_2d_model*",
"e3sm_diags/driver/default_diags/legacy_diags/zonal_mean_2d*",
]
"share/e3sm_diags/zonal_mean_2d_stratosphere" = [
"e3sm_diags/driver/default_diags/zonal_mean_2d_stratosphere*",
]
"share/e3sm_diags/meridional_mean_2d" = [
"e3sm_diags/driver/default_diags/meridional_mean_2d*",
]
"share/e3sm_diags/lat_lon" = [
"e3sm_diags/driver/default_diags/lat_lon*",
"e3sm_diags/driver/default_diags/legacy_diags/lat_lon*",
]
"share/e3sm_diags/polar" = [
"e3sm_diags/driver/default_diags/polar*",
"e3sm_diags/driver/default_diags/legacy_diags/polar*",
]
"share/e3sm_diags/lat_lon_vector" = [
"e3sm_diags/driver/default_diags/lat_lon_vector*",
]
"share/e3sm_diags/lat_lon_land" = [
"e3sm_diags/driver/default_diags/lat_lon_land*",
]
"share/e3sm_diags/lat_lon_river" = [
"e3sm_diags/driver/default_diags/lat_lon_river*",
]
"share/e3sm_diags/cosp_histogram" = [
"e3sm_diags/driver/default_diags/cosp_histogram*",
"e3sm_diags/driver/default_diags/legacy_diags/cosp_histogram*",
]
"share/e3sm_diags/area_mean_time_series" = [
"e3sm_diags/driver/default_diags/area_mean_time_series*",
]
"share/e3sm_diags/enso_diags" = ["e3sm_diags/driver/default_diags/enso_*"]
"share/e3sm_diags/qbo" = ["e3sm_diags/driver/default_diags/qbo*"]
"share/e3sm_diags/streamflow" = ["e3sm_diags/driver/default_diags/streamflow*"]
"share/e3sm_diags/diurnal_cycle" = [
"e3sm_diags/driver/default_diags/diurnal_cycle_*",
]
"share/e3sm_diags/arm_diags" = ["e3sm_diags/driver/default_diags/arm_diags_*"]
"share/e3sm_diags/tc_analysis" = [
"e3sm_diags/driver/default_diags/tc_analysis_*",
]
"share/e3sm_diags/annual_cycle_zonal_mean" = [
"e3sm_diags/driver/default_diags/annual_cycle_zonal_mean_*",
]
"share/e3sm_diags/aerosol_aeronet" = [
"e3sm_diags/driver/default_diags/aerosol_aeronet*cfg",
"e3sm_diags/driver/default_diags/aerosol_aeronet_data/*.txt",
]
"share/e3sm_diags/aerosol_budget" = [
"e3sm_diags/driver/default_diags/aerosol_budget*cfg",
]
"share/e3sm_diags/mp_partition" = [
"e3sm_diags/driver/default_diags/mp_partition*cfg",
]
"share/e3sm_diags/tropical_subseasonal" = [
"e3sm_diags/driver/default_diags/tropical_subseasonal*cfg",
]
"share/e3sm_diags/colormaps" = ["e3sm_diags/plot/colormaps/*.rgb"]
"share/e3sm_diags/control_runs" = ["e3sm_diags/driver/control_runs/*"]

[tool.black]
# Docs: https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html
line-length = 88
Expand All @@ -20,7 +172,7 @@ exclude = '''
| config
| conda
| analysis_data_preprocess
)/
)/
'''

[tool.isort]
Expand Down
174 changes: 0 additions & 174 deletions setup.py

This file was deleted.

3 changes: 0 additions & 3 deletions tbump.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ tag_template = "v{new_version}"
# For each file to patch, add a [[file]] config
# section containing the path of the file, relative to the
# tbump.toml location.
[[file]]
src = "setup.py"

[[file]]
src = "e3sm_diags/__init__.py"

Expand Down

0 comments on commit 7b9b9be

Please sign in to comment.