-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from mapbox/pep8isgr8
Pep8isgr8
- Loading branch information
Showing
18 changed files
with
581 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
repos: | ||
- | ||
repo: 'https://github.com/ambv/black' | ||
# 18.6b1 | ||
rev: stable | ||
hooks: | ||
- id: black | ||
args: ['--safe'] | ||
- | ||
repo: 'https://github.com/pre-commit/pre-commit-hooks' | ||
rev: v2.0.0 | ||
hooks: | ||
- id: flake8 | ||
args: [ | ||
# E501 let black handle all line length decisions | ||
# W503 black conflicts with "line break before operator" rule | ||
# E203 black conflicts with "whitespace before ':'" rule | ||
# E722 bare excepts need to be addressed | ||
'--ignore=E501,W503,E203,E722'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,48 @@ | ||
## Welcome | ||
|
||
Hi there! Welcome to the tilesets-cli contributing document. Issues, comments, and pull requests are welcome. Please tag @mapsam, @dianeschulze, and @millzpaugh for any questions or reviews. | ||
Hi there! Welcome to the tilesets-cli contributing document. Issues, comments, and pull requests are welcome. Please tag @mapsam, @dianeschulze, and @dnomadb for any questions or reviews. | ||
|
||
## Installation | ||
First, clone the repo and `cd` into the folder: | ||
``` | ||
$ git clone [email protected]:mapbox/tilesets-cli.git | ||
$ cd tilesets-cli | ||
``` | ||
Then, in a virtual environment, install the module with `[test]` extras: | ||
``` | ||
pip install -e '.[test]' | ||
``` | ||
## Pre-commit hooks | ||
We use [pre-commit hooks](https://pre-commit.com/) to auto-format and validate code before committing. `pre-commit` is included with the `[test]` extras, but you must run: | ||
``` | ||
$ pre-commit install | ||
``` | ||
within the repo to have the actions specified in `.pre-commit-config.yaml` registered. | ||
|
||
After this, when committing, you'll see: | ||
``` | ||
git commit -m 'update version' | ||
black....................................................................Passed | ||
Flake8...................................................................Passed | ||
``` | ||
If your pre-commit hooks ran successfully. Note that `black` modifies your code, which means that if there is a syntax error you'll first see something like: | ||
``` | ||
git commit -m '{message}' | ||
black....................................................................Failed | ||
hookid: black | ||
Files were modified by this hook. Additional output: | ||
reformatted this/file/was/reformatted.py | ||
All done! ✨ 🍰 ✨ | ||
1 file reformatted. | ||
Flake8...................................................................Failed | ||
hookid: flake8 | ||
this/file/was/reformatted.py:{line}:{character}: {what was incorrect} | ||
``` | ||
After which you can add these changes and commit again. Note that failing pre-commit commands mean that the commit has not taken place: you must commit again! | ||
|
||
## Release process | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,31 +4,40 @@ | |
|
||
|
||
# Get the long description from the relevant file | ||
with codecs_open('README.md', encoding='utf-8') as f: | ||
with codecs_open("README.md", encoding="utf-8") as f: | ||
long_description = f.read() | ||
|
||
|
||
def read(fname): | ||
return open(os.path.join(os.path.dirname(__file__), fname)).read() | ||
|
||
setup(name='tilesets-cli', | ||
version='0.2.0', | ||
description=u"CLI for interacting with and preparing data for the Tilesets API", | ||
long_description=long_description, | ||
classifiers=[], | ||
keywords='', | ||
author=u"Mapbox", | ||
author_email='[email protected]', | ||
url='https://github.com/mapbox/tilesets-cli', | ||
license='BSD-2', | ||
packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), | ||
install_requires=["boto3", "click~=7.0", "requests", "jsonschema~=3.0", "jsonseq~=1.0"], | ||
include_package_data=True, | ||
zip_safe=False, | ||
extras_require={ | ||
'test': ['pytest>=3.6.0', 'pytest-cov'], | ||
}, | ||
entry_points=""" | ||
|
||
setup( | ||
name="tilesets-cli", | ||
version="0.2.0", | ||
description=u"CLI for interacting with and preparing data for the Tilesets API", | ||
long_description=long_description, | ||
classifiers=[], | ||
keywords="", | ||
author=u"Mapbox", | ||
author_email="[email protected]", | ||
url="https://github.com/mapbox/tilesets-cli", | ||
license="BSD-2", | ||
packages=find_packages(exclude=["ez_setup", "examples", "tests"]), | ||
install_requires=[ | ||
"boto3", | ||
"click~=7.0", | ||
"requests", | ||
"jsonschema~=3.0", | ||
"jsonseq~=1.0", | ||
], | ||
include_package_data=True, | ||
zip_safe=False, | ||
extras_require={ | ||
"test": ["pytest>=3.6.0", "pytest-cov", "pre-commit", "black", "pep8"] | ||
}, | ||
entry_points=""" | ||
[console_scripts] | ||
tilesets=tilesets.cli:cli | ||
""" | ||
) | ||
""", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.