Skip to content

Move docformatter options from Makefile to pyproject.toml#2072

Merged
seisman merged 3 commits intomainfrom
docformamtter-pyproject.toml
Aug 30, 2022
Merged

Move docformatter options from Makefile to pyproject.toml#2072
seisman merged 3 commits intomainfrom
docformamtter-pyproject.toml

Conversation

@seisman
Copy link
Member

@seisman seisman commented Aug 20, 2022

Description of proposed changes

docformatter started to support storing options in pyproject.toml since v1.5.0 ( PyCQA/docformatter#77).

This PR moves docformatter options from Makefile to pyproject.toml.

However, docformatter v1.5.0 is still not available in the conda-forge channel yet (see conda-forge/docformatter-feedstock#4), so keep this PR in draft mode.

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs.
  • If adding new functionality, add an example to docstrings or tutorials.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash commands are:

  • /format: automatically format and lint the code
  • /test-gmt-dev: run full tests on the latest GMT development version

@seisman seisman added the maintenance Boring but important stuff for the core devs label Aug 21, 2022
@seisman seisman added this to the 0.8.0 milestone Aug 21, 2022
@seisman seisman marked this pull request as ready for review August 29, 2022 01:30
@seisman seisman added the needs review This PR has higher priority and needs review. label Aug 29, 2022
FLAKEHEAVEN_FILES=$(PROJECT) doc/conf.py examples
FORMAT_FILES=$(PROJECT) doc/conf.py examples
LINT_FILES=$(PROJECT) doc/conf.py
BLACKDOC_OPTIONS=--line-length 79
Copy link
Member

Choose a reason for hiding this comment

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

Apparently blackdoc supports configuration in pyproject.toml since v0.2 on 1 Oct 2020, though it's not well documented. See keewis/blackdoc#40 and https://github.com/keewis/blackdoc/pull/45/files.

So we could remove this BLACKDOC_OPTIONS line in the Makefile, and add the config to pyproject.toml like so:

[tool.blackdoc]
line-length=79

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, blackdoc supports pyproject.toml, but I don't think you change works, because line-length should be put in the [tool.black] section (see https://blackdoc.readthedocs.io/en/latest/options.html).

So, line-length in the [tool.black] section will affect both black and blackdoc.

Copy link
Member

@weiji14 weiji14 Aug 29, 2022

Choose a reason for hiding this comment

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

The blackdoc documentation is wrong/incomplete I think, I tried adding line-length=70 under tool.blackdoc and it works to format only the docstring when I run make format. The line-length for the regular code lines (controlled by tool.black) remains at 88.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK. I'll try it later, but perhaps better to do it in a separate PR instead.

Copy link
Member

Choose a reason for hiding this comment

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

Sure, let's do blackdoc in a separate PR. The changes here are good for docformatter.

@weiji14 weiji14 added final review call This PR requires final review and approval from a second reviewer and removed needs review This PR has higher priority and needs review. labels Aug 29, 2022
@seisman seisman removed the maintenance Boring but important stuff for the core devs label Aug 30, 2022
@seisman seisman merged commit 8d41043 into main Aug 30, 2022
@seisman seisman deleted the docformamtter-pyproject.toml branch August 30, 2022 04:21
@seisman seisman added maintenance Boring but important stuff for the core devs and removed final review call This PR requires final review and approval from a second reviewer labels Aug 30, 2022
sixy6e pushed a commit to sixy6e/pygmt that referenced this pull request Dec 21, 2022
…pingTools#2072)

* Move docformatter options from Makefile to pyproject.toml
* Rename BLACK_FILES, DOCFORMATTER_FILES, and FLAKEHEAVEN_FILES to FORMAT_FILES
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

Development

Successfully merging this pull request may close these issues.

2 participants