Skip to content

Commit

Permalink
Run pydocstyle as a test on Travis CI (#80)
Browse files Browse the repository at this point in the history
* Add pydocstyle config

For now, we're only selecting D1xx.

* Have Travis run pydocstyle

* Add missing docstrings

Also restrict pydocstyle to module code.

* Add requirements and check tests

* Add missing tests package docstring

* Fix version
  • Loading branch information
sgillies committed Jun 4, 2018
1 parent 1f760eb commit 8971be3
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 23 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,7 @@ venv/
venv2/

# vim
.*.swp
.*.swp

.DS_Store
.pytest_cache
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ python:
- "3.5"
- "3.6"
install:
- "pip install pytest-cov"
- "pip install -e ."
- "pip install -r requirements.txt"
- "pip install -e .[test]"
script:
- "python -m pytest --cov mercantile --cov-report term-missing"
- "python -m pydocstyle mercantile tests"
after_success:
- coveralls
deploy:
Expand Down
12 changes: 12 additions & 0 deletions mercantile/scripts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@


def configure_logging(verbosity):
"""Configure logging level
Parameters
----------
verbosity : int
The number of `-v` options from the command line.
Returns
-------
None
"""
log_level = max(10, 30 - 10 * verbosity)
logging.basicConfig(stream=sys.stderr, level=log_level)

Expand Down Expand Up @@ -60,6 +71,7 @@ def iter_lines(lines):
@click.version_option(version=mercantile.__version__, message='%(version)s')
@click.pass_context
def cli(ctx, verbose, quiet):
"""Execute the main mercantile command"""
verbosity = verbose - quiet
configure_logging(verbosity)
ctx.obj = {}
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
click==6.7
pydocstyle==2.1.1
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pydocstyle]
select = D1
47 changes: 27 additions & 20 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,35 @@

open_kwds = {}
if sys.version_info > (3,):
open_kwds['encoding'] = 'utf-8'
open_kwds["encoding"] = "utf-8"

with open('README.rst', **open_kwds) as f:
with open("README.rst", **open_kwds) as f:
readme = f.read()

setup(name='mercantile',
version='1.0.3',
description="Web mercator XYZ tile utilities",
long_description=readme,
classifiers=[
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3'],
keywords='mapping, web mercator, tiles',
author='Sean Gillies',
author_email='sean@mapbox.com',
url='https://github.com/mapbox/mercantile',
license='BSD',
packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
include_package_data=True,
zip_safe=False,
install_requires=['click>=3.0'],
entry_points='''
setup(
name="mercantile",
version="1.0.4",
description="Web mercator XYZ tile utilities",
long_description=readme,
classifiers=[
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
],
keywords="mapping, web mercator, tiles",
author="Sean Gillies",
author_email="sean@mapbox.com",
url="https://github.com/mapbox/mercantile",
license="BSD",
packages=find_packages(exclude=["ez_setup", "examples", "tests"]),
include_package_data=True,
zip_safe=False,
install_requires=["click>=3.0"],
extras_require={
"dev": ["check-manifest"],
"test": ["coveralls", "pytest-cov", "pydocstyle"],
},
entry_points="""
[console_scripts]
mercantile=mercantile.scripts:cli
''')
""",
)
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Mercantile tests package"""

0 comments on commit 8971be3

Please sign in to comment.