diff --git a/.cruft.json b/.cruft.json index 9152ab177..d50f32a70 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "https://github.com/sunpy/package-template", - "commit": "cd21e0d710513a891ed03f29e8afd6e0b9217f04", + "commit": "3737aa309d2a695ada046c7868c5683213003f3d", "checkout": null, "context": { "cookiecutter": { @@ -10,6 +10,12 @@ "author_name": "The SunPy Community", "author_email": "sunpy@googlegroups.com", "project_url": "https://docs.sunpy.org/projects/ndcube", + "github_repo": "", + "sourcecode_url": "", + "download_url": "https://pypi.org/project/ndcube", + "documentation_url": "", + "changelog_url": "", + "issue_tracker_url": "", "license": "BSD 2-Clause", "minimum_python_version": "3.10", "use_compiled_extensions": "n", diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 49aa6d5b1..39abb3918 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,3 +1,4 @@ +# Main CI Workflow name: CI on: @@ -21,7 +22,7 @@ concurrency: jobs: core: - uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main + uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1 with: submodules: false coverage: codecov @@ -45,7 +46,7 @@ jobs: test: needs: [core, sdist_verify] - uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main + uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1 with: submodules: false coverage: codecov @@ -60,7 +61,7 @@ jobs: docs: needs: [core] - uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main + uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1 with: default_python: '3.12' submodules: false @@ -84,7 +85,7 @@ jobs: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'Run cron CI') ) - uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main + uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1 with: default_python: '3.12' submodules: false @@ -105,7 +106,7 @@ jobs: contains(github.event.pull_request.labels.*.name, 'Run publish') ) needs: [test, docs] - uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@main + uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@v1 with: python-version: '3.12' test_extras: 'tests' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0fb3a7d65..49abf8e97 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.7.4" + rev: "v0.8.1" hooks: - id: ruff args: ["--fix"] diff --git a/.ruff.toml b/.ruff.toml index 3432435f2..e38d68441 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -40,9 +40,10 @@ extend-ignore = [ "NPY002", # TODO: migrate from np.random.rand to np.random.Generator # pytest (PT) "PT001", # Always use pytest.fixture() - "PT004", # Fixtures which don't return anything should have leading _ + # TODO FIX "PT011", # TODO: except(ValueRaises) is too broad "PT012", # TODO: except statement is too lengthy + # "PT023", # Always use () on pytest decorators # flake8-pie (PIE) "PIE808", # Disallow passing 0 as the first argument to range diff --git a/docs/conf.py b/docs/conf.py index 148300d55..068a5c1e0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -49,13 +49,13 @@ 'sphinx.ext.viewcode', 'sphinx.ext.napoleon', 'sphinx.ext.doctest', - 'sphinx.ext.mathjax', - 'sphinx_automodapi.automodapi', - 'sphinx_automodapi.smart_resolver', 'ndcube.utils.sphinx.code_context', - 'sphinx_changelog', 'sphinx_gallery.gen_gallery', "sphinxext.opengraph", + "sphinx.ext.mathjax", + "sphinx_automodapi.automodapi", + "sphinx_automodapi.smart_resolver", + "sphinx_changelog", ] # Add any paths that contain templates here, relative to this directory. diff --git a/ndcube/__init__.py b/ndcube/__init__.py index 7e52b7945..c137f5910 100644 --- a/ndcube/__init__.py +++ b/ndcube/__init__.py @@ -17,14 +17,14 @@ __all__ = [ - 'NDCube', - 'NDCubeSequence', - "NDCollection", "ExtraCoords", - "GlobalCoords", "ExtraCoordsABC", + "GlobalCoords", "GlobalCoordsABC", + "NDCollection", + 'NDCube', "NDCubeBase", + 'NDCubeSequence', "NDCubeSequenceBase", "__version__", ] diff --git a/ndcube/extra_coords/__init__.py b/ndcube/extra_coords/__init__.py index 315b95209..cdea39152 100644 --- a/ndcube/extra_coords/__init__.py +++ b/ndcube/extra_coords/__init__.py @@ -6,5 +6,10 @@ TimeTableCoordinate, ) -__all__ = ['TimeTableCoordinate', "MultipleTableCoordinate", - 'SkyCoordTableCoordinate', 'QuantityTableCoordinate', "BaseTableCoordinate"] +__all__ = [ + "BaseTableCoordinate", + "MultipleTableCoordinate", + 'QuantityTableCoordinate', + 'SkyCoordTableCoordinate', + 'TimeTableCoordinate', +] diff --git a/ndcube/extra_coords/extra_coords.py b/ndcube/extra_coords/extra_coords.py index 90ac72c83..ad3b42bb0 100644 --- a/ndcube/extra_coords/extra_coords.py +++ b/ndcube/extra_coords/extra_coords.py @@ -24,7 +24,7 @@ TimeTableCoordinate, ) -__all__ = ['ExtraCoordsABC', 'ExtraCoords'] +__all__ = ['ExtraCoords', 'ExtraCoordsABC'] class ExtraCoordsABC(abc.ABC): diff --git a/ndcube/extra_coords/table_coord.py b/ndcube/extra_coords/table_coord.py index a761cb54f..33c742fb9 100644 --- a/ndcube/extra_coords/table_coord.py +++ b/ndcube/extra_coords/table_coord.py @@ -22,7 +22,7 @@ except ImportError: pass -__all__ = ['TimeTableCoordinate', 'SkyCoordTableCoordinate', 'QuantityTableCoordinate', "BaseTableCoordinate", "MultipleTableCoordinate"] +__all__ = ["BaseTableCoordinate", "MultipleTableCoordinate", 'QuantityTableCoordinate', 'SkyCoordTableCoordinate', 'TimeTableCoordinate'] class Length1Tabular(_Tabular): diff --git a/ndcube/tests/helpers.py b/ndcube/tests/helpers.py index 1a35ddf15..c19ba56e7 100644 --- a/ndcube/tests/helpers.py +++ b/ndcube/tests/helpers.py @@ -21,13 +21,13 @@ from ndcube import NDCube, NDCubeSequence __all__ = [ - 'figure_test', - 'get_hash_library_name', - 'assert_extra_coords_equal', - 'assert_metas_equal', 'assert_cubes_equal', 'assert_cubesequences_equal', + 'assert_extra_coords_equal', + 'assert_metas_equal', 'assert_wcs_are_equal', + 'figure_test', + 'get_hash_library_name', ] diff --git a/ndcube/utils/cube.py b/ndcube/utils/cube.py index 9f55083e7..31e020c06 100644 --- a/ndcube/utils/cube.py +++ b/ndcube/utils/cube.py @@ -9,8 +9,12 @@ from ndcube.utils import wcs as wcs_utils -__all__ = ["sanitize_wcs", "sanitize_crop_inputs", "get_crop_item_from_points", - "propagate_rebin_uncertainties"] +__all__ = [ + "get_crop_item_from_points", + "propagate_rebin_uncertainties", + "sanitize_crop_inputs", + "sanitize_wcs", +] def sanitize_wcs(func): diff --git a/ndcube/utils/exceptions.py b/ndcube/utils/exceptions.py index 3e951c692..ce98fa833 100644 --- a/ndcube/utils/exceptions.py +++ b/ndcube/utils/exceptions.py @@ -6,7 +6,7 @@ """ import warnings -__all__ = ["NDCubeWarning", "NDCubeUserWarning", "NDCubeDeprecationWarning", "warn_user", "warn_deprecated"] +__all__ = ["NDCubeDeprecationWarning", "NDCubeUserWarning", "NDCubeWarning", "warn_deprecated", "warn_user"] class NDCubeWarning(Warning): diff --git a/ndcube/utils/misc.py b/ndcube/utils/misc.py index b41b0ae88..2dee74c69 100644 --- a/ndcube/utils/misc.py +++ b/ndcube/utils/misc.py @@ -1,6 +1,6 @@ import astropy.units as u -__all__ = ['unique_sorted', 'convert_quantities_to_units'] +__all__ = ['convert_quantities_to_units', 'unique_sorted'] def unique_sorted(iterable): diff --git a/ndcube/utils/wcs.py b/ndcube/utils/wcs.py index dcb99eaf5..fe64560c7 100644 --- a/ndcube/utils/wcs.py +++ b/ndcube/utils/wcs.py @@ -10,14 +10,23 @@ from astropy.wcs.utils import pixel_to_pixel from astropy.wcs.wcsapi import BaseHighLevelWCS, BaseLowLevelWCS, low_level_api -__all__ = ['array_indices_for_world_objects', 'convert_between_array_and_pixel_axes', - 'calculate_world_indices_from_axes', 'wcs_ivoa_mapping', - 'pixel_axis_to_world_axes', 'world_axis_to_pixel_axes', - 'pixel_axis_to_physical_types', 'physical_type_to_pixel_axes', - 'physical_type_to_world_axis', 'get_dependent_pixel_axes', - 'get_dependent_array_axes', 'get_dependent_world_axes', - 'get_dependent_physical_types', 'array_indices_for_world_objects', - 'validate_physical_types'] +__all__ = [ + 'array_indices_for_world_objects', + 'array_indices_for_world_objects', + 'calculate_world_indices_from_axes', + 'convert_between_array_and_pixel_axes', + 'get_dependent_array_axes', + 'get_dependent_physical_types', + 'get_dependent_pixel_axes', + 'get_dependent_world_axes', + 'physical_type_to_pixel_axes', + 'physical_type_to_world_axis', + 'pixel_axis_to_physical_types', + 'pixel_axis_to_world_axes', + 'validate_physical_types', + 'wcs_ivoa_mapping', + 'world_axis_to_pixel_axes', +] class TwoWayDict(UserDict): @@ -49,8 +58,8 @@ def inv(self): "HECH": "pos.bodyrc.alt", } wcs_ivoa_mapping = TwoWayDict() -for key in wcs_to_ivoa.keys(): - wcs_ivoa_mapping[key] = wcs_to_ivoa[key] +for key, value in wcs_to_ivoa.items(): + wcs_ivoa_mapping[key] = value def convert_between_array_and_pixel_axes(axis, naxes): diff --git a/ndcube/visualization/descriptor.py b/ndcube/visualization/descriptor.py index d20c27afe..bd6f0dc04 100644 --- a/ndcube/visualization/descriptor.py +++ b/ndcube/visualization/descriptor.py @@ -5,7 +5,7 @@ MISSING_ANIMATORS_ERROR_MSG = ("mpl_animators cannot be imported, so the default plotting " "functionality is disabled. Please install mpl_animators") -__all__ = ['PlotterDescriptor', 'MISSING_MATPLOTLIB_ERROR_MSG', 'MISSING_ANIMATORS_ERROR_MSG'] +__all__ = ['MISSING_ANIMATORS_ERROR_MSG', 'MISSING_MATPLOTLIB_ERROR_MSG', 'PlotterDescriptor'] class PlotterDescriptor: diff --git a/pyproject.toml b/pyproject.toml index be5bd7c14..7e94a58c2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -61,8 +61,10 @@ all = [ dev = [ "ndcube[tests,docs,plotting,reproject]", ] + [project.urls] -repository = "https://docs.sunpy.org/projects/ndcube" +Homepage = "https://docs.sunpy.org/projects/ndcube" +Download = "https://pypi.org/project/ndcube" [tool.setuptools] zip-safe = false @@ -75,74 +77,76 @@ exclude = ["ndcube._dev*"] [tool.setuptools_scm] write_to = "ndcube/_version.py" +[tool.gilesbot] + [tool.gilesbot.pull_requests] + enabled = true + + [tool.gilesbot.milestones] + enabled = true + missing_message_long = "This pull request does not have a milestone assigned to it. Only maintainers can change this, so you don't need to worry about it. :smile:" + + [tool.gilesbot.circleci_artifacts] + enabled = true + + [tool.gilesbot.circleci_artifacts.figure_report] + url = ".tmp/py310-figure/figure_test_images/fig_comparison.html" + message = "Click details to see the figure test comparisons, for py310-figure." + report_on_fail = true + + [tool.gilesbot.circleci_artifacts.figure_report_devdeps] + url = ".tmp/py310-figure-devdeps/figure_test_images/fig_comparison.html" + message = "Click details to see the figure test comparisons for py310-figure-devdeps." + report_on_fail = true + + [tool.gilesbot.towncrier_changelog] + enabled = true + verify_pr_number = true + changelog_skip_label = "No Changelog Entry Needed" + help_url = "https://github.com/sunpy/sunpy/blob/main/changelog/README.rst" + changelog_missing_long = "There isn't a changelog file in this pull request. Please add a changelog file to the `changelog/` directory following the instructions in the changelog [README](https://github.com/sunpy/sunpy/blob/main/changelog/README.rst)." + type_incorrect_long = "The changelog file you added is not one of the allowed types. Please use one of the types described in the changelog [README](https://github.com/sunpy/ndcube/blob/main/changelog/README.rst)" + number_incorrect_long = "The number in the changelog file you added does not match the number of this pull request. Please rename the file." + +# TODO: This should be in towncrier.toml but Giles currently only works looks in +# pyproject.toml we should move this back when it's fixed. [tool.towncrier] - package = "ndcube" - filename = "CHANGELOG.rst" - directory = "changelog/" - issue_format = "`#{issue} `__" - title_format = "{version} ({project_date})" - - [[tool.towncrier.type]] - directory = "breaking" - name = "Backwards Incompatible Changes" - showcontent = true - - [[tool.towncrier.type]] - directory = "api" - name = "API Changes" - showcontent = true - - [[tool.towncrier.type]] - directory = "removal" - name = "Deprecations and Removals" - showcontent = true - - [[tool.towncrier.type]] - directory = "feature" - name = "Features" - showcontent = true - - [[tool.towncrier.type]] - directory = "bugfix" - name = "Bug Fixes" - showcontent = true - - [[tool.towncrier.type]] - directory = "doc" - name = "Improved Documentation" - showcontent = true - - [[tool.towncrier.type]] - directory = "trivial" - name = "Trivial/Internal Changes" - showcontent = true - -[ tool.gilesbot ] - [ tool.gilesbot.circleci_artifacts ] - enabled = true - - [ tool.gilesbot.circleci_artifacts.figure_report ] - url = ".tmp/py310-figure/figure_test_images/fig_comparison.html" - message = "Click details to see the figure test comparisons, for py310-figure." - report_on_fail = true - - [ tool.gilesbot.circleci_artifacts.figure_report_devdeps ] - url = ".tmp/py310-figure-devdeps/figure_test_images/fig_comparison.html" - message = "Click details to see the figure test comparisons for py310-figure-devdeps." - report_on_fail = true - - [ tool.gilesbot.pull_requests ] - enabled = true - - [ tool.gilesbot.towncrier_changelog ] - enabled = true - verify_pr_number = true - changelog_skip_label = "No Changelog Entry Needed" - help_url = "https://github.com/sunpy/sunpy/blob/main/changelog/README.rst" - changelog_missing_long = "There isn't a changelog file in this pull request. Please add a changelog file to the `changelog/` directory following the instructions in the changelog [README](https://github.com/sunpy/sunpy/blob/main/changelog/README.rst)." - type_incorrect_long = "The changelog file you added is not one of the allowed types. Please use one of the types described in the changelog [README](https://github.com/sunpy/ndcube/blob/main/changelog/README.rst)" - number_incorrect_long = "The number in the changelog file you added does not match the number of this pull request. Please rename the file." - - [ tool.gilesbot.milestones ] - enabled = true - missing_message_long = "This pull request does not have a milestone assigned to it. Only maintainers can change this, so you don't need to worry about it. :smile:" + package = "ndcube" + filename = "CHANGELOG.rst" + directory = "changelog/" + issue_format = "`#{issue} `__" + title_format = "{version} ({project_date})" + + [[tool.towncrier.type]] + directory = "breaking" + name = "Breaking Changes" + showcontent = true + + [[tool.towncrier.type]] + directory = "deprecation" + name = "Deprecations" + showcontent = true + + [[tool.towncrier.type]] + directory = "removal" + name = "Removals" + showcontent = true + + [[tool.towncrier.type]] + directory = "feature" + name = "New Features" + showcontent = true + + [[tool.towncrier.type]] + directory = "bugfix" + name = "Bug Fixes" + showcontent = true + + [[tool.towncrier.type]] + directory = "doc" + name = "Documentation" + showcontent = true + + [[tool.towncrier.type]] + directory = "trivial" + name = "Internal Changes" + showcontent = true