diff --git a/.cruft.json b/.cruft.json index cd04b42e..0479f42c 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "https://github.com/sunpy/package-template", - "commit": "6d6729b22066ef890e70c37438da70cac33e03b4", + "commit": "c79fc5bff74958e24c9a925a330b8d3aa138f4ce", "checkout": null, "context": { "cookiecutter": { diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml index 4466811a..bc5cc719 100644 --- a/.github/workflows/codspeed.yml +++ b/.github/workflows/codspeed.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/setup-python@v5 with: python-version: '3.12' - - run: python -m pip install .[tests] pytest-codspeed + - run: python -m pip install .[tests] pytest-codspeed 'numpy<2' - name: Run benchmarks uses: CodspeedHQ/action@v2 with: diff --git a/.github/workflows/sub_package_update.yml b/.github/workflows/sub_package_update.yml index 94a9e7e1..06779481 100644 --- a/.github/workflows/sub_package_update.yml +++ b/.github/workflows/sub_package_update.yml @@ -28,11 +28,6 @@ jobs: branch: cruft/update commit-message: "Automatic package template update" title: Updates from the package template - - add-paths: .cruft.json - body: reject these changes for this repo. - branch: cruft/reject - commit-message: "Reject this package template update" - title: Reject new updates from package template steps: - uses: actions/checkout@v4 @@ -42,7 +37,7 @@ jobs: python-version: "3.11" - name: Install Cruft - run: python -m pip install cruft + run: python -m pip install git+https://github.com/Cadair/cruft@patch-p1 - name: Check if update is available continue-on-error: false diff --git a/.gitignore b/.gitignore index 60e2bd1a..d9806fae 100644 --- a/.gitignore +++ b/.gitignore @@ -76,6 +76,7 @@ instance/ docs/_build/ # automodapi docs/api +docs/sg_execution_times.rst # PyBuilder .pybuilder/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c90195b1..67091e89 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ repos: # This should be before any formatting hooks like isort - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.3.5" + rev: "v0.4.8" hooks: - id: ruff args: ["--fix"] @@ -26,10 +26,10 @@ repos: - id: mixed-line-ending exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|.asdf|.json|.hdr)$" - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.3.0 hooks: - id: codespell args: [ "--write-changes", "-D", "-", "-D", ".codespell-dict.txt"] ci: autofix_prs: false - autoupdate_schedule: "weekly" + autoupdate_schedule: "quarterly" diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8d6fe4b8..74239870 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -378,7 +378,7 @@ Bug Fixes Trivial/Internal Changes ------------------------ -- Migate to the asdf 2.8+ ``Converter`` interface, this bumps various +- Migrate to the asdf 2.8+ ``Converter`` interface, this bumps various dependencies but should have no effect on reading or writing asdf files. (`#152 `_) diff --git a/dkist/net/attrs.py b/dkist/net/attrs.py index 5297e35c..6f4f3d45 100644 --- a/dkist/net/attrs.py +++ b/dkist/net/attrs.py @@ -301,10 +301,10 @@ def __init__(self, bottom_left, *, top_right=None, width: _u.deg = None, bottom_left = bottom_left.transform_to(_Helioprojective(observer="earth")) top_right = top_right.transform_to(_Helioprojective(observer="earth")) - self.hpc_bounding_box_arcsec = ((bottom_left.Tx.to_value(_u.arcsec), - bottom_left.Ty.to_value(_u.arcsec)), - (top_right.Tx.to_value(_u.arcsec), - top_right.Ty.to_value(_u.arcsec))) + self.hpc_bounding_box_arcsec = ((float(bottom_left.Tx.to_value(_u.arcsec)), + float(bottom_left.Ty.to_value(_u.arcsec))), + (float(top_right.Tx.to_value(_u.arcsec)), + float(top_right.Ty.to_value(_u.arcsec)))) self.search_type = search diff --git a/dkist/utils/inventory.py b/dkist/utils/inventory.py index 4b5d6e6a..cc54d737 100644 --- a/dkist/utils/inventory.py +++ b/dkist/utils/inventory.py @@ -77,7 +77,7 @@ def __missing__(self, key): def _key_clean(key): - key = re.sub("[%s]" % re.escape(string.punctuation), "_", key) + key = re.sub(f"[{re.escape(string.punctuation)}]", "_", key) key = key.replace(" ", "_") key = "".join(char for char in key if char.isidentifier() or char.isnumeric()) diff --git a/pyproject.toml b/pyproject.toml index cea47f30..86cbb5d5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,12 +48,12 @@ tests = [ "pytest-doctestplus", "pytest-cov", "pytest-remotedata", - "pytest-cov", "pytest-mock", "pytest-mpl", "pytest-httpserver", "pytest-filter-subpackage", "pytest-benchmark", + "pytest-xdist", "hypothesis", "tox", "pydot", @@ -85,6 +85,7 @@ zip-safe = false include-package-data = true [tool.setuptools.packages.find] +exclude = ["dkist._dev*"] [tool.setuptools_scm] write_to = "dkist/_version.py" diff --git a/pytest.ini b/pytest.ini index 732d176e..0308ea40 100644 --- a/pytest.ini +++ b/pytest.ini @@ -14,17 +14,23 @@ norecursedirs = .history dkist/extern doctest_plus = enabled -doctest_optionflags = NORMALIZE_WHITESPACE FLOAT_CMP ELLIPSIS +doctest_optionflags = + NORMALIZE_WHITESPACE + FLOAT_CMP + ELLIPSIS text_file_format = rst -addopts = --doctest-rst -p no:unraisableexception -p no:threadexception -markers = - online: marks this test function as needing online connectivity. - figure: marks this test function as using hash-based Matplotlib figure verification. This mark is not meant to be directly applied, but is instead automatically applied when a test function uses the @sunpy.tests.helpers.figure_test decorator. - benchmark: marks this test as a benchmark # Disable internet access for tests not marked remote_data remote_data_strict = True asdf_schema_root = dkist/io/asdf/resources/ asdf_schema_tests_enabled = true +markers = + online: marks this test function as needing online connectivity. + figure: marks this test function as using hash-based Matplotlib figure verification. This mark is not meant to be directly applied, but is instead automatically applied when a test function uses the @sunpy.tests.helpers.figure_test decorator. + benchmark: marks this test as a benchmark +addopts = + --doctest-rst + -p no:unraisableexception + -p no:threadexception filterwarnings = # Turn all warnings into errors so they do not pass silently. error diff --git a/tox.ini b/tox.ini index d66ef283..8f11bbf8 100644 --- a/tox.ini +++ b/tox.ini @@ -8,9 +8,9 @@ envlist = py{310,311,312} py312-devdeps py310-oldestdeps + py312-benchmarks build_docs{,-notebooks} codestyle - benchmarks [testenv] pypi_filter = https://raw.githubusercontent.com/sunpy/sunpy/main/.test_package_pins.txt @@ -34,8 +34,6 @@ set_env = MPLBACKEND = agg COLUMNS = 180 devdeps: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/astropy/simple https://pypi.anaconda.org/scientific-python-nightly-wheels/simple - # Define the base test command here to allow us to add more flags for each tox factor - PYTEST_COMMAND = pytest -vvv -r fEs --pyargs dkist --cov-report=xml --cov=dkist --cov-config={toxinidir}/.coveragerc {toxinidir}/docs --benchmark-skip deps = # For packages which publish nightly wheels this will pull the latest nightly devdeps: astropy>=0.0.dev0 @@ -57,15 +55,22 @@ commands_pre = oldestdeps: pip install -r requirements-min.txt cryptography<42 jsonschema==4.0.1 pip freeze --all --no-input commands = - # To run different commands for different factors exclude the factor from the default command like this - # !online: {env:PYTEST_COMMAND} {posargs} - # Then specify a specific one like this - # online: {env:PYTEST_COMMAND} --remote-data=any {posargs} - {env:PYTEST_COMMAND} \ + # To amend the pytest command for different factors you can add a line + # which starts with a factor like `online: --remote-data=any \` + # If you have no factors which require different commands this is all you need: + pytest \ + -vvv \ + -r fEs \ + --pyargs dkist \ + --cov-report=xml \ + --cov=dkist \ + --cov-config={toxinidir}/.coveragerc \ + {toxinidir}/docs \ online: --remote-data=any \ - # It's not possible to test the new schemas with the oldest dependencies - # as the new schemas require new dependent schemas - oldestdeps: -o asdf_schema_tests_enabled=false + !benchmarks: --benchmark-skip \ + benchmarks: -m benchmark \ + benchmarks: --benchmark-autosave \ + oldestdeps: -o asdf_schema_tests_enabled=false \ {posargs} [testenv:codestyle] @@ -87,11 +92,15 @@ extras = commands = pip freeze --all --no-input # Disable parallel here due to https://github.com/astropy/astropy/issues/14916 - !notebooks: sphinx-build -j 1 --color -W --keep-going -b html -d _build/.doctrees . _build/html -D nb_execution_mode=off {posargs} - notebooks: sphinx-build -j 1 --color -W --keep-going -b html -d _build/.doctrees . _build/html {posargs} + sphinx-build \ + -j 1 \ + --color \ + -W \ + --keep-going \ + -b html \ + -d _build/.doctrees \ + . \ + _build/html \ + !notebooks: -D nb_execution_mode=off \ + {posargs} python -c 'import pathlib; print("Documentation available under file://\{0\}".format(pathlib.Path(r"{toxinidir}") / "docs" / "_build" / "index.html"))' - -[testenv:benchmarks] -description = Run benchmarks on PR and compare against main to ensure there are no performance regressions -allowlist_externals=git -commands = {env:PYTEST_COMMAND} -m benchmark --benchmark-autosave