Skip to content

Commit d59731f

Browse files
authored
[NEW] Python Generator v2.5.3
Release v2.5.3
2 parents 5db54df + 809564a commit d59731f

28 files changed

+660
-583
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ jobs:
3232
installation_mode: 'edit'
3333
python_version: '3.10'
3434
platform: 'ubuntu-latest'
35+
# pytest_args: '-k test_gold -ra --run-requires_uv --run-network_bound -vvs --cov --cov-report=term-missing --cov-report=html:test-edit/htmlcov --cov-context=test --cov-report=xml:coverage.test-edit.xml -n auto tests'
36+
37+
codecov:
38+
needs: code
39+
# allow both code success and fail (but not skip)
40+
if: always() && contains(fromJSON('["success", "failure"]'), needs.code.result) && vars.OV_CODECOV != 'false'
41+
uses: ./.github/workflows/codecov-job.yml
42+
secrets:
43+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
3544

3645
# Build PACKAGE SDist and run Test Suite against it
3746
sdist: ## Unless override, default trigger 'always'
@@ -47,7 +56,7 @@ jobs:
4756
wheel: ## Unless override, default trigger 'always'
4857
uses: ./.github/workflows/test-python.yml
4958
with:
50-
default_trigger: true
59+
default_trigger: false
5160
override: '${{ vars.OV_WHEEL }}'
5261
installation_mode: 'wheel'
5362
upload_distro: true
@@ -57,7 +66,8 @@ jobs:
5766
# BUILD ALL WHEELS and run Test Suite against them
5867
## Unless override, default trigger 'always'
5968
all_wheels:
60-
if: vars.OV_ALL_WHEELS != 'false' # Unless override, default trigger 'always'
69+
if: false
70+
# if: vars.OV_ALL_WHEELS != 'false' # Unless override, default trigger 'always'
6171
runs-on: ubuntu-latest
6272
env:
6373
module_name: cookiecutter_python
@@ -127,7 +137,7 @@ jobs:
127137
# RUN INTEGRATION TESTS: slower due to automated installations involved via pip
128138
## Unless override, default trigger is (only) on PR to dev
129139
test_integration:
130-
if: always() || vars.OV_TEST_INTEGRATION == 'true' || (vars.OV_SCA != 'false' && github.event_name == 'pull_request' && github.base_ref == 'dev')
140+
if: vars.OV_TEST_INTEGRATION == 'true' || (vars.OV_SCA != 'false' && github.event_name == 'pull_request' && github.base_ref == 'dev')
131141
runs-on: ubuntu-latest
132142
steps:
133143
- uses: actions/checkout@v4
@@ -175,7 +185,7 @@ jobs:
175185
# CROSS PLATFORM TESTING: 15s on Ubuntu, 25 on mac, 35 on windows
176186
## Unless override, default trigger is (only) on PR to dev
177187
sample_matrix_test:
178-
if: always() || vars.OV_MATRIX_TEST == 'true' || (vars.OV_MATRIX_TEST != 'false' && github.event_name == 'pull_request' && github.base_ref == 'dev')
188+
if: vars.OV_MATRIX_TEST == 'true' || (vars.OV_MATRIX_TEST != 'false' && github.event_name == 'pull_request' && github.base_ref == 'dev')
179189
runs-on: ${{ matrix.platform }}
180190
# trigger if event is pr to dev
181191
strategy:
@@ -238,6 +248,7 @@ jobs:
238248
fi
239249
pytest -ra --run-requires_uv --run-network_bound -vvs
240250
251+
241252
## PYDEPS
242253

243254
## TYPE CHECK

.github/workflows/codecov-job.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
## Codecov Upload - Reusable Workflow ##
2+
3+
on:
4+
workflow_call:
5+
secrets:
6+
CODECOV_TOKEN:
7+
required: true
8+
jobs:
9+
upload:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Get Codecov binary
14+
run: |
15+
curl -Os https://uploader.codecov.io/latest/linux/codecov
16+
chmod +x codecov
17+
18+
# DOWNLOAD XML FILES FROM ARTIFACTS
19+
- name: Download All Artifacts
20+
uses: actions/download-artifact@v4
21+
with:
22+
path: coverage
23+
pattern: coverage-*
24+
merge-multiple: true
25+
26+
- run: ls -R coverage
27+
28+
# UPLOAD XML FILES TO CODECOV
29+
- name: Upload Coverage Reports to Codecov
30+
env:
31+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} # this is "read" from inputs
32+
run: |
33+
for file in coverage/coverage*.xml; do
34+
OS_NAME=$(echo $file | sed -E "s/coverage-(\w\+)-/\1/")
35+
PY_VERSION=$(echo $file | sed -E "s/coverage-\w\+-(\d\.)\+/\1/")
36+
./codecov -f $file -e "OS=$OS_NAME,PYTHON=$PY_VERSION" --flags unittests --verbose
37+
echo "[INFO] Sent to Codecov: $file !"
38+
done

.github/workflows/dev_pr_validation.yml

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,15 @@ jobs:
187187
outputs:
188188
PEP_VERSION: ${{ steps.build.outputs.PEP_VERSION }}
189189

190+
# CODECOV Upload of COVERAGE reports
191+
codecov:
192+
if: always() && contains(fromJSON('["success", "failure"]'), needs.cross_platform_tests.result)
193+
needs: cross_platform_tests
194+
uses: ./.github/workflows/codecov-job.yml
195+
secrets:
196+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
197+
198+
190199
# STATIC CODE ANALYSIS: mypy, ruff, isort, black, bandit, mccabe, prospector, etc
191200
sca:
192201
uses: ./.github/workflows/sca-job.yml
@@ -221,35 +230,6 @@ jobs:
221230
python_version: '3.11'
222231

223232

224-
# CODECOV Upload of COVERAGE reports
225-
codecov_coverage_host:
226-
if: always() && github.event_name == 'pull_request' && github.base_ref == 'release'
227-
runs-on: ubuntu-latest
228-
needs: cross_platform_tests
229-
steps:
230-
- uses: actions/checkout@v4
231-
- name: Get Codecov binary
232-
run: |
233-
curl -Os https://uploader.codecov.io/latest/linux/codecov
234-
chmod +x codecov
235-
236-
- name: Download All Artifacts
237-
uses: actions/download-artifact@v4
238-
with:
239-
path: coverage
240-
pattern: coverage-*
241-
merge-multiple: true
242-
243-
- run: ls -R coverage
244-
245-
- name: Upload Coverage Reports to Codecov
246-
run: |
247-
for file in coverage/coverage*.xml; do
248-
OS_NAME=$(echo $file | sed -E "s/coverage-(\w\+)-/\1/")
249-
PY_VERSION=$(echo $file | sed -E "s/coverage-\w\+-(\d\.)\+/\1/")
250-
./codecov -f $file -e "OS=$OS_NAME,PYTHON=$PY_VERSION" --flags unittests --verbose
251-
echo "Sent to Codecov: $file !"
252-
done
253233

254234
## DOCKER BUILD and PUBLISH ON DOCKERHUB ##
255235
# Ref Page: https://automated-workflows.readthedocs.io/en/main/ref_docker/

.github/workflows/test-python.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ on:
3939
default: 'ubuntu-latest'
4040
description: "Platform to use for the job. Default is 'ubuntu-latest'"
4141
type: string
42+
43+
# Pytest Settings #
44+
pytest_args:
45+
required: false
46+
description: "Arguments to pass to pytest. Pass value to override the default value"
47+
type: string
48+
49+
4250
jobs:
4351
test:
4452
if: inputs.override == 'true' || (inputs.override != 'false' && inputs.default_trigger == true)
@@ -94,6 +102,9 @@ jobs:
94102
95103
uv pip install --no-deps ${{ inputs.installation_mode == 'edit' && '-e .' || inputs.installation_mode == 'sdist' && 'dist/*.tar.gz' || inputs.installation_mode == 'wheel' && 'dist/*.whl' }}
96104
105+
- name: Compute Pytest default Arguments
106+
id: pytest_args
107+
run: echo DEFAULT_PYTEST_ARGS='-ra --run-requires_uv --run-network_bound -vvs --cov --cov-report=term-missing --cov-report=html:test-${{ inputs.installation_mode }}/htmlcov --cov-context=test --cov-report=xml:coverage.test-${{ inputs.installation_mode }}.xml -n auto tests' >> $GITHUB_OUTPUT
97108

98109
#### Run Test Suite against the package and measure Coverage ####
99110
- name: Run Tests and measure Coverage
@@ -104,6 +115,7 @@ jobs:
104115
BUG_LOG_DEL_WIN: 'permission_error' # required on Windows Job
105116
PY_WHEEL: 1 # required on Windows Job
106117
COVERAGE_FILE: '.coverage.${{ inputs.installation_mode }}'
118+
PYTEST_ARGS: "${{ inputs.pytest_args || steps.pytest_args.outputs.DEFAULT_PYTEST_ARGS }}"
107119
run: |
108120
if [[ "${{ matrix.platform }}" == "windows-latest" ]]; then
109121
echo "[INFO] Activating virtual environment for Windows"
@@ -114,10 +126,7 @@ jobs:
114126
. .venv/bin/activate
115127
fi
116128
117-
pytest -ra --run-requires_uv --run-network_bound -vvs --cov --cov-report=term-missing \
118-
--cov-report=html:test-${{ inputs.installation_mode }}/htmlcov --cov-context=test \
119-
--cov-report=xml:coverage.test-${{ inputs.installation_mode }}.xml \
120-
-n auto tests
129+
pytest ${{ env.PYTEST_ARGS }}
121130
122131
## Code Coverage ## TODO; enable combine by moving each .coverage file to other dir to avoid override of subsequent coverage invocations with pytest
123132
- name: "Discover and Combine Coverage data into XML Reports"

.github/workflows/test.yaml

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -167,32 +167,11 @@ jobs:
167167
# artifact_name: 'dist'
168168

169169
codecov_coverage_host:
170-
runs-on: ubuntu-latest
171170
needs: test
172-
steps:
173-
- uses: actions/checkout@v4
174-
- name: Get Codecov binary
175-
run: |
176-
curl -Os https://uploader.codecov.io/latest/linux/codecov
177-
chmod +x codecov
178-
179-
- name: Download All Artifacts
180-
uses: actions/download-artifact@v4
181-
with:
182-
path: coverage
183-
pattern: coverage-*
184-
merge-multiple: true
185-
186-
- run: ls -R coverage
187-
188-
- name: Upload Coverage Reports to Codecov
189-
run: |
190-
for file in coverage/coverage*.xml; do
191-
OS_NAME=$(echo $file | sed -E "s/coverage-(\w\+)-/\1/")
192-
PY_VERSION=$(echo $file | sed -E "s/coverage-\w\+-(\d\.)\+/\1/")
193-
./codecov -f $file -e "OS=$OS_NAME,PYTHON=$PY_VERSION" --flags unittests --verbose
194-
echo "Sent to Codecov: $file !"
195-
done
171+
if: always() && contains(fromJSON('["success", "failure"]'), needs.test.result)
172+
uses: ./.github/workflows/codecov-job.yml
173+
secrets:
174+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
196175

197176
## STATIC CODE ANALYSIS: mypy, ruff, isort, black, bandit, mccabe, prospector, etc
198177
sca:

CHANGELOG.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@ Changelog
33
=========
44

55

6+
2.5.3 (2024-04-18)
7+
==================
8+
9+
Initial goal was to simplify the tests.
10+
In the process:
11+
12+
- we did that
13+
- increased code coverage
14+
- fixed a bug with the -f flag when used with the same gen params and on the same output location folder
15+
- improved user experience on the cli.terminal with better messages
16+
17+
618
2.5.2 (2024-04-14)
719
==================
820

README.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,9 @@ Free/Libre and Open Source Software (FLOSS)
275275

276276
.. Github Releases & Tags
277277
278-
.. |commits_since_specific_tag_on_master| image:: https://img.shields.io/github/commits-since/boromir674/cookiecutter-python-package/v2.5.2/master?color=blue&logo=github
278+
.. |commits_since_specific_tag_on_master| image:: https://img.shields.io/github/commits-since/boromir674/cookiecutter-python-package/v2.5.3/master?color=blue&logo=github
279279
:alt: GitHub commits since tagged version (branch)
280-
:target: https://github.com/boromir674/cookiecutter-python-package/compare/v2.5.2..master
280+
:target: https://github.com/boromir674/cookiecutter-python-package/compare/v2.5.3..master
281281

282282
.. |commits_since_latest_github_release| image:: https://img.shields.io/github/commits-since/boromir674/cookiecutter-python-package/latest?color=blue&logo=semver&sort=semver
283283
:alt: GitHub commits since latest release (by SemVer)
@@ -312,9 +312,10 @@ Free/Libre and Open Source Software (FLOSS)
312312
.. Code Climate CI
313313
.. Code maintainability & Technical Debt
314314
315+
315316
.. |maintainability| image:: https://api.codeclimate.com/v1/badges/1d347d7dfaa134fd944e/maintainability
316317
:alt: Maintainability
317-
:target: https://codeclimate.com/github/boromir674/cookiecutter-python-package/
318+
:target: https://codeclimate.com/github/boromir674/cookiecutter-python-package/maintainability
318319

319320
.. |tech-debt| image:: https://img.shields.io/codeclimate/tech-debt/boromir674/cookiecutter-python-package
320321
:alt: Code Climate technical debt

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
author = 'Konstantinos Lampridis'
3131

3232
# The full version, including alpha/beta/rc tags
33-
release = '2.5.2'
33+
release = '2.5.3'
3434

3535
# -- General configuration ---------------------------------------------------
3636

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ build-backend = "poetry.core.masonry.api"
1414
name = "cookiecutter_python"
1515
### ... ###
1616

17-
version = "2.5.2"
17+
version = "2.5.3"
1818
description = "1-click Generator of Python Project, from Template with streamlined \"DevOps\" using a powerful CI/CD Pipeline."
1919
readme = "README.rst"
2020
license = "AGPL-3.0-only"
@@ -74,7 +74,7 @@ maintainers = [
7474
license = {text = "AGPL-3.0-only"}
7575

7676
name = "cookiecutter_python"
77-
version = "2.5.2"
77+
version = "2.5.3"
7878
description = "1-click Generator of Python Project, from Template with streamlined \"DevOps\" using a powerful CI/CD Pipeline."
7979
readme = "README.rst"
8080
# keywords = []
@@ -132,7 +132,7 @@ docslive = [
132132
typing = [
133133
"types-requests~=2.27.26",
134134
"types-pyyaml<7.0.0.0,>=6.0.12.5",
135-
"mypy>=1.0.0",
135+
"mypy==1.2.0",
136136
"pytest>=7.4.4",
137137
]
138138

scripts/mypy.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env sh
2+
3+
## Run Mypy against Code
4+
5+
# Env Required: .lint-env
6+
7+
set -e
8+
9+
# if env notr found exit with error
10+
if [ ! -d .lint-env ]; then
11+
echo "No .lint-env found, please run 'uv venv .lint-env' first"
12+
exit 1
13+
fi
14+
15+
16+
# uv export --no-emit-project --no-dev --extra typing --frozen --format requirements-txt -o prod+type.txt
17+
18+
# . .lint-env/bin/activate
19+
20+
# uv pip install -r prod+type.txt
21+
22+
# set mypy environment
23+
export MYPYPATH=${MYPYPATH:-src/stubs}
24+
25+
# DRYness
26+
PKG=${PGK:-src/cookiecutter_python}
27+
28+
mypy --show-error-codes --check-untyped-defs \
29+
--exclude tests/data \
30+
"${PKG}/hooks" \
31+
"${PKG}/backend" "${PKG}/handle" \
32+
"${PKG}/utils.py" "${PKG}/exceptions.py" \
33+
"${PKG}/cli.py" "${PKG}/cli_handlers.py" \
34+
"${PKG}/__main__.py" "${PKG}/__init__.py" \
35+
tests

0 commit comments

Comments
 (0)