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
8 changes: 4 additions & 4 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ copyright_license: ISC
insiders: false
project_description: Special Jinja2 extension for Copier that allows to load extensions
using file paths relative to the template root instead of Python dotted paths.
project_name: Copier Templates Extensions
project_name: Copier Template-Extensions
python_package_command_line_name: ''
python_package_distribution_name: copier-templates-extensions
python_package_import_name: copier_templates_extensions
repository_name: copier-templates-extensions
python_package_distribution_name: copier-template-extensions
python_package_import_name: copier_template_extensions
repository_name: copier-template-extensions
repository_namespace: copier-org
repository_provider: github.com

2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/1-bug.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ PASTE TRACEBACK HERE
redacting sensitive information. -->

```bash
python -m copier_templates_extensions._internal.debug # | xclip -selection clipboard
python -m copier_template_extensions._internal.debug # | xclip -selection clipboard
```

PASTE MARKDOWN OUTPUT HERE
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: I have a question / I need help
url: https://github.com/copier-org/copier-templates-extensions/discussions/new?category=q-a
url: https://github.com/copier-org/copier-template-extensions/discussions/new?category=q-a
about: Ask and answer questions in the Discussions tab.
50 changes: 25 additions & 25 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,63 +5,63 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

<!-- insertion marker -->
## [0.3.1](https://github.com/pawamoy/copier-templates-extensions/releases/tag/0.3.1) - 2025-03-10
## [0.3.1](https://github.com/pawamoy/copier-template-extensions/releases/tag/0.3.1) - 2025-03-10

<small>[Compare with 0.3.0](https://github.com/pawamoy/copier-templates-extensions/compare/0.3.0...0.3.1)</small>
<small>[Compare with 0.3.0](https://github.com/pawamoy/copier-template-extensions/compare/0.3.0...0.3.1)</small>

### Dependencies

- Depend on Copier 9.2+ ([43679a9](https://github.com/pawamoy/copier-templates-extensions/commit/43679a9719b2d05e041e674bde1f10dee21984a6) by Timothée Mazzucotelli).
- Depend on Copier 9.2+ ([43679a9](https://github.com/pawamoy/copier-template-extensions/commit/43679a9719b2d05e041e674bde1f10dee21984a6) by Timothée Mazzucotelli).

### Bug Fixes

- Add loaded module to `sys.modules` to help libraries using data from annotation scopes ([a290f27](https://github.com/pawamoy/copier-templates-extensions/commit/a290f271e302db88bcc755d57c647e4f3a8043ff) by Axel H.). [PR-12](https://github.com/copier-org/copier-templates-extensions/pull/12)
- Add loaded module to `sys.modules` to help libraries using data from annotation scopes ([a290f27](https://github.com/pawamoy/copier-template-extensions/commit/a290f271e302db88bcc755d57c647e4f3a8043ff) by Axel H.). [PR-12](https://github.com/copier-org/copier-template-extensions/pull/12)

### Code Refactoring

- Move modules into internal folder (and simplify API docs) ([a8c0377](https://github.com/pawamoy/copier-templates-extensions/commit/a8c03770298f51fa07667598fd7d0b72196aecad) by Timothée Mazzucotelli).
- Pass globals to parent constructor ([ea4567b](https://github.com/pawamoy/copier-templates-extensions/commit/ea4567bcfad0f17764e17d6b7fd12a7fd7a33cba) by Timothée Mazzucotelli).
- Deprecate the "update" aspect of context hooks ([876c055](https://github.com/pawamoy/copier-templates-extensions/commit/876c0554e34b630ab255111b69da74db16439dcb) by Timothée Mazzucotelli). [Issue-4](https://github.com/copier-org/copier-templates-extensions/issues/4)
- Move modules into internal folder (and simplify API docs) ([a8c0377](https://github.com/pawamoy/copier-template-extensions/commit/a8c03770298f51fa07667598fd7d0b72196aecad) by Timothée Mazzucotelli).
- Pass globals to parent constructor ([ea4567b](https://github.com/pawamoy/copier-template-extensions/commit/ea4567bcfad0f17764e17d6b7fd12a7fd7a33cba) by Timothée Mazzucotelli).
- Deprecate the "update" aspect of context hooks ([876c055](https://github.com/pawamoy/copier-template-extensions/commit/876c0554e34b630ab255111b69da74db16439dcb) by Timothée Mazzucotelli). [Issue-4](https://github.com/copier-org/copier-template-extensions/issues/4)

## [0.3.0](https://github.com/copier-org/copier-templates-extensions/releases/tag/0.3.0) - 2022-09-12
## [0.3.0](https://github.com/copier-org/copier-template-extensions/releases/tag/0.3.0) - 2022-09-12

<small>[Compare with 0.2.0](https://github.com/copier-org/copier-templates-extensions/compare/0.2.0...0.3.0)</small>
<small>[Compare with 0.2.0](https://github.com/copier-org/copier-template-extensions/compare/0.2.0...0.3.0)</small>

### Build
- Require Copier v6+ (Python >= 3.7) ([6380c90](https://github.com/copier-org/copier-templates-extensions/commit/6380c90a3e26c596790d9a083673dcf1dd613678) by Timothée Mazzucotelli).
- Require Copier v6+ (Python >= 3.7) ([6380c90](https://github.com/copier-org/copier-template-extensions/commit/6380c90a3e26c596790d9a083673dcf1dd613678) by Timothée Mazzucotelli).


## [0.2.0](https://github.com/copier-org/copier-templates-extensions/releases/tag/0.2.0) - 2021-12-27
## [0.2.0](https://github.com/copier-org/copier-template-extensions/releases/tag/0.2.0) - 2021-12-27

<small>[Compare with 0.1.1](https://github.com/copier-org/copier-templates-extensions/compare/0.1.1...0.2.0)</small>
<small>[Compare with 0.1.1](https://github.com/copier-org/copier-template-extensions/compare/0.1.1...0.2.0)</small>

### Build
- Match Python cap to Copier's ([a04f938](https://github.com/copier-org/copier-templates-extensions/commit/a04f93813f9795b64cbd9d21209dd5e5127b3eb4) by Timothée Mazzucotelli).
- Match Python cap to Copier's ([a04f938](https://github.com/copier-org/copier-template-extensions/commit/a04f93813f9795b64cbd9d21209dd5e5127b3eb4) by Timothée Mazzucotelli).

### Features
- Support Jinja2 version 3.x ([55211df](https://github.com/copier-org/copier-templates-extensions/commit/55211df29c4118c2603cc18ea4a1bc4247e41176) by Timothée Mazzucotelli).
- Support Jinja2 version 3.x ([55211df](https://github.com/copier-org/copier-template-extensions/commit/55211df29c4118c2603cc18ea4a1bc4247e41176) by Timothée Mazzucotelli).


## [0.1.1](https://github.com/copier-org/copier-templates-extensions/releases/tag/0.1.1) - 2021-03-29
## [0.1.1](https://github.com/copier-org/copier-template-extensions/releases/tag/0.1.1) - 2021-03-29

<small>[Compare with 0.1.0](https://github.com/copier-org/copier-templates-extensions/compare/0.1.0...0.1.1)</small>
<small>[Compare with 0.1.0](https://github.com/copier-org/copier-template-extensions/compare/0.1.0...0.1.1)</small>

### Bug Fixes
- Fix loader extension ([7d8b9e8](https://github.com/copier-org/copier-templates-extensions/commit/7d8b9e8cf2de66fafc9953ff5d4ba4e210470649) by Timothée Mazzucotelli).
- Fix loader extension ([7d8b9e8](https://github.com/copier-org/copier-template-extensions/commit/7d8b9e8cf2de66fafc9953ff5d4ba4e210470649) by Timothée Mazzucotelli).

### Code Refactoring
- Raise error from abstract hook ([52494f8](https://github.com/copier-org/copier-templates-extensions/commit/52494f8d02505027da0733a7beb9269fc2ba8c3e) by Timothée Mazzucotelli).
- Raise Copier errors from loader extension ([c136feb](https://github.com/copier-org/copier-templates-extensions/commit/c136febaa4ed719f5a0919e2fa073862258e7143) by Timothée Mazzucotelli).
- Rename context module, inherit from default context class ([855284a](https://github.com/copier-org/copier-templates-extensions/commit/855284ad2112feecd6b2a8dfc38dbbd397d29275) by Timothée Mazzucotelli).
- Raise error from abstract hook ([52494f8](https://github.com/copier-org/copier-template-extensions/commit/52494f8d02505027da0733a7beb9269fc2ba8c3e) by Timothée Mazzucotelli).
- Raise Copier errors from loader extension ([c136feb](https://github.com/copier-org/copier-template-extensions/commit/c136febaa4ed719f5a0919e2fa073862258e7143) by Timothée Mazzucotelli).
- Rename context module, inherit from default context class ([855284a](https://github.com/copier-org/copier-template-extensions/commit/855284ad2112feecd6b2a8dfc38dbbd397d29275) by Timothée Mazzucotelli).


## [0.1.0](https://github.com/copier-org/copier-templates-extensions/releases/tag/0.1.0) - 2021-03-29
## [0.1.0](https://github.com/copier-org/copier-template-extensions/releases/tag/0.1.0) - 2021-03-29

<small>[Compare with first commit](https://github.com/copier-org/copier-templates-extensions/compare/e74578393a7cffe4e502640a6092e789d2cc6f29...0.1.0)</small>
<small>[Compare with first commit](https://github.com/copier-org/copier-template-extensions/compare/e74578393a7cffe4e502640a6092e789d2cc6f29...0.1.0)</small>

### Code Refactoring
- Reorganize code ([474b617](https://github.com/copier-org/copier-templates-extensions/commit/474b6173f3970c7713643b7cbc16f11f32a70e5c) by Timothée Mazzucotelli).
- Reorganize code ([474b617](https://github.com/copier-org/copier-template-extensions/commit/474b6173f3970c7713643b7cbc16f11f32a70e5c) by Timothée Mazzucotelli).

### Features
- Add context hook extension ([ce95212](https://github.com/copier-org/copier-templates-extensions/commit/ce952126afb282cfa1fbf18366a6f857426eeaa1) by Timothée Mazzucotelli).
- Add initial contents ([e745783](https://github.com/copier-org/copier-templates-extensions/commit/e74578393a7cffe4e502640a6092e789d2cc6f29) by Timothée Mazzucotelli).
- Add context hook extension ([ce95212](https://github.com/copier-org/copier-template-extensions/commit/ce952126afb282cfa1fbf18366a6f857426eeaa1) by Timothée Mazzucotelli).
- Add initial contents ([e745783](https://github.com/copier-org/copier-template-extensions/commit/e74578393a7cffe4e502640a6092e789d2cc6f29) by Timothée Mazzucotelli).
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Nothing easier!
Fork and clone the repository, then:

```bash
cd copier-templates-extensions
cd copier-template-extensions
make setup
```

Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Copier Templates Extensions
# Copier Template-Extensions

[![ci](https://github.com/copier-org/copier-templates-extensions/workflows/ci/badge.svg)](https://github.com/copier-org/copier-templates-extensions/actions?query=workflow%3Aci)
[![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://copier-org.github.io/copier-templates-extensions/)
[![pypi version](https://img.shields.io/pypi/v/copier-templates-extensions.svg)](https://pypi.org/project/copier-templates-extensions/)
[![ci](https://github.com/copier-org/copier-template-extensions/workflows/ci/badge.svg)](https://github.com/copier-org/copier-template-extensions/actions?query=workflow%3Aci)
[![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://copier-org.github.io/copier-template-extensions/)
[![pypi version](https://img.shields.io/pypi/v/copier-template-extensions.svg)](https://pypi.org/project/copier-template-extensions/)

Special Jinja2 extension for Copier that allows to load extensions using file paths relative to the template root instead of Python dotted paths.

Expand All @@ -11,20 +11,20 @@ Special Jinja2 extension for Copier that allows to load extensions using file pa
With pip:

```bash
pip install copier-templates-extensions
pip install copier-template-extensions
```

With uv:

```bash
uv tool install copier --with copier-templates-extensions
uv tool install copier --with copier-template-extensions
```

With pipx:

```bash
pipx install copier
pipx inject copier copier-templates-extensions
pipx inject copier copier-template-extensions
```

## Usage
Expand All @@ -37,7 +37,7 @@ and the class name after a colon:

```yaml
_jinja_extensions:
- copier_templates_extensions.TemplateExtensionLoader
- copier_template_extensions.TemplateExtensionLoader
- extensions/context.py:ContextUpdater
- extensions/slugify.py:SlugifyExtension
```
Expand Down Expand Up @@ -103,7 +103,7 @@ create a class that inherits from `ContextHook`,
and override its `hook` method:

```python
from copier_templates_extensions import ContextHook
from copier_template_extensions import ContextHook


class ContextUpdater(ContextHook):
Expand Down Expand Up @@ -175,7 +175,7 @@ As you can see, both forms are really ugly to write:
**Using our context hook instead makes it so easy and clean!**

```python
from copier_templates_extensions import ContextHook
from copier_template_extensions import ContextHook


class ContextUpdater(ContextHook):
Expand Down
2 changes: 1 addition & 1 deletion config/ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ docstring-quotes = "double"
ban-relative-imports = "all"

[lint.isort]
known-first-party = ["copier_templates_extensions"]
known-first-party = ["copier_template_extensions"]

[lint.pydocstyle]
convention = "google"
Expand Down
2 changes: 1 addition & 1 deletion config/vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"name": "run",
"type": "debugpy",
"request": "launch",
"module": "copier_templates_extensions",
"module": "copier_template_extensions",
"console": "integratedTerminal",
"justMyCode": false,
"args": "${command:pickArgs}"
Expand Down
2 changes: 1 addition & 1 deletion docs/.overrides/partials/comments.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div id="feedback" style="display: none;">
<h2 id="__comments">Feedback</h2>
<script src="https://giscus.app/client.js"
data-repo="copier-org/copier-templates-extensions"
data-repo="copier-org/copier-template-extensions"
data-repo-id="MDEwOlJlcG9zaXRvcnkzNTExNzg3NzA="
data-category="Documentation"
data-category-id="DIC_kwDOFO6QEs4CnyW2"
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ hide:
- navigation
---

# ::: copier_templates_extensions
# ::: copier_template_extensions
2 changes: 1 addition & 1 deletion duties.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def check_types(ctx: Context) -> None:
def check_api(ctx: Context, *cli_args: str) -> None:
"""Check for API breaking changes."""
ctx.run(
tools.griffe.check("copier_templates_extensions", search=["src"], color=True).add_args(*cli_args),
tools.griffe.check("copier_template_extensions", search=["src"], color=True).add_args(*cli_args),
title="Checking for API breaking changes",
nofail=True,
)
Expand Down
14 changes: 7 additions & 7 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
site_name: "Copier Templates Extensions"
site_name: "Copier Template-Extensions"
site_description: "Special Jinja2 extension for Copier that allows to load extensions using file paths relative to the template root instead of Python dotted paths."
site_url: "https://copier-org.github.io/copier-templates-extensions"
repo_url: "https://github.com/copier-org/copier-templates-extensions"
repo_name: "copier-org/copier-templates-extensions"
site_url: "https://copier-org.github.io/copier-template-extensions"
repo_url: "https://github.com/copier-org/copier-template-extensions"
repo_name: "copier-org/copier-template-extensions"
site_dir: "site"
watch: [mkdocs.yml, README.md, CONTRIBUTING.md, CHANGELOG.md, src/copier_templates_extensions]
watch: [mkdocs.yml, README.md, CONTRIBUTING.md, CHANGELOG.md, src/copier_template_extensions]
copyright: Copyright &copy; 2021 Timothée Mazzucotelli
edit_uri: edit/main/docs/

Expand Down Expand Up @@ -155,9 +155,9 @@ extra:
- icon: fontawesome/brands/twitter
link: https://twitter.com/pawamoy
- icon: fontawesome/brands/gitter
link: https://gitter.im/copier-templates-extensions/community
link: https://gitter.im/copier-template-extensions/community
- icon: fontawesome/brands/python
link: https://pypi.org/project/copier-templates-extensions/
link: https://pypi.org/project/copier-template-extensions/
analytics:
feedback:
title: Was this page helpful?
Expand Down
14 changes: 7 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["pdm-backend"]
build-backend = "pdm.backend"

[project]
name = "copier-templates-extensions"
name = "copier-template-extensions"
description = "Special Jinja2 extension for Copier that allows to load extensions using file paths relative to the template root instead of Python dotted paths."
authors = [{name = "Timothée Mazzucotelli", email = "dev@pawamoy.fr"}]
license = "ISC"
Expand Down Expand Up @@ -33,12 +33,12 @@ dependencies = [
]

[project.urls]
Homepage = "https://github.com/copier-org/copier-templates-extensions"
Documentation = "https://github.com/copier-org/copier-templates-extensions"
Changelog = "https://github.com/copier-org/copier-templates-extensions/blob/main/CHANGELOG.md"
Repository = "https://github.com/copier-org/copier-templates-extensions"
Issues = "https://github.com/copier-org/copier-templates-extensions/issues"
Discussions = "https://github.com/copier-org/copier-templates-extensions/discussions"
Homepage = "https://github.com/copier-org/copier-template-extensions"
Documentation = "https://github.com/copier-org/copier-template-extensions"
Changelog = "https://github.com/copier-org/copier-template-extensions/blob/main/CHANGELOG.md"
Repository = "https://github.com/copier-org/copier-template-extensions"
Issues = "https://github.com/copier-org/copier-template-extensions/issues"
Discussions = "https://github.com/copier-org/copier-template-extensions/discussions"
Funding = "https://github.com/sponsors/pawamoy"

[tool.pdm.version]
Expand Down
2 changes: 1 addition & 1 deletion scripts/gen_credits.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def _set_license(metadata: PackageMetadata) -> None:
def _get_deps(base_deps: dict[str, Requirement], metadata: Metadata) -> Metadata:
deps = {}
for dep_name, dep_req in base_deps.items():
if dep_name not in metadata or dep_name == "copier-templates-extensions":
if dep_name not in metadata or dep_name == "copier-template-extensions":
continue
metadata[dep_name]["spec"] |= {str(spec) for spec in dep_req.specifier} # type: ignore[operator]
metadata[dep_name]["extras"] |= dep_req.extras # type: ignore[operator]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from __future__ import annotations

from copier_templates_extensions._internal.context import ContextHook
from copier_templates_extensions._internal.loader import TemplateExtensionLoader
from copier_template_extensions._internal.context import ContextHook
from copier_template_extensions._internal.loader import TemplateExtensionLoader

__all__: list[str] = ["ContextHook", "TemplateExtensionLoader"]
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _interpreter_name_version() -> tuple[str, str]:
return "", "0.0.0"


def _get_version(dist: str = "copier-templates-extensions") -> str:
def _get_version(dist: str = "copier-template-extensions") -> str:
"""Get version of the given distribution.

Parameters:
Expand All @@ -78,8 +78,8 @@ def _get_debug_info() -> _Environment:
Environment information.
"""
py_name, py_version = _interpreter_name_version()
packages = ["copier-templates-extensions"]
variables = ["PYTHONPATH", *[var for var in os.environ if var.startswith("COPIER_TEMPLATES_EXTENSIONS")]]
packages = ["copier-template-extensions"]
variables = ["PYTHONPATH", *[var for var in os.environ if var.startswith("copier_template_extensions")]]
return _Environment(
interpreter_name=py_name,
interpreter_version=py_version,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def _import_template_module(self, relative_path: str | Path) -> ModuleType:
"Please report this issue to the template maintainers.",
)
spec = spec_from_file_location(
module_full_name := f"copier_templates_extensions.{module_name}",
module_full_name := f"copier_template_extensions.{module_name}",
template_relative_path,
)
module = module_from_spec(spec) # type: ignore[arg-type]
Expand Down
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Tests suite for `copier_templates_extensions`."""
"""Tests suite for `copier_template_extensions`."""

from pathlib import Path

Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/answer_access/copier.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
_jinja_extensions:
- copier_templates_extensions.TemplateExtensionLoader
- copier_template_extensions.TemplateExtensionLoader
- extensions.py:ContextUpdater
2 changes: 1 addition & 1 deletion tests/fixtures/answer_access/extensions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from copier_templates_extensions import ContextHook
from copier_template_extensions import ContextHook


class ContextUpdater(ContextHook):
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/cant_find_extension_class/copier.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
_jinja_extensions:
- copier_templates_extensions.TemplateExtensionLoader
- copier_template_extensions.TemplateExtensionLoader
- extensions.py:ImNotHere
2 changes: 1 addition & 1 deletion tests/fixtures/cant_find_extension_file/copier.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
_jinja_extensions:
- copier_templates_extensions.TemplateExtensionLoader
- copier_template_extensions.TemplateExtensionLoader
- im_not_here.py:Success
Loading
Loading