-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use invoke to standardize checks and tasks
- Loading branch information
Showing
27 changed files
with
299 additions
and
91 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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,2 +1,4 @@ | ||
include README.md LICENSE.md pymapadmin/py.typed | ||
include README.md LICENSE.md pyproject.toml pymapadmin/py.typed | ||
recursive-include pymapadmin *.pyi | ||
recursive-include test *.py | ||
prune tasks |
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,3 +1,2 @@ | ||
sphinx | ||
sphinx-autodoc-typehints | ||
cloud_sptheme |
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
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
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,25 @@ | ||
[build-system] | ||
requires = ['setuptools', 'wheel'] | ||
|
||
[tool.mypy] | ||
strict = true | ||
files = ['pymapadmin', 'test'] | ||
|
||
[[tool.mypy.overrides]] | ||
module = 'google.rpc.*' | ||
ignore_missing_imports = true | ||
|
||
[tool.pytest.ini_options] | ||
testpaths = 'test' | ||
asyncio_mode = 'auto' | ||
norecursedirs = 'doc' | ||
|
||
[tool.coverage.report] | ||
fail_under = 90 | ||
omit = ['*/main.py', '*/config.py', '*/local.py', '*/grpc/*'] | ||
exclude_lines = [ | ||
'pragma: no cover', | ||
'NotImplemented', | ||
'^\s*...\s*$', | ||
'def __repr__', | ||
] |
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,16 +1,2 @@ | ||
[mypy] | ||
files = pymapadmin, test | ||
ignore_missing_imports = True | ||
|
||
[flake8] | ||
exclude = pymapadmin/grpc | ||
|
||
[tool:pytest] | ||
asyncio_mode = auto | ||
|
||
[coverage:report] | ||
omit = */main.py, */config.py, */local.py, */grpc/* | ||
exclude_lines = | ||
pragma: no cover | ||
NotImplementedError | ||
^\s*...\s*$ |
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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# type: ignore | ||
|
||
import os | ||
import os.path | ||
from shlex import join | ||
from invoke import task, Collection | ||
|
||
from . import check, doc, lint, test, types | ||
|
||
|
||
@task | ||
def clean(ctx, full=False): | ||
"""Delete all the standard build and validate artifacts.""" | ||
if full: | ||
ctx.run('git clean -dfX') | ||
else: | ||
anywhere = ['__pycache__'] | ||
top_level = [ | ||
'.coverage', | ||
'.mypy_cache', | ||
'.pytest_cache', | ||
'dist', | ||
'doc/build/'] | ||
for name in anywhere: | ||
for path in [ctx.package, 'test']: | ||
subpaths = [os.path.join(subpath, name) | ||
for subpath, dirs, names in os.walk(path) | ||
if name in dirs or name in names] | ||
for subpath in subpaths: | ||
ctx.run(join(['rm', '-rf', subpath])) | ||
for name in top_level: | ||
ctx.run(join(['rm', '-rf', name])) | ||
|
||
|
||
@task | ||
def install(ctx, dev=True, update=False): | ||
"""Install the library and all development tools.""" | ||
choice = 'dev' if dev else 'all' | ||
if update: | ||
ctx.run('pip install -U -r requirements-{}.txt'.format(choice)) | ||
else: | ||
ctx.run('pip install -r requirements-{}.txt'.format(choice)) | ||
|
||
|
||
@task(test.all, types.all, lint.all) | ||
def validate(ctx): | ||
"""Run all tests, type checks, and linters.""" | ||
pass | ||
|
||
|
||
ns = Collection(clean, install) | ||
ns.add_task(validate, default=True) | ||
ns.add_collection(check) | ||
ns.add_collection(test) | ||
ns.add_collection(types) | ||
ns.add_collection(lint) | ||
ns.add_collection(doc) | ||
|
||
ns.configure({ | ||
'package': 'pymapadmin', | ||
'run': { | ||
'echo': True, | ||
'pty': True, | ||
} | ||
}) |
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 @@ | ||
# type: ignore | ||
|
||
import warnings | ||
|
||
from invoke import task, Collection | ||
|
||
|
||
@task | ||
def check_import(ctx): | ||
"""Check that the library can be imported.""" | ||
try: | ||
__import__(ctx.package) | ||
except Exception: | ||
warnings.warn('Could not import {!r}, ' | ||
'task may fail'.format(ctx.package)) | ||
|
||
|
||
ns = Collection() | ||
ns.add_task(check_import, default=True) |
Oops, something went wrong.