Skip to content

Commit

Permalink
Add black to tox.ini and pyproject.toml
Browse files Browse the repository at this point in the history
And update docs accordingly
  • Loading branch information
TheRealFalcon committed Dec 14, 2021
1 parent 291e402 commit 4c34924
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ Documentation should be written in Markdown whenever possible.
When making changes please keep the following in mind:

* Keep pull requests limited to a single issue
* Code must be formatted to [Black](https://black.readthedocs.io/en/stable/index.html) standards
* Run `tox -e format` to reformat code accordingly
* Run `tox` to execute style and lint checks
* Use [Google styling](https://github.com/google/styleguide/blob/gh-pages/pyguide.md) for docstrings
* When adding new clouds please add detailed documentation under the `docs` directory and code examples under `examples`
* 4 spaces, no tabs

## Submit a Merge Request

Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[tool.black]
line-length = 79
target-version = ['py36']
15 changes: 14 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[tox]
envlist = flake8, pylint, pytest, docs
# As it may be undesired to make formatting changes, by default only check
envlist = flake8, pylint, pytest, black, docs
skipsdist = true

[common]
Expand All @@ -8,6 +9,7 @@ deps =
flake8==4.0.1
flake8-docstrings==1.6.0
pylint==2.12.2
black==21.12b0
-rrequirements.txt
-rtest-requirements.txt

Expand All @@ -26,6 +28,17 @@ envdir = {[common]envdir}
deps = {[common]deps}
commands = {envpython} -m flake8 pycloudlib examples setup.py

[testenv:black]
envdir = {[common]envdir}
deps = {[common]deps}
commands = {envpython} -m black . --check

[testenv:format]
# Should also include isort in the future
envdir = {[common]envdir}
deps = {[common]deps}
commands = {envpython} -m black .

[testenv:docs]
# Docs uses a separate environment because the changedir will
# cause tox to recreate the environment.
Expand Down

0 comments on commit 4c34924

Please sign in to comment.