Skip to content

Integrate black into development process #873

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 24, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions buildspec-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ phases:
# run linters
- tox -e flake8,pylint

# run formatter
#- tox -e black-check # TODO: Uncomment once black formatting for all files has been pushed - knakad@

# run package and docbuild checks
- tox -e twine
- tox -e sphinx
Expand Down
3 changes: 3 additions & 0 deletions buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ phases:
- tox -e twine
- tox -e sphinx

# run formatter
#- tox -e black-check # TODO: Uncomment once black formatting for all files has been pushed - knakad@

# run unit tests
- AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_SESSION_TOKEN=
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI= AWS_DEFAULT_REGION=
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def read_version():
extras_require={
'test': ['tox', 'flake8', 'pytest==4.4.1', 'pytest-cov', 'pytest-rerunfailures',
'pytest-xdist', 'mock', 'tensorflow>=1.3.0', 'contextlib2',
'awslogs', 'pandas']},
'awslogs', 'pandas', 'black==19.3b0 ; python_version >= \'3.6\'']},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Black is only supported for version 3.6: https://github.com/python/black
Additionally, I specified an exact version because I didn't want a PR build to fail black-check by grabbing a newer black version than was run locally.


entry_points={
'console_scripts': ['sagemaker=sagemaker.cli.main:main'],
Expand Down
16 changes: 15 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# and then run "tox" from this directory.

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

skip_missing_interpreters = False

Expand Down Expand Up @@ -112,3 +112,17 @@ deps =
commands =
pip install --exists-action=w -r requirements.txt
sphinx-build -T -W -b html -d _build/doctrees-readthedocs -D language=en . _build/html

[testenv:black-format]
# Used during development (before committing) to format .py files.
basepython = python3
deps = black==19.3b0
commands =
black -l 100 ./

[testenv:black-check]
# Used by automated build steps to check that all files are properly formatted.
basepython = python3
deps = black==19.3b0
commands =
black -l 100 --check ./