Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates from package template #791

Merged
merged 12 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/sunpy/package-template",
"commit": "cd21e0d710513a891ed03f29e8afd6e0b9217f04",
"commit": "3737aa309d2a695ada046c7868c5683213003f3d",
"checkout": null,
"context": {
"cookiecutter": {
Expand All @@ -10,6 +10,12 @@
"author_name": "The SunPy Community",
"author_email": "[email protected]",
"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",
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Main CI Workflow
name: CI

on:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down
3 changes: 2 additions & 1 deletion .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions ndcube/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@


__all__ = [
'NDCube',
'NDCubeSequence',
"NDCollection",
"ExtraCoords",
"GlobalCoords",
"ExtraCoordsABC",
"GlobalCoords",
"GlobalCoordsABC",
"NDCollection",
'NDCube',
"NDCubeBase",
'NDCubeSequence',
"NDCubeSequenceBase",
"__version__",
]
9 changes: 7 additions & 2 deletions ndcube/extra_coords/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,10 @@
TimeTableCoordinate,
)

__all__ = ['TimeTableCoordinate', "MultipleTableCoordinate",
'SkyCoordTableCoordinate', 'QuantityTableCoordinate', "BaseTableCoordinate"]
__all__ = [
"BaseTableCoordinate",
"MultipleTableCoordinate",
'QuantityTableCoordinate',
'SkyCoordTableCoordinate',
'TimeTableCoordinate',
]
2 changes: 1 addition & 1 deletion ndcube/extra_coords/extra_coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
TimeTableCoordinate,
)

__all__ = ['ExtraCoordsABC', 'ExtraCoords']
__all__ = ['ExtraCoords', 'ExtraCoordsABC']


class ExtraCoordsABC(abc.ABC):
Expand Down
2 changes: 1 addition & 1 deletion ndcube/extra_coords/table_coord.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
except ImportError:
pass

__all__ = ['TimeTableCoordinate', 'SkyCoordTableCoordinate', 'QuantityTableCoordinate', "BaseTableCoordinate", "MultipleTableCoordinate"]
__all__ = ["BaseTableCoordinate", "MultipleTableCoordinate", 'QuantityTableCoordinate', 'SkyCoordTableCoordinate', 'TimeTableCoordinate']


class Length1Tabular(_Tabular):
Expand Down
8 changes: 4 additions & 4 deletions ndcube/tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]


Expand Down
8 changes: 6 additions & 2 deletions ndcube/utils/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion ndcube/utils/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion ndcube/utils/misc.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
29 changes: 19 additions & 10 deletions ndcube/utils/wcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion ndcube/visualization/descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading
Loading