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

Remove f2py dependency #421

Merged
merged 6 commits into from
Jun 22, 2023
Merged

Remove f2py dependency #421

merged 6 commits into from
Jun 22, 2023

Conversation

anissa111
Copy link
Member

@anissa111 anissa111 commented Jun 7, 2023

PR Summary

Closes #420

Summary of changes:

  • removes geocat-f2py dependency
  • removes references to geocat-f2py
  • creates deprecated.py to house fake f2py deprecation functions that direct users to try installing geocat-f2py directly

Note: this will also require corresponding changes in the feedstock repo when the next release is being made

PR Checklist

General

  • Make an issue if one doesn't already exist
  • Link the issue this PR resolves by adding closes #XXX to the PR description where XXX is the number of the issue.
  • Add a brief summary of changes to docs/release-notes.rst
  • Add appropriate labels to this PR
  • Make your changes in a forked repository rather than directly in this repo
  • Open this PR as a draft if it is not ready for review
  • Convert this PR from a draft to a full PR before requesting reviewers
  • Passes precommit. To set up on your local, run pre-commit install from the top level of the repository. To manually run pre-commits, use pre-commit run --all-files and re-add any changed files before committing again and pushing.

@anissa111 anissa111 added refactor Internal code refactoring dependencies Pull requests that update a dependency file deprecation A feature is being deprecated or removed labels Jun 7, 2023
@anissa111 anissa111 marked this pull request as ready for review June 21, 2023 22:45
@anissa111
Copy link
Member Author

Please feel free to critique how I've set up the "fake" functions to act as deprecation warnings here.

Copy link
Collaborator

@erogluorhan erogluorhan left a comment

Choose a reason for hiding this comment

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

Good overall. A few points though

docs/user_api/index.rst Show resolved Hide resolved
def grid_to_triple(*args, **kwargs):
r""".. deprecated:: 2023.06.0
To use this function, install the geocat-f2py package and import as
``geocat.f2py.grid_to_triple``.
Copy link
Collaborator

@erogluorhan erogluorhan Jun 22, 2023

Choose a reason for hiding this comment

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

Through deprecated.py the user will already have access to the func name grid_to_triple (likewise, other functions in this script). If we guide them to import -f2py functions as

import geocat.f2py.grid_to_triple

Wouldn't that lead to namespace issues as they will have two functions in the same name importefrom two different packages? (didn't test it though)

If so, how about guiding the user to import as

import geocat.f2py

Then, call functions as:

geocat.f2py.triple_to_grid

Copy link
Member Author

Choose a reason for hiding this comment

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

Ooh, super good point. I'll test the behavior locally and update this comment and the deprecated warnings accordingly.

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay! I have an answer. This should actually be fine the way we have it now. If two packages have the same function name imported into the same namespace, the latter one will override the prior one.

This is consistent with my testing locally. If a user imports the geocat-f2py functions on top of the same namespace, they will override the fake geocat-comp ones.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible someone could mix up the order though? That makes me a little nervous.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually, I feel safer after @anissa111 's explanation and testing. Approving it.

If we wanted to cover the case @kafitzgerald pointing out though, I am curious if deprecated.py functions could be written in a way that if there is no geocat-f2py, show the deprecation message; else, call the geocat.f2py.function.

This would be an overkill though.

Copy link
Member Author

Choose a reason for hiding this comment

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

@kafitzgerald If someone managed to install geocat-f2py and then geocat-comp, they would just see the message to import with geocat.f2py.<function>, which will work no matter which package was installed first

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, right. Ignore my comment.

Copy link
Contributor

@kafitzgerald kafitzgerald left a comment

Choose a reason for hiding this comment

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

This looks good to me (given the situation) and as long as we're good re: namespace issues.

@erogluorhan erogluorhan self-requested a review June 22, 2023 21:02
@anissa111 anissa111 merged commit 592ccfb into NCAR:main Jun 22, 2023
@anissa111 anissa111 deleted the issue420 branch June 22, 2023 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file deprecation A feature is being deprecated or removed refactor Internal code refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove geocat-f2py dependency
4 participants