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

Support a blackdoc section in pyproject.toml #47

Merged
merged 2 commits into from
Sep 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion blackdoc/blackcompat.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ def parse_pyproject_toml(path_config):
If parsing fails, will raise a toml.TomlDecodeError
"""
pyproject_toml = toml.load(path_config)
config = pyproject_toml.get("tool", {}).get("black", {})
black_config = pyproject_toml.get("tool", {}).get("black", {})
blackdoc_config = pyproject_toml.get("tool", {}).get("blackdoc", {})
config = {**black_config, **blackdoc_config}

return {k.replace("--", "").replace("-", "_"): v for k, v in config.items()}


Expand Down
3 changes: 2 additions & 1 deletion doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ v0.2 (*unreleased*)
:rst:dir:`testcleanup` directives (:pull:`39`).
- fix working with lines containing only the prompt and avoid changing the
quotes of nested docstrings (:issue:`41`, :pull:`43`)
- allow configuring the use of ``black`` using ``pyproject.toml`` (:issue:`40`, :pull:`45`)
- allow configuring ``blackdoc`` using ``pyproject.toml``
(:issue:`40`, :pull:`45`, :pull:`47`)


v0.1.2 (31 August 2020)
Expand Down