From 983ddf13d6739a5722b501515881ab1cc68708a7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 24 Jul 2023 16:37:56 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/codespell-project/codespell: v2.2.4 → v2.2.5](https://github.com/codespell-project/codespell/compare/v2.2.4...v2.2.5) - https://github.com/ikamensh/flynt/: 0.78 → 1.0.0 - https://github.com/charliermarsh/ruff-pre-commit → https://github.com/astral-sh/ruff-pre-commit - [github.com/astral-sh/ruff-pre-commit: v0.0.269 → v0.0.280](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.269...v0.0.280) - [github.com/psf/black: 23.3.0 → 23.7.0](https://github.com/psf/black/compare/23.3.0...23.7.0) - [github.com/asottile/blacken-docs: 1.13.0 → 1.15.0](https://github.com/asottile/blacken-docs/compare/1.13.0...1.15.0) - [github.com/tox-dev/pyproject-fmt: 0.11.2 → 0.13.0](https://github.com/tox-dev/pyproject-fmt/compare/0.11.2...0.13.0) --- .pre-commit-config.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index eed018b4..6a776ca4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,7 +32,7 @@ repos: - id: text-unicode-replacement-char - repo: https://github.com/codespell-project/codespell - rev: v2.2.4 + rev: v2.2.5 hooks: - id: codespell args: ["--write-changes"] @@ -40,12 +40,12 @@ repos: - tomli - repo: https://github.com/ikamensh/flynt/ - rev: '0.78' + rev: '1.0.0' hooks: - id: flynt -- repo: https://github.com/charliermarsh/ruff-pre-commit - rev: "v0.0.269" +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: "v0.0.280" hooks: - id: ruff args: ["--fix"] @@ -56,17 +56,17 @@ repos: - id: isort - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 23.7.0 hooks: - id: black - repo: https://github.com/asottile/blacken-docs - rev: 1.13.0 + rev: 1.15.0 hooks: - id: blacken-docs - repo: https://github.com/tox-dev/pyproject-fmt - rev: "0.11.2" + rev: "0.13.0" hooks: - id: pyproject-fmt From 3de4a0c59921cb181495cbe148dda14979bf6eec Mon Sep 17 00:00:00 2001 From: William Jamieson Date: Tue, 25 Jul 2023 16:08:34 -0400 Subject: [PATCH 2/2] Fixes suggested by pre-commit --- .pre-commit-config.yaml | 5 -- asdf_astropy/conftest.py | 50 ------------------- .../converters/time/tests/test_time_delta.py | 12 ++--- pyproject.toml | 47 ++++++++--------- 4 files changed, 27 insertions(+), 87 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6a776ca4..4c5d1543 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -65,11 +65,6 @@ repos: hooks: - id: blacken-docs -- repo: https://github.com/tox-dev/pyproject-fmt - rev: "0.13.0" - hooks: - - id: pyproject-fmt - - repo: https://github.com/abravalheri/validate-pyproject rev: "v0.13" hooks: diff --git a/asdf_astropy/conftest.py b/asdf_astropy/conftest.py index 4a8ac079..e69de29b 100644 --- a/asdf_astropy/conftest.py +++ b/asdf_astropy/conftest.py @@ -1,50 +0,0 @@ -# This file is used to configure the behavior of pytest when using the Astropy -# test infrastructure. It needs to live inside the package in order for it to -# get picked up when running the tests inside an interpreter using -# packagename.test - -from pathlib import Path - -import asdf -import pytest -from astropy.version import version as astropy_version - -# For Astropy 3.0 and later, we can use the standalone pytest plugin -if astropy_version < "3.0": - from astropy.tests.pytest_plugins import * # noqa: F403 - - del pytest_report_header - ASTROPY_HEADER = True -else: - try: - from pytest_astropy_header.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS - - ASTROPY_HEADER = True - except ImportError: - ASTROPY_HEADER = False - - -def pytest_configure(config): - if ASTROPY_HEADER: - config.option.astropy_header = True - - # Customize the following lines to add/remove entries from the list of - # packages for which version numbers are displayed when running the tests. - PYTEST_HEADER_MODULES.pop("Pandas", None) - PYTEST_HEADER_MODULES["scikit-image"] = "skimage" - - from . import __version__ - - packagename = Path(__file__).parent.name - TESTED_VERSIONS[packagename] = __version__ - - -@pytest.fixture(autouse=True) -def _remove_astropy_extensions(): - """ - Disable the old astropy extension so that it doesn't - confuse our test results. - """ - with asdf.config_context() as config: - config.remove_extension(package="astropy") - yield diff --git a/asdf_astropy/converters/time/tests/test_time_delta.py b/asdf_astropy/converters/time/tests/test_time_delta.py index 990d2902..514ca1e0 100644 --- a/asdf_astropy/converters/time/tests/test_time_delta.py +++ b/asdf_astropy/converters/time/tests/test_time_delta.py @@ -7,15 +7,9 @@ def create_time_deltas(): - result = [ - TimeDelta([1, 2] * u.day), - ] - - for format_ in TimeDelta.FORMATS: - result.append(TimeDelta(Time.now() - Time.now(), format=format_)) - - for scale in [*list(TimeDelta.SCALES), None]: - result.append(TimeDelta(0.125 * u.day, scale=scale)) + result = [TimeDelta([1, 2] * u.day)] + result += [TimeDelta(Time.now() - Time.now(), format=format_) for format_ in TimeDelta.FORMATS] + result += [TimeDelta(0.125 * u.day, scale=scale) for scale in [*list(TimeDelta.SCALES), None]] return result diff --git a/pyproject.toml b/pyproject.toml index 1d5fd863..ac2e2e70 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ classifiers = [ "Programming Language :: Python :: 3 :: Only", 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', + "Programming Language :: Python :: 3.11", ] dynamic = [ 'version', @@ -79,6 +79,29 @@ force-exclude = ''' ) ''' +[tool.ruff] +target-version = "py38" +line-length = 120 +select = ["ALL"] +extend-ignore = [ + # Ignore check groups + "C90", # mccabe + "D", # pydocstyle + "ANN", # flake8-annotations + "ARG", # flake8-unused-arguments + "DTZ", # flake8-datetimez + "TD", # flake8-todos + "FIX", # flake8-fixme + # Individually ignored checks + "SLF001", # private-member-access +] +extend-exclude = ["docs/*"] + +[tool.ruff.per-file-ignores] +"test_*.py" = ["S101"] +"asdf_astropy/testing/helpers.py" = ["S101"] +"scripts/generate_manifest.py" = ["S101", "SLOT000"] + [tool.isort] profile = "black" filter_files = true @@ -132,27 +155,5 @@ exclude_lines = [ 'def _ipython_key_completions_', ] -[tool.ruff] -target-version = "py38" -line-length = 120 -select = ["ALL"] -extend-ignore = [ - # Ignore check groups - "C90", # mccabe - "D", # pydocstyle - "ANN", # flake8-annotations - "ARG", # flake8-unused-arguments - "DTZ", # flake8-datetimez - "TD", # flake8-todos - # Individually ignored checks - "SLF001", # private-member-access -] -extend-exclude = ["docs/*"] - -[tool.ruff.per-file-ignores] -"test_*.py" = ["S101"] -"asdf_astropy/testing/helpers.py" = ["S101"] -"scripts/generate_manifest.py" = ["S101"] - [tool.codespell] skip="*.pdf,*.fits,*.asdf,*.egg-info,.tox,build,./tags,.git,./docs/_build"