diff --git a/.flake8 b/.flake8 new file mode 100644 index 000000000..4da080b2c --- /dev/null +++ b/.flake8 @@ -0,0 +1,16 @@ +[flake8] +# https://pep8.readthedocs.io/en/latest/intro.html#error-codes +ignore = + # line break after operator + W504 +# Max width of Github code review is 79 characters +max-line-length = 79 +max-complexity = 18 +per-file-ignores = + */__init__.py: F401 +exclude = + .git, + docs, + .idea, + .mypy_cache, + .pytest_cache, diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4e52531a9..b9fb5531e 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,7 +30,7 @@ repos: rev: 7.1.1 hooks: - id: flake8 - args: ["--config=setup.cfg"] + args: ["--config=.flake8"] additional_dependencies: [flake8-isort] # Can run individually with `pre-commit run mypy --all-files` @@ -38,7 +38,7 @@ repos: rev: v1.11.2 hooks: - id: mypy - args: ["--config=setup.cfg", "--show-error-codes"] + args: ["--config=pyproject.toml", "--show-error-codes"] verbose: true additional_dependencies: ['types-requests'] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..bef85afa2 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,77 @@ +[project] +name = "polaris" +dynamic = ["version"] +authors = [ + { name="Xylar Asay-Davis", email="xylar@lanl.gov" }, + { name="Althea Denlinger", email="althea@lanl.gov" } +] +description = "Testing and analysis for Omega, MPAS-Ocean, MALI and MPAS-Seaice" +license = {file = "LICENSE"} +readme = "README.md" +requires-python = ">=3.9" +classifiers = [ + # these are only for searching/browsing projects on PyPI + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", +] + +dependencies = [ + "cartopy", + "cmocean", + "importlib_resources", + "ipython", + "jigsawpy", + "jupyter", + "lxml", + "matplotlib>=3.9.0", + "netcdf4", + "numpy>=2.0,<3.0", + "progressbar2", + "pyamg>=4.2.2", + "pyproj", + "ruamel.yaml", + "requests", + "scipy>=1.8.0", + "shapely>=2.0,<3.0", + "xarray", +] + +[tool.isort] +multi_line_output = "3" +include_trailing_comma = true +force_grid_wrap = "0" +use_parentheses = true +line_length = "79" +skip = ["e3sm_diags/e3sm_diags_driver.py"] + +[tool.mypy] +python_version = "3.10" +check_untyped_defs = true +ignore_missing_imports = true +warn_unused_ignores = true +warn_redundant_casts = true +warn_unused_configs = true + +[build-system] +requires = ["setuptools>=60"] +build-backend = "setuptools.build_meta" + +[tool.setuptools.packages.find] +exclude = ["docs*", "conda*"] + +[tool.setuptools.dynamic] +version = { attr = "polaris.version.__version__" } + +# evolution of options.entry-points +[project.scripts] +polaris = "polaris.__main__:main" +mpas_to_yaml = "polaris.yaml:main_mpas_to_yaml" + +[project.urls] +Documentation = "https://docs.e3sm.org/polaris" +"Bug Tracker" = "https://github.com/E3SM-Project/polaris/issues" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 3cddead30..000000000 --- a/setup.cfg +++ /dev/null @@ -1,92 +0,0 @@ -[metadata] -name = polaris -version = attr: polaris.version.__version__ -author = E3SM Development Team -author_email = xylar@lanl.gov -description = Testing and analysis for Omega, MPAS-Ocean, MALI and MPAS-Seaice -long_description = file: README.md -long_description_content_type = text/markdown -url = https://github.com/E3SM-Project/polaris -project_urls = - Bug Tracker = https://github.com/E3SM-Project/polaris/issues -classifiers = - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: 3.12 - License :: OSI Approved :: BSD License - Operating System :: OS Independent - -[options] -packages = find: -include_package_data = True -python_requires = >=3.9,<=3.12 -install_requires = - cartopy - cmocean - importlib_resources - ipython - jigsawpy - jupyter - lxml - matplotlib>=3.9.0 - netcdf4 - numpy>=2.0,<3.0 - progressbar2 - pyamg>=4.2.2 - pyproj - ruamel.yaml - requests - scipy>=1.8.0 - shapely>=2.0,<3.0 - xarray - -[options.entry_points] -console_scripts = - polaris = polaris.__main__:main - mpas_to_yaml = polaris.yaml:main_mpas_to_yaml - -[flake8] -# https://pep8.readthedocs.io/en/latest/intro.html#error-codes -ignore = - # line break after operator - W504 -# Max width of Github code review is 79 characters -max-line-length = 79 -max-complexity = 18 -per-file-ignores = - */__init__.py: F401 -exclude = - .git, - docs, - .idea, - .mypy_cache, - .pytest_cache, - -[isort] -multi_line_output=3 -include_trailing_comma=True -force_grid_wrap=0 -use_parentheses=True -line_length=79 -skip= - e3sm_diags/e3sm_diags_driver.py - -[pycodestyle] -max-line-length = 79 -exclude = - .git - docs - .idea - .mypy_cache - .pytest_cache - -[mypy] -python_version = 3.10 -check_untyped_defs = True -ignore_missing_imports = True -warn_unused_ignores = True -warn_redundant_casts = True -warn_unused_configs = True diff --git a/setup.py b/setup.py deleted file mode 100644 index 7f1a1763c..000000000 --- a/setup.py +++ /dev/null @@ -1,4 +0,0 @@ -from setuptools import setup - -if __name__ == "__main__": - setup()