Skip to content

Commit

Permalink
Cleanup cookiecutter options, and use package name instead of repo na…
Browse files Browse the repository at this point in the history
…me for project folder
  • Loading branch information
subhashb committed Apr 19, 2019
1 parent e50f830 commit 37f81b3
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 42 deletions.
53 changes: 35 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
wheelhouse

# PyInstaller
# Usually these files are written by a python script from a template
Expand All @@ -40,7 +39,6 @@ pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
Expand All @@ -49,6 +47,7 @@ coverage.xml
*.cover
.hypothesis/
.pytest_cache/
htmlcov

# Translations
*.mo
Expand All @@ -75,20 +74,9 @@ target/
# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don’t work, or not
# install all needed dependencies.
#Pipfile.lock

# celery beat schedule file
celerybeat-schedule

Expand Down Expand Up @@ -116,8 +104,37 @@ venv.bak/

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
.idea
*.iml
*.komodoproject

# Complexity
output/*.html
output/*/index.html

.DS_Store
*~
.*.sw[po]
.build
.ve
.env
.cache
.pytest
.bootstrap
.appveyor.token
*.bak
.testmondata

# VS Code
.vscode

# Sphinx
docs/.doctrees

# TODOs
TODO
6 changes: 3 additions & 3 deletions cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"website": "https://proteanhq.com",
"github_username": "subhashb",
"project_name": "Domain",
"repo_name": "python-{{ cookiecutter.project_name|lower|replace(' ','-') }}",
"repo_name": "protean-{{ cookiecutter.project_name|lower|replace(' ','-') }}",
"package_name": "{{ cookiecutter.project_name|lower|replace(' ','_')|replace('-','_') }}",
"distribution_name": "{{ cookiecutter.package_name|replace('_','-') }}",
"project_short_description": "An example package. Generated with cookiecutter-protean.",
"version": "0.0.0",
"project_short_description": "A basic Protean Application package. Generated with cookiecutter-protean.",
"version": "0.0.1",
"command_line_interface": [
"plain",
"argparse",
Expand Down
53 changes: 35 additions & 18 deletions {{cookiecutter.repo_name}}/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
wheelhouse

# PyInstaller
# Usually these files are written by a python script from a template
Expand All @@ -40,7 +39,6 @@ pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
Expand All @@ -49,6 +47,7 @@ coverage.xml
*.cover
.hypothesis/
.pytest_cache/
htmlcov

# Translations
*.mo
Expand All @@ -75,20 +74,9 @@ target/
# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don’t work, or not
# install all needed dependencies.
#Pipfile.lock

# celery beat schedule file
celerybeat-schedule

Expand Down Expand Up @@ -116,8 +104,37 @@ venv.bak/

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
.idea
*.iml
*.komodoproject

# Complexity
output/*.html
output/*/index.html

.DS_Store
*~
.*.sw[po]
.build
.ve
.env
.cache
.pytest
.bootstrap
.appveyor.token
*.bak
.testmondata

# VS Code
.vscode

# Sphinx
docs/.doctrees

# TODOs
TODO
2 changes: 1 addition & 1 deletion CHANGELOG.rst → {{cookiecutter.repo_name}}/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Changelog
v0.0.1 ()
---------

* First tag.
* First Commit
1 change: 1 addition & 0 deletions {{cookiecutter.repo_name}}/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Overview
========

{{ cookiecutter.project_name }} - {{ cookiecutter.version }}

{{ cookiecutter.project_short_description|wordwrap(119) }}

Installation
Expand Down
4 changes: 3 additions & 1 deletion {{cookiecutter.repo_name}}/requirements/test.txt
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
4 changes: 3 additions & 1 deletion {{cookiecutter.repo_name}}/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
from setuptools import find_packages
from setuptools import setup


def read(*names, **kwargs):
with io.open(
join(dirname(__file__), *names),
encoding=kwargs.get('encoding', 'utf8')
) as fh:
return fh.read()


setup(
name='{{ cookiecutter.distribution_name }}',
version='{{ cookiecutter.version }}',
Expand Down Expand Up @@ -76,4 +78,4 @@ def read(*names, **kwargs):
]
},
{%- endif %}
)
)
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()
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)

0 comments on commit 37f81b3

Please sign in to comment.