From 6c56e748a840449fee76c7c9a58930002216ec5d Mon Sep 17 00:00:00 2001 From: Elias Sadek Date: Thu, 21 Nov 2024 16:22:32 +0000 Subject: [PATCH 1/6] removed references to pytest, metadata and options from setup.cfg. added pytest to .toml --- pyproject.toml | 15 +++++++++++---- setup.cfg | 44 -------------------------------------------- 2 files changed, 11 insertions(+), 48 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 84e8bb6..d7a4509 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ [tool.black] line-length = 79 -target-version = ["py37", "py38", "py39", "py310"] +target-version = ["py38", "py39", "py310", "py311"] include = '\.pyi?$' [project] @@ -53,6 +53,16 @@ requires = ["setuptools>=45"] # Defined by PEP 517 build-backend = "setuptools.build_meta" +[tool.pytest.ini_options] +minversion = "6.0" +addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"] +xfail_strict = true +filterwarnings = ["error"] +log_cli_level = "info" +testpaths = [ + "tephi", +] + [tool.repo-review] # These are a list of the currently failing tests: ignore = [ @@ -64,9 +74,6 @@ ignore = [ # TODO: exceptions that still need investigating are below. Might be fixable, or might become permanent (above): - # https://learn.scientific-python.org/development/guides/pytest/#PP301 - "PP301", # Has pytest in pyproject - # https://learn.scientific-python.org/development/guides/gha-basic/#GH212 "GH212", # Require GHA update grouping diff --git a/setup.cfg b/setup.cfg index 65cf4f9..0df43f3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,50 +19,6 @@ addopts = --doctest-modules doctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS NUMBER -[metadata] -name = tephi -version = attr: tephi.__version__ -author = UK Met Office -author_email = scitools-iris-dev@googlegroups.com -url = https://github.com/SciTools/tephi -classifiers = - Development Status :: 4 - Beta - Intended Audience :: Science/Research - Operating System :: OS Independent - License :: OSI Approved :: BSD License - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Topic :: Scientific/Engineering :: Atmospheric Science - Topic :: Scientific/Engineering :: Visualization -license_files = LICENSE -description = Tephigram plotting in Python -long_description = file: README.md -long_description_content_type = text/markdown -project_urls = - code = https://github.com/SciTools/tephi - issues = https://github.com/SciTools/tephi/issues - binder = https://mybinder.org/v2/gh/SciTools/tephi/main?filepath=index.ipynb - documentation = https://tephi.readthedocs.io/en/latest/ -keywords = - tephigram - radiosonde - meteorology - visualization - -[options] -packages = find: -setup_requires = - setuptools>=40.8.0 - wheel -install_requires = - matplotlib - numpy - scipy -python_requires = >=3.8 - [options.package_data] tephi = etc/test_data/*.txt From 7471e1c5aa0570a1fcb3b797e2e950e9f5f8a43b Mon Sep 17 00:00:00 2001 From: Elias Sadek Date: Thu, 21 Nov 2024 16:32:00 +0000 Subject: [PATCH 2/6] removed setup.py --- .flake8 | 28 ---------------------------- pyproject.toml | 7 +++++++ setup.cfg | 26 -------------------------- setup.py | 11 ----------- 4 files changed, 7 insertions(+), 65 deletions(-) delete mode 100644 .flake8 delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 02b0915..0000000 --- a/.flake8 +++ /dev/null @@ -1,28 +0,0 @@ -[flake8] -# References: -# https://flake8.readthedocs.io/en/latest/user/configuration.html -# https://flake8.readthedocs.io/en/latest/user/error-codes.html -# https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes - -ignore = - # E203: whitespace before ':' - E203, - # E226: missing whitespace around arithmetic operator - E226, - # E231: missing whitespace after ',', ';', or ':' - E231, - # E402: module level imports on one line - E402, - # E501: line too long - E501, - # W503: line break before binary operator - W503, - # W504: line break after binary operator - W504, -exclude = - # - # ignore the following directories - # - .eggs, - build, - sphinxext, diff --git a/pyproject.toml b/pyproject.toml index d7a4509..fbbc026 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,6 +53,13 @@ requires = ["setuptools>=45"] # Defined by PEP 517 build-backend = "setuptools.build_meta" +[tool.setuptools.package-data] +mypkg = [ + "etc/test_data/*.txt", + "tests/results/*.npz", + "tests/results/imagerepo.json" +] + [tool.pytest.ini_options] minversion = "6.0" addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 0df43f3..0000000 --- a/setup.cfg +++ /dev/null @@ -1,26 +0,0 @@ -[flake8] -exclude = - .git, - docs, - tephi/tests/__init__.py - .eggs - -[tool:pytest] -testpaths = - tephi/ -markers = - graphical: mark a test as a graphical test -addopts = - -ra - -v - --cov-config=.coveragerc - --cov=tephi - --cov-report=term-missing - --doctest-modules -doctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS NUMBER - -[options.package_data] -tephi = - etc/test_data/*.txt - tests/results/*.npz - tests/results/imagerepo.json diff --git a/setup.py b/setup.py deleted file mode 100644 index 093148b..0000000 --- a/setup.py +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env python -"""A file to be used for installing or building the package.""" -# Copyright Tephi contributors -# -# This file is part of Tephi and is released under the BSD license. -# See LICENSE in the root of the repository for full licensing details. - -from setuptools import setup - -if __name__ == "__main__": - setup() From d03ae080d6b95760b67e0f712026e4f420e068bb Mon Sep 17 00:00:00 2001 From: Elias Sadek Date: Thu, 21 Nov 2024 17:02:58 +0000 Subject: [PATCH 3/6] added tox to pyproj.toml. I expect this to fail --- pyproject.toml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index fbbc026..191ab6f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -193,3 +193,32 @@ known-first-party = ["tephi"] [tool.ruff.lint.pydocstyle] convention = "numpy" + +[tool.tox] +requires = ["tox-conda"] +env_list = ["3.8", "3.9", "3.10", "3.11"] +base_python = [""] + +[tool.tox.env.tests] +description = "invoke pytest to run automated tests" +deps = [ + "pytest", + "pytest-cov", + "filelock", + "requests", + "imagehash", + ] +conda_env = "requirements/dev.yml" +commands = ["pytest --cov tephi --cov-report term-missing {posargs}"] + +[tool.toox.env.doctests] +description = "invoke sphinx-build to build the docs/run the doctests" +set_env.DOCSDIR = "/docs/source" +set_env.BUILDDIR = "/docs/_build" +conda_env = "requirements/rtd.yml" +commands = [ + ["sphinx-apidoc -o", "{env:DOCSDIR}/api", "tephi tephi/tests"], + ["sphinx-build -W --keep-going -b html -d", "{env:BUILDDIR}/doctrees", "{env:DOCSDIR}", "{env:BUILDDIR}/html", "{posargs}"], + ["doctests: sphinx-build -b doctest -d", "{env:BUILDDIR}/doctrees", "{env:DOCSDIR}", "{env:BUILDDIR}/doctest", "{posargs}"] +] + From 9696c16a60ac8062516d5add1272be114138b29a Mon Sep 17 00:00:00 2001 From: Elias Sadek Date: Thu, 21 Nov 2024 17:03:18 +0000 Subject: [PATCH 4/6] deleted tox.ini --- tox.ini | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 tox.ini diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 7f7b389..0000000 --- a/tox.ini +++ /dev/null @@ -1,32 +0,0 @@ -[tox] -requires = - tox-conda -minversion = 3.15 -base_python = py311 -envlist=py{38,39,310,311} - -[testenv] -description = invoke pytest to run automated tests -deps = - pytest - pytest-cov - filelock - requests - imagehash -conda_env = requirements/dev.yml -commands = - pytest --cov tephi --cov-report term-missing {posargs} - -[testenv:{docs,doctests}] -description = - invoke sphinx-build to build the docs/run the doctests -setenv = - DOCSDIR = {toxinidir}/docs/source - BUILDDIR = {toxinidir}/docs/_build -conda_env = requirements/rtd.yml -commands = - sphinx-apidoc -o "{env:DOCSDIR}/api" tephi tephi/tests - sphinx-build -W --keep-going -b html -d "{env:BUILDDIR}/doctrees" "{env:DOCSDIR}" "{env:BUILDDIR}/html" {posargs} - # when running the doctests, also check that any snippets in the - # docs are representative of the module output - doctests: sphinx-build -b doctest -d "{env:BUILDDIR}/doctrees" "{env:DOCSDIR}" "{env:BUILDDIR}/doctest" {posargs} From b8c6efbcd05475c80343251901645e24a23b35da Mon Sep 17 00:00:00 2001 From: Elias Sadek Date: Thu, 21 Nov 2024 17:08:54 +0000 Subject: [PATCH 5/6] for now, isolated to tox.toml --- pyproject.toml | 29 ----------------------------- tox.toml | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 29 deletions(-) create mode 100644 tox.toml diff --git a/pyproject.toml b/pyproject.toml index 191ab6f..fbbc026 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -193,32 +193,3 @@ known-first-party = ["tephi"] [tool.ruff.lint.pydocstyle] convention = "numpy" - -[tool.tox] -requires = ["tox-conda"] -env_list = ["3.8", "3.9", "3.10", "3.11"] -base_python = [""] - -[tool.tox.env.tests] -description = "invoke pytest to run automated tests" -deps = [ - "pytest", - "pytest-cov", - "filelock", - "requests", - "imagehash", - ] -conda_env = "requirements/dev.yml" -commands = ["pytest --cov tephi --cov-report term-missing {posargs}"] - -[tool.toox.env.doctests] -description = "invoke sphinx-build to build the docs/run the doctests" -set_env.DOCSDIR = "/docs/source" -set_env.BUILDDIR = "/docs/_build" -conda_env = "requirements/rtd.yml" -commands = [ - ["sphinx-apidoc -o", "{env:DOCSDIR}/api", "tephi tephi/tests"], - ["sphinx-build -W --keep-going -b html -d", "{env:BUILDDIR}/doctrees", "{env:DOCSDIR}", "{env:BUILDDIR}/html", "{posargs}"], - ["doctests: sphinx-build -b doctest -d", "{env:BUILDDIR}/doctrees", "{env:DOCSDIR}", "{env:BUILDDIR}/doctest", "{posargs}"] -] - diff --git a/tox.toml b/tox.toml new file mode 100644 index 0000000..c19db38 --- /dev/null +++ b/tox.toml @@ -0,0 +1,26 @@ +requires = ["tox-conda"] +env_list = ["3.8", "3.9", "3.10", "3.11"] +base_python = [""] + +[env.tests] +description = "invoke pytest to run automated tests" +deps = [ + "pytest", + "pytest-cov", + "filelock", + "requests", + "imagehash", + ] +conda_env = "requirements/dev.yml" +commands = ["pytest --cov tephi --cov-report term-missing {posargs}"] + +[env.doctests] +description = "invoke sphinx-build to build the docs/run the doctests" +set_env.DOCSDIR = "/docs/source" +set_env.BUILDDIR = "/docs/_build" +conda_env = "requirements/rtd.yml" +commands = [ + ["sphinx-apidoc -o", "{env:DOCSDIR}/api", "tephi tephi/tests"], + ["sphinx-build -W --keep-going -b html -d", "{env:BUILDDIR}/doctrees", "{env:DOCSDIR}", "{env:BUILDDIR}/html", "{posargs}"], + ["doctests: sphinx-build -b doctest -d", "{env:BUILDDIR}/doctrees", "{env:DOCSDIR}", "{env:BUILDDIR}/doctest", "{posargs}"] +] From 5c99045b6e74714c3eee7d2b2b06302be3556ad7 Mon Sep 17 00:00:00 2001 From: Elias Sadek Date: Fri, 22 Nov 2024 11:13:33 +0000 Subject: [PATCH 6/6] using legacy ini --- pyproject.toml | 35 +++++++++++++++++++++++++++++++++++ tox.toml | 26 -------------------------- 2 files changed, 35 insertions(+), 26 deletions(-) delete mode 100644 tox.toml diff --git a/pyproject.toml b/pyproject.toml index fbbc026..c5cd81d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -190,6 +190,41 @@ known-first-party = ["tephi"] "ERA001", # Has commented out code ] +[tool.tox] +legacy_tox_ini = """ + [tox] + requires = + tox-conda + minversion = 3.15 + base_python = py311 + envlist=py{38,39,310,311} + + [testenv] + description = invoke pytest to run automated tests + deps = + pytest + pytest-cov + filelock + requests + imagehash + conda_env = requirements/dev.yml + commands = + pytest --cov tephi --cov-report term-missing {posargs} + + [testenv:{docs,doctests}] + description = + invoke sphinx-build to build the docs/run the doctests + setenv = + DOCSDIR = {toxinidir}/docs/source + BUILDDIR = {toxinidir}/docs/_build + conda_env = requirements/rtd.yml + commands = + sphinx-apidoc -o "{env:DOCSDIR}/api" tephi tephi/tests + sphinx-build -W --keep-going -b html -d "{env:BUILDDIR}/doctrees" "{env:DOCSDIR}" "{env:BUILDDIR}/html" {posargs} + # when running the doctests, also check that any snippets in the + # docs are representative of the module output + doctests: sphinx-build -b doctest -d "{env:BUILDDIR}/doctrees" "{env:DOCSDIR}" "{env:BUILDDIR}/doctest" {posargs} + """ [tool.ruff.lint.pydocstyle] convention = "numpy" diff --git a/tox.toml b/tox.toml deleted file mode 100644 index c19db38..0000000 --- a/tox.toml +++ /dev/null @@ -1,26 +0,0 @@ -requires = ["tox-conda"] -env_list = ["3.8", "3.9", "3.10", "3.11"] -base_python = [""] - -[env.tests] -description = "invoke pytest to run automated tests" -deps = [ - "pytest", - "pytest-cov", - "filelock", - "requests", - "imagehash", - ] -conda_env = "requirements/dev.yml" -commands = ["pytest --cov tephi --cov-report term-missing {posargs}"] - -[env.doctests] -description = "invoke sphinx-build to build the docs/run the doctests" -set_env.DOCSDIR = "/docs/source" -set_env.BUILDDIR = "/docs/_build" -conda_env = "requirements/rtd.yml" -commands = [ - ["sphinx-apidoc -o", "{env:DOCSDIR}/api", "tephi tephi/tests"], - ["sphinx-build -W --keep-going -b html -d", "{env:BUILDDIR}/doctrees", "{env:DOCSDIR}", "{env:BUILDDIR}/html", "{posargs}"], - ["doctests: sphinx-build -b doctest -d", "{env:BUILDDIR}/doctrees", "{env:DOCSDIR}", "{env:BUILDDIR}/doctest", "{posargs}"] -]