From 534c1b3ea8d59b7788778fc32f59bc3c34f86e19 Mon Sep 17 00:00:00 2001 From: Barak Michener Date: Thu, 6 Sep 2018 00:28:19 -0700 Subject: [PATCH] initial python3 template --- python3/cookiecutter.json | 6 +++++ python3/{{cookiecutter.project_name}}/.gitignore | 15 ++++++++++++ .../.pytest_cache/README.md | 8 +++++++ .../.pytest_cache/v/cache/nodeids | 3 +++ python3/{{cookiecutter.project_name}}/Makefile | 22 +++++++++++++++++ .../{{cookiecutter.project_name}}/requirements.txt | 3 +++ python3/{{cookiecutter.project_name}}/setup.cfg | 28 ++++++++++++++++++++++ python3/{{cookiecutter.project_name}}/setup.py | 22 +++++++++++++++++ .../tests/__init__.py | 0 .../tests/test_true.py | 6 +++++ .../{{cookiecutter.project_name}}/__init__.py | 0 11 files changed, 113 insertions(+) create mode 100644 python3/cookiecutter.json create mode 100644 python3/{{cookiecutter.project_name}}/.gitignore create mode 100644 python3/{{cookiecutter.project_name}}/.pytest_cache/README.md create mode 100644 python3/{{cookiecutter.project_name}}/.pytest_cache/v/cache/nodeids create mode 100644 python3/{{cookiecutter.project_name}}/Makefile create mode 100644 python3/{{cookiecutter.project_name}}/requirements.txt create mode 100644 python3/{{cookiecutter.project_name}}/setup.cfg create mode 100644 python3/{{cookiecutter.project_name}}/setup.py create mode 100644 python3/{{cookiecutter.project_name}}/tests/__init__.py create mode 100644 python3/{{cookiecutter.project_name}}/tests/test_true.py create mode 100644 python3/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/__init__.py diff --git a/python3/cookiecutter.json b/python3/cookiecutter.json new file mode 100644 index 0000000..60be7a7 --- /dev/null +++ b/python3/cookiecutter.json @@ -0,0 +1,6 @@ +{ + "project_name": "python_project", + "project_description": "A Python Project", + "real_name": "", + "email": "" +} diff --git a/python3/{{cookiecutter.project_name}}/.gitignore b/python3/{{cookiecutter.project_name}}/.gitignore new file mode 100644 index 0000000..0592001 --- /dev/null +++ b/python3/{{cookiecutter.project_name}}/.gitignore @@ -0,0 +1,15 @@ +*~ +*.pyc +*.pyo +*.pyt +*.pytc +*.egg-info +.*.swp +.DS_Store +venv/ +venv3/ +.cache/ +build/ +.idea/ +.coverage +.mypy_cache diff --git a/python3/{{cookiecutter.project_name}}/.pytest_cache/README.md b/python3/{{cookiecutter.project_name}}/.pytest_cache/README.md new file mode 100644 index 0000000..bb78ba0 --- /dev/null +++ b/python3/{{cookiecutter.project_name}}/.pytest_cache/README.md @@ -0,0 +1,8 @@ +# pytest cache directory # + +This directory contains data from the pytest's cache plugin, +which provides the `--lf` and `--ff` options, as well as the `cache` fixture. + +**Do not** commit this to version control. + +See [the docs](https://docs.pytest.org/en/latest/cache.html) for more information. diff --git a/python3/{{cookiecutter.project_name}}/.pytest_cache/v/cache/nodeids b/python3/{{cookiecutter.project_name}}/.pytest_cache/v/cache/nodeids new file mode 100644 index 0000000..0d1e839 --- /dev/null +++ b/python3/{{cookiecutter.project_name}}/.pytest_cache/v/cache/nodeids @@ -0,0 +1,3 @@ +[ + "tests/test_true.py::test_true" +] \ No newline at end of file diff --git a/python3/{{cookiecutter.project_name}}/Makefile b/python3/{{cookiecutter.project_name}}/Makefile new file mode 100644 index 0000000..defa0a3 --- /dev/null +++ b/python3/{{cookiecutter.project_name}}/Makefile @@ -0,0 +1,22 @@ +all: default + +default: clean deps test lint + +venv: + if [ ! -e "venv/bin/activate_this.py" ] ; then virtualenv --python=python3 venv ; fi + +clean: + find . -name \*.pyc -delete + find . -name __pycache__ -delete + rm -rf dist/ + +test_unit: venv + . venv/bin/activate && python3 -bb -m pytest tests + +lint: venv + . venv/bin/activate && flake8 . + +deps: venv + . venv/bin/activate && pip install -U -r requirements.txt + +test: test_unit lint diff --git a/python3/{{cookiecutter.project_name}}/requirements.txt b/python3/{{cookiecutter.project_name}}/requirements.txt new file mode 100644 index 0000000..4e68287 --- /dev/null +++ b/python3/{{cookiecutter.project_name}}/requirements.txt @@ -0,0 +1,3 @@ +pytest +flake8 +pip diff --git a/python3/{{cookiecutter.project_name}}/setup.cfg b/python3/{{cookiecutter.project_name}}/setup.cfg new file mode 100644 index 0000000..3a1f36d --- /dev/null +++ b/python3/{{cookiecutter.project_name}}/setup.cfg @@ -0,0 +1,28 @@ +[flake8] +format = pylint +exclude = .svc,CVS,.bzr,.hg,.git,__pycache__,venv +max-complexity = 10 +max-line-length = 120 +ignore = NONE + +[pep8] +max-line-length = 120 + +[tool:pytest] +addopts = --cov={{cookiecutter.project_name}} --cov-fail-under=80 --cov-report=term-missing:skip-covered --cov-report=xml --cov-report=html -vvv + +[coverage:run] +branch = True +#omit = + +[coverage:xml] +output = build/coverage.xml + +[coverage:html] +directory = build/coverage_html + +[mypy] +disallow_untyped_defs = True +ignore_missing_imports = True +strict_optional = True +warn_no_return = True diff --git a/python3/{{cookiecutter.project_name}}/setup.py b/python3/{{cookiecutter.project_name}}/setup.py new file mode 100644 index 0000000..aba2c85 --- /dev/null +++ b/python3/{{cookiecutter.project_name}}/setup.py @@ -0,0 +1,22 @@ +from setuptools import setup, find_packages + +__version__ = '0.1.1' + + +setup( + name='{{cookiecutter.project_name}}', + version=__version__, + description='{{cookiecutter.project_description}}', + #url='', + maintainer='{{cookiecutter.real_name}}', + maintainer_email='{{cookiecutter.email}}', + packages=find_packages(exclude=['tests*']), + dependency_links=[], + install_requires=[ + # e.g. + # Python FooBar package for foobaring + # pyfoobar>=1.0, <2.0 + ], + extras_require={ + }, +) diff --git a/python3/{{cookiecutter.project_name}}/tests/__init__.py b/python3/{{cookiecutter.project_name}}/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/python3/{{cookiecutter.project_name}}/tests/test_true.py b/python3/{{cookiecutter.project_name}}/tests/test_true.py new file mode 100644 index 0000000..6a23242 --- /dev/null +++ b/python3/{{cookiecutter.project_name}}/tests/test_true.py @@ -0,0 +1,6 @@ +# import pytest +# from mock import MagicMock + + +def test_true(): + assert True == True diff --git a/python3/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/__init__.py b/python3/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/__init__.py new file mode 100644 index 0000000..e69de29