Skip to main content

Google/Excel Sheets API Python.

Project description

brunette

🟤 A best practice Python code formatter

PyPI version

This is the "black" formatter but with some improvements:

  1. --config option supports setup.cfg format.
  2. Adds single-quotes option to enable single quotes as the preferred.

Installation

pip install brunette

Usage

Use in the same way you would the 'black' formatter.

brunette *.py --config=setup.cfg

Example setup.cfg:

[tool:brunette]
line-length = 79
verbose = true
single-quotes = false
# etc, etc...

This can also be combined with Flake8's configuration:

[flake8]
# This section configures `flake8`, the python linting utility.
# See also https://flake8.pycqa.org/en/latest/user/configuration.html
ignore = E201,E202,E203
# E201 - whitespace after ‘(‘
# E202 - whitespace before ‘)’
# E203 - whitespace before ‘:’

# Exclude the git directory and virtualenv directory (as `.env`)
exclude = .git,.env

[tool:brunette]
line-length = 79
# etc, etc...

Why does this need to exist?

  • The current maintainer of Black, refuses to allow a single-quotes option. Due to his own personal preference (a preference which most of the Python community do not share).

  • The current maintainer of Black, refuses to add setup.cfg support. Setup.cfg is the most widely used configuration file for Python projects. The maintainer of that library prefers "project.tolm" few people use at this time due to it's inflexibility and it requiring you to use Poetry, whatever that is.

  • The current configuration file format as adopted by Black may conflict with the new build isolation context with pip. To avoid this, the use of a setup.cfg file is preferred but the policy is under review by the maintainers (https://github.com/pypa/pip/issues/8437#issuecomment-644196428).

How to configure in VSCode

  1. In your terminal type which brunette to get the full path to your brunette installation.

In my case this looks like /home/work/.pyenv/shims/brunette. Now copy whatever that value is.

  1. Open the setttings UI.

  2. Search for black.

  • Paste that path into "Black Path".
  • Set black as the Python Formatting Provider.

https://i.imgur.com/6EXoamM.png

  1. That's it! Now whenever you format your Python code brunette will be used.

How to configure with Pre-Commit (https://pre-commit.com)

  1. Run pip install pre-commit to install

  2. Add a local repo option for brunette in .pre-commit-config.yaml

# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
  - repo: local
    hooks:
      - id: brunette
        name: brunette
        description: Run Brunette on Python code (fork of Black).
        entry: brunette --config=setup.cfg
        language: system
        types: [python]
  # Drop-in replacement for black with brunette
  # - repo: https://github.com/psf/black
  #   rev: stable
  #   hooks:
  #     - id: black
  #       language_version: python3.6
  - repo: https://gitlab.com/pycqa/flake8
    rev: 3.8.1
    hooks:
      - id: flake8
  1. Run pre-commit install to install the Git pre-commit hook

  2. Run pre-commit run to validate all files

Release History

0.1.6 (2020-06-26)

  • Documentation updates.

0.1.5 (2020-06-18)

  • Documentation updates.

0.1.4 (2020-06-16)

  • Handle when setup.cfg is missing.

0.1.3 (2020-06-16)

  • Handle when setup.cfg is missing.

0.1.2 (2020-06-16)

  • Added __main__ for CLI exec.

0.1.1 (2020-06-15)

  • Adds wheels.

0.1.0 (2020-06-15)

  • Initial release.

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

brunette-0.1.6.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

brunette-0.1.6-py2.py3-none-any.whl (5.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file brunette-0.1.6.tar.gz.

File metadata

  • Download URL: brunette-0.1.6.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.0

File hashes

Hashes for brunette-0.1.6.tar.gz
Algorithm Hash digest
SHA256 96423684278ec6d721f26148576153a7613c678e901861a805239ddd6b314fed
MD5 15d736a3f2fbbb0befcec70c3d8db098
BLAKE2b-256 6fde56c385b443a3eb87172c4e5112324882d90c86a431cfa4d3ad95985f9f08

See more details on using hashes here.

File details

Details for the file brunette-0.1.6-py2.py3-none-any.whl.

File metadata

  • Download URL: brunette-0.1.6-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.0

File hashes

Hashes for brunette-0.1.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e95f49b858c6e5dfb80d4e8e56c9b1ac1917573f67089d24ef15853b01666873
MD5 b71637173f38c588f258c10c9c12c435
BLAKE2b-256 a078127de3d5336ad35a69949182421eae7513207fa6e7db3c63c56371518e22

See more details on using hashes here.

Supported by

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