Skip to content

Commit b34eac7

Browse files
author
Sergey Vilgelm
committed
Remove flake8 validation and add black instead
Add a `checks` job in workflow to do a preliminary checks
1 parent 312a540 commit b34eac7

File tree

7 files changed

+32
-23
lines changed

7 files changed

+32
-23
lines changed

.github/workflows/test.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,23 @@ on:
99
schedule:
1010
- cron: "0 1 * * *"
1111
jobs:
12-
test:
12+
checks:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Set up Python 3.8
16+
uses: actions/setup-python@v1
17+
with:
18+
python-version: 3.8
19+
- name: Checkout code
20+
uses: actions/checkout@v2
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install ".[dev]"
25+
- name: Format with black
26+
run: black --check $(git diff --name-only --diff-filter=AM ${{ github.base_ref }} -- "*.py")
27+
unit-tests:
28+
needs: checks
1329
runs-on: ubuntu-latest
1430
strategy:
1531
matrix:
@@ -24,7 +40,7 @@ jobs:
2440
- name: Install dependencies
2541
run: |
2642
python -m pip install --upgrade pip
27-
pip install ".[dev]"
43+
pip install ".[test]"
2844
- name: Test with inv
2945
run: inv cover qa
3046
- name: Coveralls
@@ -35,7 +51,7 @@ jobs:
3551
env:
3652
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
3753
bench:
38-
needs: test
54+
needs: unit-tests
3955
runs-on: ubuntu-latest
4056
if: github.event_name == 'pull_request'
4157
steps:

CONTRIBUTING.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ There are some rules to follow:
4141

4242
- your contribution should be documented (if needed)
4343
- your contribution should be tested and the test suite should pass successfully
44-
- your code should be mostly PEP8 compatible with a 120 characters line length
44+
- your code should be properly formatted (use ``black .`` to format)
4545
- your contribution should support both Python 2 and 3 (use ``tox`` to test)
4646

4747
You need to install some dependencies to develop on flask-restx:

README.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ Flask RESTX
1818
:target: https://pypi.org/project/flask-restx
1919
:alt: Supported Python versions
2020
.. image:: https://badges.gitter.im/Join%20Chat.svg
21-
:alt: Join the chat at https://gitter.im/python-restx
22-
:target: https://gitter.im/python-restx?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
21+
:target: https://gitter.im/python-restx?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
22+
:alt: Join the chat at https://gitter.im/python-restx
23+
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
24+
:target: https://github.com/psf/black
25+
:alt: Code style: black
2326

2427

2528
Flask-RESTX is a community driven fork of `Flask-RESTPlus <https://github.com/noirbizarre/flask-restplus>`_.

requirements/develop.pip

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
invoke==1.3.0
2-
flake8==3.7.8
3-
readme-renderer==24.0
41
tox==3.13.2
5-
twine==1.15.0
2+
black==19.10b0; python_version >= '3.6'

requirements/test.pip

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ pytest-mock==1.10.4
1010
pytest-profiling==1.7.0
1111
pytest-sugar==0.9.2
1212
tzlocal
13+
14+
invoke==1.3.0
15+
readme-renderer==24.0
16+
twine==1.15.0

setup.cfg

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
[flake8]
2-
ignore = E124,E128
3-
max-line-length = 120
4-
exclude = doc,.git
5-
61
[bdist_wheel]
72
universal = 1
83

tasks.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,6 @@ def qa(ctx):
150150
'''Run a quality report'''
151151
header(qa.__doc__)
152152
with ctx.cd(ROOT):
153-
info('Python Static Analysis')
154-
flake8_results = ctx.run('flake8 flask_restx tests', pty=True, warn=True)
155-
if flake8_results.failed:
156-
error('There is some lints to fix')
157-
else:
158-
success('No linter errors')
159153
info('Ensure PyPI can render README and CHANGELOG')
160154
info('Building dist package')
161155
dist = ctx.run('python setup.py sdist', pty=True, warn=False, hide=True)
@@ -168,8 +162,8 @@ def qa(ctx):
168162
error('README and/or CHANGELOG is not renderable by PyPI')
169163
else:
170164
success('README and CHANGELOG are renderable by PyPI')
171-
if flake8_results.failed or readme_results.failed:
172-
exit('Quality check failed', flake8_results.return_code or readme_results.return_code)
165+
if readme_results.failed:
166+
exit('Quality check failed', readme_results.return_code)
173167
success('Quality check OK')
174168

175169

0 commit comments

Comments
 (0)