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

Absolute import instead of relative #479

Open
wants to merge 1 commit into
base: main_v2.1
Choose a base branch
from

Conversation

ahijevyc
Copy link
Contributor

@ahijevyc ahijevyc commented Dec 17, 2024

For 3 scripts in metplotpy/contributed/fv3_physics_tend...

Follow the style of metplotpy module importing that is used in metplotpy/contributed/stratosphere_diagnostics/stratosphere_diagnostics.py to avoid error about relative import.

In other words, replace from . import physics_tend
with import metplotpy.contributed.fv3_physics_tend.physics_tend

That should avoid the
ImportError: attempted relative import with no known parent package.

Pull Request Testing

  • Describe testing already performed for these changes:

It works in a conda environment with metplotpy 2.1.0

  • Recommend testing for the reviewer(s) to perform, including the location of input datasets, and any additional instructions:
setenv METPLOTPY_BASE <path>
setenv CONFIG $METPLOTPY_BASE/test/fv3_physics_tend/fv3_physics_tend_defaults.yaml
setenv WORKING_DIR $METPLOTPY_BASE/metplotpy/contributed/fv3_physics_tend
cd $WORKING_DIR
python planview_fv3.py -h
  • Do these changes include sufficient documentation updates, ensuring that no errors or warnings exist in the build of the documentation? [Yes]

  • Do these changes include sufficient testing updates? [Yes]

  • Will this PR result in changes to the test suite? [No]

    If yes, describe the new output and/or changes to the existing output:

  • Do these changes introduce new SonarQube findings? [No]

    If yes, please describe:

  • Please complete this pull request review by [February 2025].

Pull Request Checklist

See the METplus Workflow for details.

  • [ x] Add any new Python packages to the METplus Components Python Requirements table.
  • [x ] Review the source issue metadata (required labels, projects, and milestone).
  • [x ] Complete the PR definition above.
  • [x ] Ensure the PR title matches the feature or bugfix branch name.
  • [ x] Define the PR metadata, as permissions allow.
    Select: Reviewer(s) and Development issue
    Select: Milestone as the version that will include these changes
    Select: Coordinated METplus-X.Y Support project for bugfix releases or METplotpy-X.Y.Z Development project for official releases
  • After submitting the PR, select the ⚙️ icon in the Development section of the right hand sidebar. Search for the issue that this PR will close and select it, if it is not already selected.
  • After the PR is approved, merge your changes. If permissions do not allow this, request that the reviewer do the merge.
  • Close the linked issue and delete your feature or bugfix branch from GitHub.

for files in metplotpy/contributed/fv3_physics_tend
@ahijevyc ahijevyc added type: bug Fix something that is not working priority: low Low Priority labels Dec 17, 2024
@ahijevyc ahijevyc added this to the METplotpy-2.1.1 (bugfix) milestone Dec 17, 2024
@ahijevyc ahijevyc requested a review from bikegeek December 17, 2024 21:50
@ahijevyc ahijevyc linked an issue Dec 17, 2024 that may be closed by this pull request
14 tasks
@ahijevyc ahijevyc linked an issue Dec 17, 2024 that may be closed by this pull request
14 tasks
@michelleharrold michelleharrold added reporting: DTC NCAR Base NCAR Base DTC Project and removed reporting: DTC NCAR Base NCAR Base DTC Project labels Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: low Low Priority type: bug Fix something that is not working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

import metplotpy.contributed... instead of relative import
2 participants