Skip to content

Commit ecc41cb

Browse files
committed
change: Add Black formatting tool as dependency
As of this commit, Black formatting tool can be run with 'tox -e black-format'. Black does not run as part of any automated process, yet. Black is pulled in as a test dependency only if the Python version is greater than 3.6, as the tool is not vended as part of any earlier Python version.
1 parent f1d34ad commit ecc41cb

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

buildspec-release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ phases:
99
# run linters
1010
- tox -e flake8,pylint
1111

12+
# run formatter
13+
#- tox -e black-check # TODO: Uncomment once black formatting for all files has been pushed - knakad@
14+
1215
# run package and docbuild checks
1316
- tox -e twine
1417
- tox -e sphinx

buildspec.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ phases:
1414
- tox -e twine
1515
- tox -e sphinx
1616

17+
# run formatter
18+
#- tox -e black-check # TODO: Uncomment once black formatting for all files has been pushed - knakad@
19+
1720
# run unit tests
1821
- AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_SESSION_TOKEN=
1922
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI= AWS_DEFAULT_REGION=

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def read_version():
6262
extras_require={
6363
'test': ['tox', 'flake8', 'pytest==4.4.1', 'pytest-cov', 'pytest-rerunfailures',
6464
'pytest-xdist', 'mock', 'tensorflow>=1.3.0', 'contextlib2',
65-
'awslogs', 'pandas']},
65+
'awslogs', 'pandas', 'black==19.3b0 ; python_version >= \'3.6\'']},
6666

6767
entry_points={
6868
'console_scripts': ['sagemaker=sagemaker.cli.main:main'],

tox.ini

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# and then run "tox" from this directory.
55

66
[tox]
7-
envlist = flake8,pylint,twine,sphinx,py27,py36
7+
envlist = flake8,pylint,twine,sphinx,py27,py36 # TODO: Add 'black-format' once black formatting for all files has been pushed - knakad@
88

99
skip_missing_interpreters = False
1010

@@ -112,3 +112,17 @@ deps =
112112
commands =
113113
pip install --exists-action=w -r requirements.txt
114114
sphinx-build -T -W -b html -d _build/doctrees-readthedocs -D language=en . _build/html
115+
116+
[testenv:black-format]
117+
# Used during development (before committing) to format .py files.
118+
basepython = python3
119+
deps = black==19.3b0
120+
commands =
121+
black -l 100 ./
122+
123+
[testenv:black-check]
124+
# Used by automated build steps to check that all files are properly formatted.
125+
basepython = python3
126+
deps = black==19.3b0
127+
commands =
128+
black -l 100 --check ./

0 commit comments

Comments
 (0)