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

DEPR: deprecate calling yt.load with first argument passed as keyword #4177

Merged
merged 1 commit into from
Dec 16, 2022

Conversation

neutrinoceros
Copy link
Member

@neutrinoceros neutrinoceros commented Oct 21, 2022

PR Summary

This is a proposed solution to close #2879:
IMO, the name of the first argument to yt.load is bound to be meaningless.
It's current name fn is short for "filename", but we support loading from directories and in some cases, urls !
I think that making it a positional-only argument lifts out the weigh of carying a meaningless name forever.
Now, the difficult part is in continuously evolving the API to avoid sudden breaking changes, which is why 99% of this patch consists in adding a custom decorator to do just that, so existing code that might rely on loading data as yt.load(fn=..., ...) will not immediately break but will still emit some warnings, and we can keep backward compatibility for a while.

TODO:

  • add a test for the warning part

@neutrinoceros neutrinoceros added this to the 4.2.0 milestone Oct 21, 2022
@neutrinoceros neutrinoceros added api-consistency naming conventions, code deduplication, informative error messages, code smells... deprecation deprecate features or remove deprecated ones enhancement Making something better labels Oct 21, 2022
@neutrinoceros
Copy link
Member Author

I'll note that the fact that this passed all tests without a warning indicates that calling yt.load(fn=...) is indeed something we never encouraged

@neutrinoceros neutrinoceros marked this pull request as ready for review October 21, 2022 17:39
@matthewturk
Copy link
Member

OK, so, I don't mind this, but I'm surprised it's so much code, and that it's that high of a priority. Do we really need this?

@neutrinoceros
Copy link
Member Author

Not a high priority, just something that was on my mind for 2 years, but required dropping Python 3.7
I don't see another way to close #2879 (other than marking it as 'wontfix').

Copy link
Member

@matthewturk matthewturk left a comment

Choose a reason for hiding this comment

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

Let's do it

@matthewturk matthewturk merged commit 269a961 into yt-project:main Dec 16, 2022
@neutrinoceros neutrinoceros deleted the positional_only_fn branch December 16, 2022 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-consistency naming conventions, code deduplication, informative error messages, code smells... deprecation deprecate features or remove deprecated ones enhancement Making something better
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use fn, filename, name, or my_cool_argname in the codebase?
2 participants