-
Notifications
You must be signed in to change notification settings - Fork 110
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
Decorate deprecated command options #6998
Comments
Related: #3496 . I support such centralized/formalized annotation. Moreover I would have added a version there since it would be known since what version it would be deprecated (0.MINOR+1.0) when that PR to be merged into |
So the target development would be the support of |
I started to tackle this, and for now stopped because I found myself adapting to a lot of the complexities our doc-building system has (and thus adding more) , and because I felt that I couldn't anticipate what would be the best approach to fit both the state of things in datalad-core and the future in datalad-next (e.g., parameter validation). What I have identified is the following:
diff --git a/datalad/distribution/uninstall.py b/datalad/distribution/uninstall.py
index 06914b5b8..7fc9cb9a2 100644
--- a/datalad/distribution/uninstall.py
+++ b/datalad/distribution/uninstall.py
@build_doc
class Uninstall(Interface):
"""DEPRECATED: use the `drop` command"""
_action = 'uninstall'
_params_ = dict(
[...]
check=check_argument,
if_dirty=if_dirty_opt,
)
+ _deprecated_ = """The `uninstall` command is deprecated and will be removed
+ in a future release. Use the `drop` command for safer operation instead."""
@staticmethod
@datasetmethod(name=_action)
|
why not @build_doc
@deprecated(version='0.18.2', msg='Use the `drop` command for safer operation instead.')
class Uninstall(Interface): which would do needed changes to docstring etc? |
|
Yes, please. |
awesome! Any relation/comparison to those existing https://deprecation.readthedocs.io/en/latest/ https://pypi.org/project/Deprecated/ we had discussed in the past (#3496) ? |
Yes, see also the discussion in the linked PR. The difference to the deprecated Python package is the ability to annotate command arguments (e.g., Patching of docs wasn't done because it would require two separate annotations: One one the class level (because only there we can hook into the build_doc system), and one at the e.g. |
Just a heads up that I will be on vacation or otherwise busy for the next two weeks |
Right now, we do this by editing the docstring and adding custom migration code and issue
DeprecationWarning
when that code is triggered. Example:This makes the fact that an option should no longer be used inaccessible programatically. What about an explicit decoration instead. Maybe like:
With such an annotation, a GUI could decide to not even bother showing deprecated commands anymore, rather than having to handling deprecated ones on top of the new interface.
The text was updated successfully, but these errors were encountered: