-
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.
Cleanup cookiecutter options, and use package name instead of repo na…
…me for project folder
- Loading branch information
Showing
10 changed files
with
131 additions
and
42 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
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 |
---|---|---|
|
@@ -4,4 +4,4 @@ Changelog | |
v0.0.1 () | ||
--------- | ||
|
||
* First tag. | ||
* First Commit |
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,4 +1,6 @@ | ||
-r dev.txt | ||
|
||
mock==2.0.0 | ||
pytest==3.6.3 | ||
pluggy==0.9.0 | ||
pytest==4.4.1 | ||
pytest-flake8==1.0.4 |
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
File renamed without changes.
14 changes: 14 additions & 0 deletions
14
{{cookiecutter.repo_name}}/src/{{cookiecutter.package_name}}/__main__.py
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,14 @@ | ||
""" | ||
Entrypoint module, in case you use `python -mprotean`. | ||
Why does this file exist, and why __main__? For more info, read: | ||
- https://www.python.org/dev/peps/pep-0338/ | ||
- https://docs.python.org/2/using/cmdline.html#cmdoption-m | ||
- https://docs.python.org/3/using/cmdline.html#cmdoption-m | ||
""" | ||
from {{ cookiecutter.package_name }}.cli import main | ||
|
||
if __name__ == "__main__": | ||
main() |
36 changes: 36 additions & 0 deletions
36
{{cookiecutter.repo_name}}/src/{{cookiecutter.package_name}}/cli.py
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,36 @@ | ||
""" | ||
Module that contains the command line app. | ||
Why does this file exist, and why not put this in __main__? | ||
You might be tempted to import things from __main__ later, but that will cause | ||
problems: the code will get executed twice: | ||
- When you run `python -mprotean` python will execute | ||
``__main__.py`` as a script. That means there won't be any | ||
``protean.__main__`` in ``sys.modules``. | ||
- When you import __main__ it will get executed again (as a module) because | ||
there's no ``protean.__main__`` in ``sys.modules``. | ||
Also see (1) from http://click.pocoo.org/5/setuptools/#setuptools-integration | ||
""" | ||
import click | ||
|
||
|
||
@click.group(invoke_without_command=True) | ||
@click.version_option() | ||
@click.pass_context | ||
def main(ctx): | ||
"""CLI utilities for the {{ cookiecutter.project_name }}""" | ||
if ctx.invoked_subcommand is None: | ||
click.echo(ctx.get_help()) | ||
|
||
|
||
@main.command() | ||
def test(): | ||
import pytest | ||
import sys | ||
|
||
errno = pytest.main(['-v', '--flake8']) | ||
|
||
sys.exit(errno) |