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

docformatter v1.6.0 is incompatible with black #2476

Closed
seisman opened this issue Apr 4, 2023 · 1 comment · Fixed by #2482 or #2538
Closed

docformatter v1.6.0 is incompatible with black #2476

seisman opened this issue Apr 4, 2023 · 1 comment · Fixed by #2482 or #2538
Labels
maintenance Boring but important stuff for the core devs
Milestone

Comments

@seisman
Copy link
Member

seisman commented Apr 4, 2023

docformatter v1.6.0 was released a few hours ago, and it breaks our "Style Checks" workflow (e.g., https://github.com/GenericMappingTools/pygmt/actions/runs/4605939608/jobs/8138625848?pr=2474).

There is an existing issue report that docformatter v1.6.0 is incompatible with black (PyCQA/docformatter#94).

Here is an example that docformatter v1.6.0 doesn't work with our codes:

Just run:

$ docformatter --in-place pygmt/helpers/decorators.py

The diff is:

diff --git a/pygmt/helpers/decorators.py b/pygmt/helpers/decorators.py
index 95a3c29db..15cdc527a 100644
--- a/pygmt/helpers/decorators.py
+++ b/pygmt/helpers/decorators.py
@@ -476,7 +476,6 @@ def _insert_alias(module_func, default_value=None):
     """
     Function to insert PyGMT long aliases into the signature of a method.
     """
-
     # Get current signature and parameters
     sig = signature(module_func)
     wrapped_params = list(sig.parameters.values())
@@ -536,12 +535,10 @@ def use_alias(**aliases):
     pygmt.exceptions.GMTInvalidInput:
         Parameters in short-form (J) and long-form (projection) can't coexist.
     """
-
     def alias_decorator(module_func):
         """
         Decorator that replaces the aliases for arguments.
         """
-
         @functools.wraps(module_func)
         def new_module(*args, **kwargs):
             """
@@ -710,7 +707,6 @@ def kwargs_to_strings(**conversions):
         """
         The decorator that creates our new function with the conversions.
         """
-
         @functools.wraps(module_func)
         def new_module(*args, **kwargs):
             """
@@ -791,13 +787,11 @@ def deprecate_parameter(oldname, newname, deprecate_version, remove_version):
     ...     module(data="table.txt", size=5.0, sizes=4.0)
     ...
     """
-
     def deprecator(module_func):
         """
         The decorator that creates the new function to work with both old and
         new parameters.
         """
-
         @functools.wraps(module_func)
         def new_module(*args, **kwargs):
             """

If we run black pygmt/helpers/decorators.py, we will see that black reverts some changes of docformatter. After running black, the diff is:

diff --git a/pygmt/helpers/decorators.py b/pygmt/helpers/decorators.py
index 95a3c29db..49c008932 100644
--- a/pygmt/helpers/decorators.py
+++ b/pygmt/helpers/decorators.py
@@ -476,7 +476,6 @@ def _insert_alias(module_func, default_value=None):
     """
     Function to insert PyGMT long aliases into the signature of a method.
     """
-
     # Get current signature and parameters
     sig = signature(module_func)
     wrapped_params = list(sig.parameters.values())

I think we need to pin docformatter to <1.6.0, agree?

@seisman seisman added the maintenance Boring but important stuff for the core devs label Apr 4, 2023
@michaelgrund
Copy link
Member

Agree!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Boring but important stuff for the core devs
Projects
None yet
2 participants