Black for Python docstrings and reStructuredText (rst)
Project description
Style-Doc
Style-Doc is Black for Python docstrings and reStructuredText (rst). It can be used to format docstrings (Google docstring format) in Python files or reStructuredText.
This project is maintained by the One Conversation
team of Deutsche Telekom AG.
It is based on the
style_doc.py
script from the HuggingFace Inc. team.
Installation
Style-Doc is available at the Python Package Index (PyPI). It can be installed with pip:
$ pip install style-doc
Usage
$ style-doc --help
usage: style-doc [-h] [--max_len MAX_LEN] [--check_only] [--py_only]
[--rst_only]
files [files ...]
positional arguments:
files The file(s) or folder(s) to restyle.
optional arguments:
-h, --help show this help message and exit
--max_len MAX_LEN The maximum length of lines.
--check_only Whether to only check and not fix styling issues.
--py_only Whether to only check py files.
--rst_only Whether to only check rst files.
Examples
- format all docstrings (.py files) and rst files in the
src
anddocs
folder with line length of 99:
style-doc --max_len 99 src docs
- check all docstrings (.py files) and rst files in the
src
anddocs
folder with line length of 99:
style-doc --max_len 99 --check_only src docs
- format all docstrings (.py files only) in the
src
folder with line length of 99:
style-doc --max_len 99 --py_only src
- check all docstrings (.py files only) in the
src
folder with line length of 99:
style-doc --max_len 99 --check_only --py_only src
- format all rst files only in the
docs
folder with line length of 99:
style-doc --max_len 99 --rst_only docs
- check all rst files only in the
docs
folder with line length of 99:
style-doc --max_len 99 --check_only --rst_only docs
To integrate Style-Doc (and more checks) into your GitHub Actions see our static_checks.yml example and our configuration in setup.py.
Licensing
Copyright (c) 2020 The HuggingFace Inc. team
Copyright (c) 2021 Philip May, Deutsche Telekom AG
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for style_doc-0.0.1.dev5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d00802726473b037bb95ea5d85dd9e263ffe85a95474df1c6fc2e810783f972 |
|
MD5 | 2b7c5f28596cc7c53f27cd8fa2e487a2 |
|
BLAKE2b-256 | 89aa85bcd92be861b5d8fb198cdbc3901f81b1e067434053d5c854d9ebf431d8 |