Skip to content

Commit 6b82677

Browse files
committed
[NEW] Better Scripts, Better Configuration Files
Release Cookiecutter Python Pacakge v1.5.0
2 parents e64728a + 9412890 commit 6b82677

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+776
-731
lines changed

.bettercodehub.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
component_depth: 3
2+
languages:
3+
- python

.github/workflows/test.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
branches:
1212
- master
1313
- dev
14+
- develop
1415
tags:
1516
- v*
1617

@@ -21,10 +22,7 @@ jobs:
2122
strategy:
2223
matrix:
2324
platform: [ubuntu-latest, macos-latest]
24-
# platform: [macos-latest]
25-
# python-version: ["3.6"]
2625
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
27-
2826
steps:
2927
- uses: actions/checkout@v3
3028
- name: Set up Python ${{ matrix.python-version }}
@@ -37,19 +35,24 @@ jobs:
3735
python -m pip install tox tox-gh-actions
3836
3937
- name: Do Lint Checking
40-
run: tox -e lint -vv -s false
38+
run: |
39+
tox -e lint -vv -s false
40+
tox -e prospector -vv -s false
4141
4242
- name: Do Type Checking
4343
run: tox -e type -vv -s false
4444

4545
- name: Specify current package version to assist build tool
46-
run: echo "PKG_VERSION=$(python scripts/parse_version.py)" >> $GITHUB_ENV
46+
run: |
47+
PARSER="src/cookiecutter_python/{{ cookiecutter.project_slug }}/scripts/parse_version.py"
48+
A=$(python "${PARSER}")
49+
echo $A
50+
echo "PKG_VERSION=$A" >> $GITHUB_ENV
4751
4852
- name: Run Test Suite
4953
run: tox -vv -s false
5054
env:
5155
PLATFORM: ${{ matrix.platform }}
52-
5356
- name: Check for compliance with Python Best Practices
5457
run: |
5558
DIST_DIR=dist
@@ -58,7 +61,6 @@ jobs:
5861
mkdir "$DIST_DIR"
5962
mv ".tox/${DIST_DIR}/cookiecutter_python-${PKG_VERSION}.tar.gz" "${DIST_DIR}"
6063
mv ".tox/${DIST_DIR}/cookiecutter_python-${PKG_VERSION}-py3-none-any.whl" "${DIST_DIR}"
61-
6264
tox -e check -vv -s false
6365
6466
- name: Upload Source & Wheel distributions as Artefacts
@@ -99,5 +101,3 @@ jobs:
99101
flags: unittests
100102
name: codecov-umbrella
101103
verbose: true
102-
103-
# TODO find build tar.gz whl files and upload as artefacts

.prospector.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ bandit:
5252
frosted:
5353
run: false
5454

55-
pycodestyle:
55+
pep8:
56+
run: false
57+
58+
pep257:
5659
run: false
5760

5861
mypy:

.pylintrc

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ disable=print-statement,
152152
redundant-keyword-arg,
153153
not-callable,
154154
unsubscriptable-object,
155-
protected-access
155+
protected-access,
156+
invalid-metaclass
156157

157158
# Enable the message, report, category or checker with the given id(s). You can
158159
# either give multiple identifier separated by comma (,) or put this option
@@ -227,9 +228,13 @@ notes=FIXME,
227228
contextmanager-decorators=contextlib.contextmanager
228229

229230
# List of members which are set dynamically and missed by pylint inference
230-
# system, and so shouldn't trigger E1101 (no-member) when accessed. Python regular
231-
# expressions are accepted.
232-
generated-members=_transform|self\.objects|self\._observers|subclasses|InteractiveDialog\.create
231+
# system, and so shouldn't trigger E1101 when accessed. Python regular
232+
# expressions are accepted. Things coming from a metaclass or a dynamic attribute set.
233+
# Can solve E1101: Class 'X' has no 'y' member (no-member)
234+
generated-members=_transform|self\.objects|self\._observers|subclasses|
235+
InteractiveDialog\.create|
236+
exception_msg|
237+
log_message
233238

234239
# Tells whether missing members accessed in mixin class should be ignored. A
235240
# mixin class is detected if its name ends with "mixin" (case insensitive).
@@ -357,6 +362,8 @@ function-naming-style=snake_case
357362
#function-rgx=
358363

359364
# Good variable names which should always be accepted, separated by a comma.
365+
# Can solves C0103: Variable name "x" doesn't conform to snake_case naming
366+
# style (invalid-name)
360367
good-names=i,
361368
j,
362369
k,
@@ -373,7 +380,6 @@ good-names=i,
373380
REGEX,
374381
cookiecutter
375382

376-
377383
# Good variable names regexes, separated by a comma. If names match any regex,
378384
# they will always be accepted
379385
good-names-rgxs=
@@ -521,14 +527,14 @@ callbacks=cb_,
521527
# Here you make pylint ignore variable names that seem to be undefined.
522528
# For example:
523529
# * Variables inside try/except statements that can potentially be undefined
524-
# * Variables that are part of templating (ie jinja, cookicutter)
530+
# * Variables that are part of templating (ie jinja, cookiecutter)
525531
# and we expect them to be replaced at runtime, but statically seem erronouous for pylint
526532
# E0602: Undefined variable '<variable_name>' (undefined-variable)
527533
dummy-variables-rgx=cookiecutter|_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
528534

529535
# Argument names that match this expression will be ignored. Default to name
530536
# with leading underscore.
531-
ignored-argument-names=_.*|^ignored_|^unused_|args|kwargs
537+
ignored-argument-names=_.*|^ignored_|^unused_|args|kwargs|questions|answers
532538

533539
# Tells whether we should check for unused import in __init__ files.
534540
init-import=no

CHANGELOG.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,42 @@
22
Changelog
33
=========
44

5+
1.5.0 (2022-06-11)
6+
==================
7+
8+
This release focused on improving the code architecture, reducing technical
9+
debt, decoupling components, cleaning code, fixing styling issues.
10+
11+
It also features some updates in the Generated Project, with improved tox envs,
12+
cleaner python scripts and cleaner development tools' configuration files
13+
(such as .pylintrc, pyproject.toml, tox.ini).
14+
15+
Changes
16+
^^^^^^^
17+
18+
feature
19+
"""""""
20+
- document config settings, improve tox envs & scripts
21+
22+
test
23+
""""
24+
- verify Generator can be invoked as python module: `python -m cookiecutter_python`
25+
26+
refactor
27+
""""""""
28+
- dry code per string_sanitizer implementation
29+
- reduce code in cli.py by delegating error handling to the new cli_handlers.py module
30+
- reduce code of parse_version.py script
31+
- abstract input sanitization
32+
- reduce main code
33+
- decouple components
34+
- clean code, satisfy some todos, dry code
35+
36+
ci
37+
""
38+
- use the template's parse_version script to reduce duplicate code
39+
40+
541
1.4.1 (2022-06-07)
642
==================
743

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@ For more complex use cases, you can modify the Template and also leverage all of
196196

197197
.. Github Releases & Tags
198198
199-
.. |commits_since_specific_tag_on_master| image:: https://img.shields.io/github/commits-since/boromir674/cookiecutter-python-package/v1.4.1/master?color=blue&logo=github
199+
.. |commits_since_specific_tag_on_master| image:: https://img.shields.io/github/commits-since/boromir674/cookiecutter-python-package/v1.5.0/master?color=blue&logo=github
200200
:alt: GitHub commits since tagged version (branch)
201-
:target: https://github.com/boromir674/cookiecutter-python-package/compare/v1.4.1..master
201+
:target: https://github.com/boromir674/cookiecutter-python-package/compare/v1.5.0..master
202202

203203
.. |commits_since_latest_github_release| image:: https://img.shields.io/github/commits-since/boromir674/cookiecutter-python-package/latest?color=blue&logo=semver&sort=semver
204204
:alt: GitHub commits since latest release (by SemVer)

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ build-backend = "poetry.core.masonry.api"
1010
## Also renders on pypi as 'subtitle'
1111
[tool.poetry]
1212
name = "cookiecutter_python"
13-
version = "1.4.1"
13+
version = "1.5.0"
1414
description = "Yet another modern Python Package (pypi) with emphasis in CI/CD and automation."
1515
authors = ["Konstantinos Lampridis <k.lampridis@hotmail.com>"]
1616
maintainers = ["Konstantinos Lampridis <k.lampridis@hotmail.com>"]
@@ -86,14 +86,14 @@ exclude = [
8686

8787

8888
[tool.poetry.scripts]
89-
generate-python = 'cookiecutter_python.__main__:main'
89+
generate-python = 'cookiecutter_python.cli:main'
9090

9191

9292
[tool.poetry.dependencies]
9393
python = "^3.6"
9494
click = "^8"
9595
cookiecutter = "^1.7.3"
96-
software-patterns = "^1.2.1"
96+
software-patterns = "^1.3.0"
9797
requests-futures = "^1.0.0"
9898
PyInquirer = "^1.0.3"
9999
prompt-toolkit = "==1.0.14"

scripts/parse_version.py

Lines changed: 0 additions & 132 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.4.1'
1+
__version__ = '1.5.0'
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
from .cookiecutter_proxy import cookiecutter
1+
from .main import CheckPypiError, generate
2+
from .sanitization import sanitize
23

3-
__all__ = ['cookiecutter']
4+
__all__ = [
5+
'generate',
6+
'CheckPypiError',
7+
'sanitize',
8+
]

0 commit comments

Comments
 (0)