PyCQA / docformatter

Formats docstrings to follow PEP 257
https://pypi.python.org/pypi/docformatter
MIT License
524 stars 61 forks source link

Sphinx examples format issue in v1.7.1 #225

Closed steut001 closed 1 year ago

steut001 commented 1 year ago

The following behavior has started happening in version 1.7.1, this did not happen in 1.7.0. The following code is in a docstring at the top of a python file that is used to create Sphinx gallery examples.

"""
===============================
Example of creating an example.
===============================
 ...
"""

is being reformatted to this, which is not desired

"""=============================== Example of creating an example.
===============================
 ...
"""

Was there a new rule that was implemented causing this problem that didn't previously exist. I'd rather not have to exclude the examples folder from the docformatter checks.

weibullguy commented 1 year ago

I can't reproduce this. Could you provide a link to the file so I can use it to troubleshoot?

steut001 commented 1 year ago

Here is the entire contents of the file.

"""
===============================
Example of creating an example.
===============================

.. currentmodule:: my_project

In this example, we illustrate how to create an example.
"""
print(__doc__)

# Authors: Tara Wilson

# %%
# Example of printing an environment variable
#############################################
#
# Explain what this example is doing and anything the user should know.
#

import os

path = os.getenv("PATH", "hello")
print(path)

And my pyproject.toml has this:

[tool.docformatter]
black = true
non-strict = false
in-place = true
recursive = true

Running docformatter --config ./pyproject.toml examples/plot_dummy_example.py should reproduce it for you using docformatter[tomli] version 1.7.1

weibullguy commented 1 year ago

OK. Now I can reproduce the problem. Thanks for the feedback, I'll get on this tonight.

weibullguy commented 1 year ago

@steut001 this should be fixed in v1.7.2-rc4.

steut001 commented 1 year ago

Awesome, thank you!Sent from my iPhoneOn Jun 2, 2023, at 9:52 AM, Doyle Rowland @.***> wrote: @steut001 this should be fixed in v1.7.2-rc4.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

weibullguy commented 1 year ago

Closing this issue to #231.