Commit
Another general updated based on lessons learned
Daniel Moch committed 5 years ago
(
Tree)
Diffstat
cookiecutter.json | 3
hooks/post_gen_project.py | 3
{{cookiecutter.project_slug}}/.coveragerc | 3
{{cookiecutter.project_slug}}/Makefile | 31
{{cookiecutter.project_slug}}/__main__.py => {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/__main__.py | 0
{{cookiecutter.project_slug}}/appveyor.yml | 16
{{cookiecutter.project_slug}}/tests/pylintrc => {{cookiecutter.project_slug}}/.pylintrc | 0
cookiecutter.json
9 |
9 |
"pypi_username": "{{ cookiecutter.github_username }}", |
10 |
10 |
"version": "0.1.0", |
11 |
11 |
"script_entrypoint": "y", |
12 |
|
- "open_source_license": ["MIT license", "BSD license", "ISC license", "Apache Software License 2.0", "GNU General Public License v3", "Not open source"] |
|
12 |
+ "open_source_license": ["MIT license", "BSD license", "ISC license", "Apache Software License 2.0", "GNU General Public License v3", "Not open source"], |
|
13 |
+ "windows_support": "y" |
13 |
14 |
} |
hooks/post_gen_project.py
14 |
14 |
if 'Not open source' == '{{ cookiecutter.open_source_license }}': |
15 |
15 |
remove_file('LICENSE') |
16 |
16 |
|
|
17 |
+ if 'n' == '{{ cookiecutter.windows_support }}': |
|
18 |
+ remove_file('appveyor.yml') |
|
19 |
+ |
17 |
20 |
try: |
18 |
21 |
subprocess.run( |
19 |
22 |
['which', |
{{cookiecutter.project_slug}}/.coveragerc (created)
|
1 |
+[run] |
|
2 |
+branch = True |
|
3 |
+omit = {{ cookiecutter.project_slug }}/__main__.py |
{{cookiecutter.project_slug}}/Makefile
25 |
25 |
export PRINT_HELP_PYSCRIPT |
26 |
26 |
|
27 |
27 |
BROWSER := python -c "$$BROWSER_PYSCRIPT" |
|
28 |
+PIPENV := pipenv |
|
29 |
+PIPRUN := $(PIPENV) run |
|
30 |
+PIPINST := $(PIPENV) --bare install --dev --skip-lock |
28 |
31 |
|
29 |
32 |
help: |
30 |
33 |
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST) |
|
|
. . . |
43 |
46 |
find . -name '*.pyo' -exec rm -f {} + |
44 |
47 |
find . -name '*~' -exec rm -f {} + |
45 |
48 |
find . -name '__pycache__' -exec rm -fr {} + |
|
49 |
+ $(PIPRUN) pip uninstall -y {{ cookiecutter.project_slug }} |
46 |
50 |
|
47 |
51 |
clean-test: ## remove test and coverage artifacts |
48 |
52 |
rm -f .coverage |
|
|
. . . |
51 |
55 |
rm -fr .tox |
52 |
56 |
|
53 |
57 |
lint: ## check style with pylint |
54 |
|
- pipenv run pylint --rcfile tests/pylintrc {{ cookiecutter.project_slug }} tests --disable=parse-error |
|
58 |
+ $(PIPRUN) pylint {{ cookiecutter.project_slug }} tests --disable=parse-error |
55 |
59 |
|
56 |
60 |
test: ## run tests quickly with the default Python |
57 |
|
- pipenv run python -m pytest |
|
61 |
+ $(PIPRUN) python -m pytest |
|
62 |
+ |
|
63 |
+test-all: ## run tests on every Python version with tox |
|
64 |
+ $(PIPRUN) tox |
58 |
65 |
|
59 |
66 |
test-install: ## install dependenices from Pipfile (for tox / CI builds) |
60 |
|
- pipenv --bare install --dev --skip-lock |
|
67 |
+ $(PIPINST) |
61 |
68 |
|
62 |
69 |
coverage: ## check code coverage quickly with the default Python |
63 |
|
- pipenv run python -m pytest --cov={{ cookiecutter.project_slug }} --cov-config tests/coveragerc |
64 |
|
- pipenv run coverage report -m |
|
70 |
+ $(PIPRUN) python -m pytest --cov={{ cookiecutter.project_slug }} |
|
71 |
+ $(PIPRUN) coverage report -m |
65 |
72 |
|
66 |
73 |
coverage-html: coverage ## generate an HTML report and open in browser |
67 |
|
- pipenv run coverage html |
|
74 |
+ $(PIPRUN) coverage html |
68 |
75 |
$(BROWSER) htmlcov/index.html |
69 |
76 |
|
70 |
77 |
release: dist ## package and upload a release |
71 |
|
- pipenv run flit publish |
|
78 |
+ $(PIPRUN) flit publish |
72 |
79 |
|
73 |
80 |
dist: ## builds source and wheel package |
74 |
|
- pipenv run flit build |
|
81 |
+ $(PIPRUN) flit build |
75 |
82 |
ls -l dist |
76 |
83 |
|
77 |
84 |
install: ## install the package to the active Python's site-packages |
78 |
|
- pipenv run flit install |
|
85 |
+ $(PIPRUN) flit install --deps=none |
79 |
86 |
|
80 |
|
-run: install ## run the package from site-packages |
81 |
|
- pipenv run {{ cookiecutter.project_slug }} |
|
87 |
+run: ## run the package from site-packages |
|
88 |
+ $(PIPRUN) python -m {{ cookiecutter.project_slug }} $(cmd) |
82 |
89 |
|
83 |
90 |
debug: install ## debug the package from site packages |
84 |
|
- pipenv run pudb3 `pipenv run which {{ cookiecutter.project_slug }}` |
|
91 |
+ $(PIPRUN) pudb3 $$($(PIPRUN) which {{ cookiecutter.project_slug }}) $(cmd) |
{{cookiecutter.project_slug}}/__main__.py --> {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/__main__.py