Skip to main content

Black for Python docstrings and reStructuredText (rst)

Project description

Style-Doc

Apache 2.0 License Contributor Covenant Python Version pypi
pytest Static Code Checks GitHub issues

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.

Style-Doc can handle Linux, Windows and Mac style line endings. The output will nevertheless be convertet to \n Linux line endings.

Table of Contents

Maintainers

One Conversation
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 team. Many thanks for your consent to publish it as a standalone package 🤗 ♥.

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              file(s) or folder(s) to restyle

optional arguments:
  -h, --help         show this help message and exit
  --max_len MAX_LEN  maximum length of lines, default: 119
  --check_only       only check and not fix styling issues
  --py_only          only check py files
  --rst_only         only check rst files

Examples

  • format all docstrings (.py files) and rst files in the src and docs folder with line length of 99:
    style-doc --max_len 99 src docs
  • check all docstrings (.py files) and rst files in the src and docs 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.

Support and Feedback

The following channels are available for discussions, feedback, and support requests:

Reporting Security Vulnerabilities

This project is built with security and data privacy in mind to ensure your data is safe. We are grateful for security researchers and users reporting a vulnerability to us, first. To ensure that your request is handled in a timely manner and non-disclosure of vulnerabilities can be assured, please follow the below guideline.

Please do not report security vulnerabilities directly on GitHub. GitHub Issues can be publicly seen and therefore would result in a direct disclosure.

Please address questions about data privacy, security concepts, and other media requests to the opensource@telekom.de mailbox.

Contribution

Our commitment to open source means that we are enabling - in fact encouraging - all interested parties to contribute and become part of our developer community.

Contribution and feedback is encouraged and always welcome. For more information about how to contribute, as well as additional contribution information, see our Contribution Guidelines.

Code of Conduct

This project has adopted the Contributor Covenant as our code of conduct. Please see the details in our Contributor Covenant Code of Conduct. All contributors must abide by the code of conduct.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

style_doc-0.2.0.tar.gz (21.6 kB view details)

Uploaded Source

Built Distribution

style_doc-0.2.0-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file style_doc-0.2.0.tar.gz.

File metadata

  • Download URL: style_doc-0.2.0.tar.gz
  • Upload date:
  • Size: 21.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for style_doc-0.2.0.tar.gz
Algorithm Hash digest
SHA256 19177b77428fb0b4a2e0f4e320397e4c1a6de5213fcdab995c271eb12883f7ef
MD5 fdbd6cd08483d3af6ff7129a6febac60
BLAKE2b-256 f312491fcdd52cd647b9245448c59a4cee4ddf1f9aa96419f41cca90fb09dce0

See more details on using hashes here.

Provenance

File details

Details for the file style_doc-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: style_doc-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for style_doc-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fe60fd196834660dbf487c6b8d8f69f5c59004853e349c26da0956c4b22a79a1
MD5 133823b7cbc43636ec4faef681c96674
BLAKE2b-256 b0612646a4f2e85c4edf3eea23ac64c63268c34601ac1e6ae26e47b5d5b34f02

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page