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

Fix CI #47

Merged
merged 8 commits into from
Dec 6, 2024
Merged

Fix CI #47

merged 8 commits into from
Dec 6, 2024

Conversation

nabobalis
Copy link
Collaborator

@nabobalis nabobalis commented Aug 6, 2024

Summary by Sourcery

Fix CI by updating linting rules and exclusions in ruff.toml, refactoring test files for consistency, and replacing pkg_resources with importlib.resources for resource management.

Enhancements:

  • Refactor code to use importlib.resources instead of pkg_resources for resource management.

CI:

  • Update CI configuration by modifying the ruff.toml file to adjust linting rules and exclusions.

Tests:

  • Refactor test files to use ROOTDIR instead of rootdir for consistency and update test assertions to remove decimal precision.

@nabobalis nabobalis marked this pull request as ready for review December 6, 2024 02:03
@nabobalis nabobalis merged commit 6c64950 into main Dec 6, 2024
11 of 13 checks passed
@nabobalis nabobalis deleted the docs branch December 6, 2024 02:04
Copy link

sourcery-ai bot commented Dec 6, 2024

Reviewer's Guide by Sourcery

This PR focuses on improving code quality and CI configuration through several key changes: updating the Ruff linter configuration, fixing test failures, adding type hints, and modernizing package dependencies. The changes are primarily maintenance-focused rather than introducing new features.

Updated class diagram for SpectrogramCube

classDiagram
    class SpectrogramCube {
        +__init__(data, wcs, mask, copy) : None
        +__getitem__(item)
        +__repr__() : str
        +__str__() : str
        +plot(*args, **kwargs)
    }
Loading

Updated class diagram for SGMeta

classDiagram
    class SGMeta {
        +__init__(header, spectral_window, **kwargs) : None
        +__str__() : str
        +__repr__() : str
        +_construct_time(key)
    }
Loading

Updated class diagram for ObsID

classDiagram
    class ObsID {
        +__init__(obsid) : None
        +__repr__() : str
        +_read_obsid(obsid)
    }
Loading

Updated class diagram for SJI

classDiagram
    class SJI {
        +__init__(data, wcs, mask, copy, scaled, **kwargs) : None
        +__repr__() : str
        +__str__() : str
    }
Loading

File-Level Changes

Change Details Files
Updated Ruff linter configuration and rules
  • Simplified lint selection by using 'ALL' instead of individual rules
  • Added new ignore rules for type annotations and docstring formatting
  • Added per-file ignore configurations for specific file types
  • Updated extend-exclude list for ignored directories
ruff.toml
Fixed test failures and improved test stability
  • Added pytest.mark.xfail to failing tests
  • Fixed numpy warnings by adding np.errstate context managers
  • Updated test assertions to use shape instead of dimensions
  • Fixed time unit inconsistencies in tests
irispy/tests/test_response.py
irispy/tests/test_sji_fd.py
irispy/tests/test_spectrograph.py
irispy/tests/test_sji.py
Added type hints and improved code organization
  • Added return type hints to str and repr methods
  • Added -> None type hints to init methods
  • Reordered all lists alphabetically
  • Renamed rootdir to ROOTDIR to follow constants naming convention
irispy/spectrograph.py
irispy/sji.py
irispy/obsid.py
irispy/data/test/__init__.py
Updated package dependencies and configuration
  • Increased minimum Python version to 3.10
  • Updated dependency versions including sunpy>=6.0.0
  • Switched to git dependency for ndcube
  • Updated pre-commit hooks to latest versions
pyproject.toml
.pre-commit-config.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @nabobalis - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The dependency on ndcube @ git+https://github.com/sunpy/ndcube@YOLO is not suitable for a release. Please use a proper release version or at minimum a specific commit hash rather than an unstable branch name.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟡 Testing: 2 issues found
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

"Topic :: Scientific/Engineering :: Physics",
]
dependencies = [
'dkist>=1.0.0',
'ndcube>=2.1.2',
'ndcube @ git+https://github.com/sunpy/ndcube@YOLO',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Using an unstable git branch reference for a production dependency is risky

Consider using a stable version or at minimum pinning to a specific commit hash for reproducible builds.

Comment on lines +94 to +97
@pytest.mark.xfail
def test_get_iris_response_version3(iris_response_v3):
np_test.assert_almost_equal(iris_response_v3["AREA_SG"].value, area_sg_load3, decimal=6)
np_test.assert_almost_equal(iris_response_v3["AREA_SJI"].value, area_sji_load3, decimal=6)
np_test.assert_almost_equal(iris_response_v3["AREA_SG"].value, area_sg_load3)
np_test.assert_almost_equal(iris_response_v3["AREA_SJI"].value, area_sji_load3)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (testing): Missing explanation for expected test failure

The test is marked as expected to fail but there's no explanation why. Please add a reason parameter to the xfail decorator to document why this test is expected to fail. This helps other developers understand if this is a known limitation or a temporary issue that needs to be fixed.

Comment on lines +96 to +97
np_test.assert_almost_equal(iris_response_v3["AREA_SG"].value, area_sg_load3)
np_test.assert_almost_equal(iris_response_v3["AREA_SJI"].value, area_sji_load3)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (testing): Decimal precision removed from assertions

The decimal precision parameter was removed from these assertions. This could make the tests more brittle as they now require exact matches. Consider keeping the decimal parameter to allow for small floating point differences.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant