Skip to content

Commit 33729a0

Browse files
committed
Bring in black + update README
1 parent da9d4cb commit 33729a0

5 files changed

Lines changed: 42 additions & 3 deletions

File tree

.circleci/config.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ version: 2
66
jobs:
77
build:
88
docker:
9-
- image: circleci/python:3.6.1
9+
- image: circleci/python:3.6
1010

1111
working_directory: ~/repo
1212

@@ -25,6 +25,7 @@ jobs:
2525
command: |
2626
python3 -m venv venv
2727
. venv/bin/activate
28+
pip install --upgrade pip
2829
pip install -r .circleci/requirements.txt
2930
3031
- save_cache:
@@ -33,7 +34,8 @@ jobs:
3334
key: v1-dependencies-{{ checksum ".circleci/requirements.txt" }}
3435

3536
- run:
36-
name: flake8
37+
name: Code style check
3738
command: |
3839
. venv/bin/activate
39-
flake8 --exclude=venv
40+
flake8
41+
black --check .

.circleci/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
black==18.9b0
12
flake8==3.5.0

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
11
# Real Python Materials
2+
23
Bonus materials, exercises, and example projects for our [Python tutorials](https://realpython.com).
34

45
Build Status: [![CircleCI](https://circleci.com/gh/realpython/materials.svg?style=svg)](https://circleci.com/gh/realpython/materials)
6+
7+
## Running Code Style Checks
8+
9+
We use [flake8](http://flake8.pycqa.org/en/latest/) and [black](https://github.com/ambv/black) to ensure a consistent code style for all of our sample code in this repository.
10+
11+
Run the following commands to validate your code against the linters:
12+
13+
```sh
14+
$ flake8
15+
$ black --check .
16+
```
17+
18+
## Running Python Code Formatter
19+
20+
To automatically re-format your code to be consistent with our code style guidelines, run [black](https://github.com/ambv/black) in the repository root folder:
21+
22+
```sh
23+
$ black .
24+
```

pyproject.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[tool.black]
2+
line-length = 79
3+
py36 = true
4+
exclude = '''
5+
/(
6+
\.git
7+
| venv
8+
| migrations
9+
| node_modules
10+
)/
11+
'''

setup.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[flake8]
2+
exclude = .git,venv
3+
4+
[pycodestyle]
5+
exclude = .git,venv

0 commit comments

Comments
 (0)