Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
4fd652a
Add CI workflow
MrKoh7 Aug 25, 2025
a331a41
Fix CI: add cookiecutter and test dependencies
MrKoh7 Aug 25, 2025
2017c93
CI: install 'just' and test deps; run pytest
MrKoh7 Aug 25, 2025
428585c
CI: matrix tests, caching, just install, reports+artifacts, lint/mypy…
MrKoh7 Aug 25, 2025
0586811
Add GitLab CI: lint, test matrix with coverage/JUnit, and build artif…
MrKoh7 Aug 25, 2025
a0c0ad2
Fix GitLab CI: corrected variables placement and structure
MrKoh7 Aug 25, 2025
dd24a98
Update GitLab CI: add just installation, coverage reports, and TestPy…
MrKoh7 Aug 25, 2025
23f0fbc
Rewrite GitLab CI: lint, test with just fix, simulate build & deploy
MrKoh7 Aug 25, 2025
d5ea212
Updated .yml
MrKoh7 Aug 25, 2025
a58a12c
Corrected yml
MrKoh7 Aug 25, 2025
58e8258
Fixed .yml
MrKoh7 Aug 25, 2025
d33c8ab
Corrected yml
MrKoh7 Aug 25, 2025
8c46a39
Correct configuration
MrKoh7 Aug 25, 2025
125dcdc
Correct configuration
MrKoh7 Aug 25, 2025
150efac
Correct configuration
MrKoh7 Aug 25, 2025
a42dc4e
Correct configuration
MrKoh7 Aug 25, 2025
4019dc5
Correct configuration
MrKoh7 Aug 25, 2025
1742f4f
Correct configuration
MrKoh7 Aug 25, 2025
87c479e
Correct configuration
MrKoh7 Aug 25, 2025
e25106e
Correct configuration
MrKoh7 Aug 25, 2025
bcc3cc7
Correct configuration
MrKoh7 Aug 25, 2025
32d8ad0
Correct configuration
MrKoh7 Aug 25, 2025
93f4787
Correct configuration
MrKoh7 Aug 25, 2025
379b140
Correct configuration
MrKoh7 Aug 25, 2025
23136bd
Correct configuration
MrKoh7 Aug 25, 2025
5189ef0
CI config (build, test, package, deploy)
MrKoh7 Sep 2, 2025
4eea948
CI config (build, test, package, deploy)
MrKoh7 Sep 2, 2025
c98a6ce
CI config (build, test, package, deploy)
MrKoh7 Sep 2, 2025
2d0e610
CI CONFIG
MrKoh7 Sep 2, 2025
5b96237
Fix pyproject.toml: clean dependencies and exclude hooks/reports from…
MrKoh7 Sep 2, 2025
2698dd3
CI config (build, test, package, deploy)
MrKoh7 Sep 2, 2025
0c002e2
CI config (build, test, package, deploy)
MrKoh7 Sep 2, 2025
dae8e20
CI config (build, test, package, deploy)
MrKoh7 Sep 2, 2025
c308d11
Fix test job: generate JUnit and coverage reports
MrKoh7 Sep 2, 2025
366cc25
Fix test job
MrKoh7 Sep 2, 2025
4e91997
Fix test job: generate JUnit and coverage reports
MrKoh7 Sep 2, 2025
29a94ec
Minor: rename test functions names for clarity
MrKoh7 Sep 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
stages: [build, test, package, deploy]

build:
stage: build
image: python:3.11
script:
- echo "Build stage running"
- if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
artifacts:
paths:
- .venv/

test:
stage: test
image: python:3.11
script:
- pip install pytest pytest-cov cookiecutter pytest-cookies
- mkdir -p reports/html
- pytest tests \
--disable-warnings -q \
--junitxml=reports/junit.xml \
--cov=. \
--cov-report=xml:reports/coverage.xml \
--cov-report=html:reports/html \
--cov-report=term-missing || true
artifacts:
when: always
expire_in: 1 week
reports:
junit: "reports/junit.xml"
coverage_report:
coverage_format: cobertura
path: "reports/coverage.xml"
paths:
- reports/

package:
stage: package
image: python:3.11
script:
- pip install build twine
- python -m build
- twine check dist/*
artifacts:
paths:
- dist/

deploy:
stage: deploy
image: python:3.11
needs: ["package"]
script:
- pip install twine
- twine check dist/*
- echo "Deploy stage finished successfully"
artifacts:
paths:
- dist/
35 changes: 19 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "cookiecutter-pypackage"
version = "0.2.0"
Expand Down Expand Up @@ -33,28 +37,27 @@ dependencies = [

[project.optional-dependencies]
test = [
"coverage", # testing
"pytest", # testing
"pytest-cookies", # testing
"ruff", # linting
"ty", # checking types
"coverage",
"pytest",
"pytest-cookies",
"ruff",
"mypy", # fixed
"ipdb"
]
dev = [
"rust-just>=1.42.4",
]

[project.urls]
homepage = "https://github.com/audreyfeldroy/cookiecutter-pypackage"

[tool.setuptools.packages.find]
where = ["."]
include = ["cookiecutter_pypackage*"]
exclude = ["tests*", "hooks*", "reports*", "docs*"]

[tool.ruff]
exclude = [
"*cookiecutter.pypi_package_name*"
]
exclude = ["{{cookiecutter_pypi_package_name}}"]
Copy link

Copilot AI Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exclude pattern should use double braces for cookiecutter template variables. The correct syntax should be {{cookiecutter.pypi_package_name}} with a dot separator, not an underscore.

Suggested change
exclude = ["{{cookiecutter_pypi_package_name}}"]
exclude = ["{{cookiecutter.pypi_package_name}}"]

Copilot uses AI. Check for mistakes.

[tool.pytest.ini_options]
testpaths = [
"tests",
]

[dependency-groups]
dev = [
"rust-just>=1.42.4",
]
testpaths = ["tests"]
12 changes: 6 additions & 6 deletions tests/test_bake_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def check_output_inside_dir(command, dirpath):
return subprocess.check_output(shlex.split(command))


def test_year_compute_in_license_file(cookies):
def test_year_compute_in_license_file_case(cookies):
with bake_in_temp_dir(cookies) as result:
license_file_path = result.project.join("LICENSE")
now = datetime.datetime.now()
Expand All @@ -71,7 +71,7 @@ def project_info(result):
return project_path, project_slug, project_dir


def test_bake_with_defaults(cookies):
def test_bake_with_defaults_case(cookies):
with bake_in_temp_dir(cookies) as result:
assert result.project.isdir()
assert result.exit_code == 0
Expand All @@ -81,15 +81,15 @@ def test_bake_with_defaults(cookies):
assert "tests" in found_toplevel_files


def test_bake_and_run_tests(cookies):
def test_bake_and_run_tests_case(cookies):
with bake_in_temp_dir(cookies) as result:
assert result.project.isdir()
run_inside_dir("pytest", str(result.project)) == 0
print("test_bake_and_run_tests path", str(result.project))


@pytest.mark.skip(reason="A rare edge case, probably Cookiecutter's fault")
def test_bake_withspecialchars_and_run_tests(cookies):
def test_bake_withspecialchars_and_run_tests_case(cookies):
"""Ensure that a `full_name` with double quotes does not break pytest"""
with bake_in_temp_dir(
cookies, extra_context={"full_name": 'name "quote" name'}
Expand All @@ -98,14 +98,14 @@ def test_bake_withspecialchars_and_run_tests(cookies):
run_inside_dir("pytest", str(result.project)) == 0


def test_bake_with_apostrophe_and_run_tests(cookies):
def test_bake_with_apostrophe_and_run_tests_case(cookies):
"""Ensure that a `full_name` with apostrophes does not break setup.py"""
with bake_in_temp_dir(cookies, extra_context={"full_name": "O'connor"}) as result:
assert result.project.isdir()
run_inside_dir("pytest", str(result.project)) == 0


def test_just_list(cookies):
def test_just_list_cmd(cookies):
with bake_in_temp_dir(cookies) as result:
# The supplied justfile does not support win32
if sys.platform != "win32":
Expand Down
2 changes: 2 additions & 0 deletions tests/test_smoke.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def test_smoke():
assert True