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

Normalize from_xyz functions #490

Merged
merged 12 commits into from
Jan 5, 2019
Merged

Normalize from_xyz functions #490

merged 12 commits into from
Jan 5, 2019

Conversation

ahartikainen
Copy link
Contributor

@ahartikainen ahartikainen commented Jan 3, 2019

Use kw1=None, *, kw2=None, ... in all of the from_xyz functions.

Each library can still use their nomenclature if needed.

renamed load_data (from_netcdf) and save_data (to_netcdf). Old function names are now wrappers for their new name, and raise DeprecationWarning if used.

@@ -39,3 +39,7 @@ def save_data(data, filename, *, group="posterior", coords=None, dims=None):
"""
inference_data = convert_to_inference_data(data, group=group, coords=coords, dims=dims)
return inference_data.to_netcdf(filename)


from_netcdf = load_data # pylint: disable=invalid-name
Copy link
Member

Choose a reason for hiding this comment

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

Can we just rename the functions rather than alias them and have two of the same function in the API?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could. Then we only need to mention this change in "what's changed". Or deprecate old functionality.

Copy link
Member

Choose a reason for hiding this comment

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

I vote for deprecate old functionality. If we want to be safe we can wrap load_data and add a warning

Copy link
Member

Choose a reason for hiding this comment

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

i'm fine with deprecation, or using the fact that we're not 1.0 yet to just change it (starting up a RELEASE_NOTES.md is a good idea!)

Copy link
Member

@ColCarroll ColCarroll left a comment

Choose a reason for hiding this comment

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

thanks for smoothing stuff out -- looks good to me, other than canyon289's comments.

@@ -10,7 +10,7 @@ class PyMC3Converter:
"""Encapsulate PyMC3 specific logic."""

def __init__(
self, *_, trace=None, prior=None, posterior_predictive=None, coords=None, dims=None
self, *, trace=None, prior=None, posterior_predictive=None, coords=None, dims=None
Copy link
Member

Choose a reason for hiding this comment

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

thank you for catching this :/

@@ -39,3 +39,7 @@ def save_data(data, filename, *, group="posterior", coords=None, dims=None):
"""
inference_data = convert_to_inference_data(data, group=group, coords=coords, dims=dims)
return inference_data.to_netcdf(filename)


from_netcdf = load_data # pylint: disable=invalid-name
Copy link
Member

Choose a reason for hiding this comment

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

i'm fine with deprecation, or using the fact that we're not 1.0 yet to just change it (starting up a RELEASE_NOTES.md is a good idea!)

@canyon289
Copy link
Member

Based off the comments above I'm strongly in favor of

  1. Replacing load_data with from_netcdf globally. Same with to_netcdf
  2. Forwarding load_data to from_netcdf and adding a deprecation warning

I know we're not in 1.0 release, but we should to replace globally anyway, and it would be nice to warn out existing users, including us, that we need to stop using load_data without breaking all their stuff for a while.

I do realize global replacement is painful but I'm happy to do it, if we can wait a couple of weeks. I'm also fine merging this PR and then I follow up with my suggestions in another PR if that's what we choose.

@ahartikainen
Copy link
Contributor Author

I can do it later today.

@canyon289
Copy link
Member

This looks good to me!

@canyon289 canyon289 merged commit e7a7742 into master Jan 5, 2019
@ahartikainen ahartikainen deleted the normalize_from_xyz branch January 5, 2019 20:54
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.

3 participants