Skip to content

Commit b04f4ea

Browse files
committed
Python: Update README with information about code formatting
Also, add a `yapf` section to `setup.cfg` to ensure YAPF runs format code with the Google style.
1 parent d60aa23 commit b04f4ea

File tree

3 files changed

+41
-4
lines changed

3 files changed

+41
-4
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,13 @@ See [Premake5](https://premake.github.io/)
5050

5151
#### Python
5252

53-
The basic commands to build, test and install the Python binding are:
53+
The basic commands to build, test, and install the Python module are:
5454

5555
$ python setup.py build_ext test
5656
$ python setup.py install
5757

58+
See the [Python readme](python/README.md) for more details.
59+
5860
### Benchmarks
5961
* [Squash Compression Benchmark](https://quixdb.github.io/squash-benchmark/) / [Unstable Squash Compression Benchmark](https://quixdb.github.io/squash-benchmark/unstable/)
6062
* [Large Text Compression Benchmark](http://mattmahoney.net/dc/text.html)

python/README.md

+36-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,38 @@
1-
This directory contains Python brotli wrapper module and roundtrip tests.
1+
This directory contains the code for the Python `brotli` module,
2+
`bro.py` tool, and roundtrip tests.
23

3-
To build module execute `python setup.py build_ext` from root project directory.
44

5-
To test module run `python setup.py test`.
5+
### Development
6+
7+
To build the module, execute the following from the root project
8+
directory:
9+
10+
$ python setup.py build_ext
11+
12+
To test the module, execute the following from the root project
13+
directory:
14+
15+
$ python setup.py test
16+
17+
18+
### Code Style
19+
20+
Brotli's code follows the [Google Python Style Guide][]. To
21+
automatically format your code, install [YAPF][]:
22+
23+
$ pip install yapf
24+
25+
Then, either format a single file:
26+
27+
$ yapf --in-place FILE
28+
29+
Or, format all files in a directory:
30+
31+
$ yapf --in-place --recursive DIR
32+
33+
See the [YAPF usage][] documentation for more information.
34+
35+
36+
[Google Python Style Guide]: https://google.github.io/styleguide/pyguide.html
37+
[YAPF]: https://github.com/google/yapf
38+
[YAPF usage]: https://github.com/google/yapf#usage

setup.cfg

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
[build]
22
build-base=bin
33

4+
[yapf]
5+
based_on_style=google

0 commit comments

Comments
 (0)