Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run_tests:
strategy:
matrix:
python_version: ["3.10", "3.11", "3.12", "3.13"]
python_version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
os: [ubuntu-24.04, macos-14]
runs-on: ${{ matrix.os }}
env:
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ repos:
additional_dependencies:
- mdformat-gfm
- repo: https://github.com/adrienverge/yamllint
rev: v1.37.1
rev: v1.38.0
hooks:
- id: yamllint
exclude: pre-commit-config.yaml
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.14.11"
rev: "v0.14.13"
hooks:
- id: ruff-format
- id: ruff-check
Expand Down
11 changes: 8 additions & 3 deletions copier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ project_name:
help: >-
What is the name of your project?
This will be used in the package name
and other places. Please use "_"
underscores instead of spaces where
necessary, e.g. "my_project".
and other places. Dashes will be converted
to underscores for the Python package/module
name (e.g. "my-project" -> "my_project").

project_description:
type: str
Expand All @@ -15,6 +15,11 @@ project_description:
This will be used in the package metadata
and other places.

python_package_name:
type: str
default: "{{ project_name|replace('-', '_') }}"
when: false

author_name:
type: str
default: "Your Name"
Expand Down
4 changes: 2 additions & 2 deletions docs/src/python-api.md.jinja
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Python API

```{eval-rst}
{{ project_name }}.main
{{ python_package_name }}.main
-------------------
.. automodule:: src.{{ project_name }}.main
.. automodule:: src.{{ python_package_name }}.main
:members:
:private-members:
:undoc-members:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ pythonpath = [ "." ]

[tool.vulture]
min_confidence = 90
paths = [ "src/{{ project_name }}", "tests" ]
paths = [ "src/{{ python_package_name }}", "tests" ]
6 changes: 3 additions & 3 deletions pyproject.toml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies = [
"fire>=0.7.0",
"jinja2>=3.1.6",
]
scripts.{{ project_name }} = "{{ project_name }}.cli:trigger"
scripts.{{ project_name }} = "{{ python_package_name }}.cli:trigger"

[dependency-groups]
dev = [
Expand All @@ -46,7 +46,7 @@ notebooks = [
root = "."
version_scheme = "no-guess-dev"
local_scheme = "no-local-version"
version_file = "src/{{ project_name }}/_version.py"
version_file = "src/{{ python_package_name }}/_version.py"

[tool.ruff]
target-version = "py311"
Expand Down Expand Up @@ -95,4 +95,4 @@ formats = "ipynb,py:light"

[tool.vulture]
min_confidence = 90
paths = [ "src/{{ project_name }}", "tests" ]
paths = [ "src/{{ python_package_name }}", "tests" ]
2 changes: 1 addition & 1 deletion src/notebooks/example_notebook.ipynb.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"outputs": [],
"source": [
"# show an import from a local package\n",
"from {{ project_name }} import show_message"
"from {{ python_package_name }} import show_message"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/notebooks/example_notebook.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# Clicking it applies the formatting to the notebook.

# show an import from a local package
from {{ project_name }} import show_message
from {{ python_package_name }} import show_message

# use the function within the notebook to show it works
show_message("Hello, notebook!")
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""
CLI for nviz
CLI for {{ python_package_name }}
"""

import fire

from {{ project_name }}.main import show_message
from {{ python_package_name }}.main import show_message


class {{ project_name }}CLI:
class {{ python_package_name }}CLI:
def show_message(
self,
message: str = "Hello, world!",
Expand All @@ -33,4 +33,4 @@ def trigger() -> None:
"""
Trigger the CLI to run.
"""
fire.Fire({{ project_name }}CLI)
fire.Fire({{ python_package_name }}CLI)
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/test_main.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Tests for the main module.
"""

from {{ project_name }}.main import show_message
from {{ python_package_name }}.main import show_message


def test_show_message(my_data: str) -> None:
Expand Down
3 changes: 2 additions & 1 deletion tests/test_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ def test_template(tmp_path: Path) -> None:
src_path=str(template_path),
dst_path=dst_path,
data={
"project_name": "demo_project",
"project_name": "demo-project",
"project_description": "A demo project for testing Copier templates.",
"author_name": "Test Author",
"author_orcid": "https://orcid.org/0000-0000-0000-0000",
"github_url": "https://github.com/org/repo",
},
quiet=True,
overwrite=True,
vcs_ref="HEAD",
)

# Assert a file from the template was created
Expand Down