-
Notifications
You must be signed in to change notification settings - Fork 15
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
Nwm client transition #265
Conversation
@aaraney any notes or reservations? |
Im sure we have talked about this idea in the past and my memory is failing me, @jarq6c what are your thoughts on instead of deprecating going with a hard break and replacing the current |
Definitely preferred. Do you have any recommendations for how to do that responsibly? |
I'm going to rename |
Ideally we would transition I need to explore a bit to see how to do this and cover all cases, but for starters I think the module level |
It seems that PEP 562 does provide a means to proxy a package. However, it does seem that there is a fair amount of boilerplate and structural coupling. The below examples are the contents of a namespace package # alt/sub/__init__.py
def __getattr__(name: str):
import importlib
package_name = "pkg.sub"
try:
return importlib.import_module(f".{name!s}", package_name)
except ImportError:
mod = importlib.import_module(package_name)
return getattr(mod, name) # alt/sub/a.py
# NOTE: This needs to be repeated for **all** python modules in `pkg.sub`.
def __getattr__(name: str):
import importlib
package_name = "pkg.sub"
proxy_name = f"{package_name}.{__name__[len(package_name)+1:]}"
mod = importlib.import_module(proxy_name)
return getattr(mod, name) Take aways: Im not sure that it is worth creating and maintaining this file structure to deprecate |
This PR deprecates
hydrotools.caches
andhydrotools.nwm_client
. Importing these packages results in aFutureWarning
that these packages are no longer supported. I would have gone with aDeprecationWarning
, but that is not shown to the user by default. Automated tests are removed, as are references in the docs.