copier_template_tester


Namecopier_template_tester JSON
Version 2.2.0 PyPI version JSON
download
home_pagehttps://github.com/kyleking/copier-template-tester
SummaryTest copier templates
upload_time2025-02-07 02:55:08
maintainerNone
docs_urlNone
authorKyle King
requires_python<4.0.0,>=3.10.9
licenseMIT
keywords calcipy_template
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # copier-template-tester

![./ctt-logo.png](./ctt-logo.png)

Parametrize copier templates to test for syntax errors, check the expected output, and to check against copier versions.

Note that `ctt` only tests the `copier copy` operation and doesn't check the `update` behavior and any version-specific logic that your template may contain because of how quickly those tests become complex.

## Usage

### Configuration File

When creating a copier template repository, I recommend following the nested ["subdirectory" approach](https://copier.readthedocs.io/en/latest/configuring/#subdirectory) so that the directory looks like this:

```sh
└── template_dir
│   └── {{ _copier_conf.answers_file }}.jinja
├── README.md
├── copier.yml
└── ctt.toml
```

Create a new `ctt.toml` file in the top-level directory of your copier repository. Populate the file to look like the below example.

```toml
# Specify shared data across all 'output' destinations
# Note that the copier.yml defaults are used whenever the key is not set in this file
[defaults]
project_name = "placeholder"
copyright_year = 2022

# Parametrize each output with a relative path and optionally any values to override
[output.".ctt/defaults"]

[output.".ctt/no_all"]
package_name = "testing-no-all"
include_all = false
```

#### Extra tasks

Anything in the `_extra_tasks` key will be run after that project is generated. This is useful for running tests or other tasks that are not part of the copier template.

```toml
[defaults]
_extra_tasks = [
  "pre-commit run --all-files",
]

[output.".ctt/also-run-pytest-here"]
_extra_tasks = [
  "poetry run pytest",
]
```

### Pre-Commit Hook

First, add this section to your `.pre-commit-config.yml` file:

```yaml
repos:
  - repo: https://github.com/KyleKing/copier-template-tester
    rev: main
    hooks:
      - id: copier-template-tester
```

Install and update to the latest revision:

```sh
pre-commit autoupdate
```

The run with `pre-commit`:

```sh
pre-commit run --all-files copier-template-tester
```

### pipx

You can also try `ctt` as a CLI tool by installing with `pipx`:

```sh
pipx install copier-template-tester

cd ~/your/copier/project
ctt
```

### More Examples

For more example code, see the [scripts] directory or the [tests].

## Project Status

See the `Open Issues` and/or the [CODE_TAG_SUMMARY]. For release history, see the [CHANGELOG].

## Contributing

We welcome pull requests! For your pull request to be accepted smoothly, we suggest that you first open a GitHub issue to discuss your idea. For resources on getting started with the code base, see the below documentation:

- [DEVELOPER_GUIDE]
- [STYLE_GUIDE]

## Code of Conduct

We follow the [Contributor Covenant Code of Conduct][contributor-covenant].

### Open Source Status

We try to reasonably meet most aspects of the "OpenSSF scorecard" from [Open Source Insights](https://deps.dev/pypi/copier-template-tester)

## Responsible Disclosure

If you have any security issue to report, please contact the project maintainers privately. You can reach us at [dev.act.kyle@gmail.com](mailto:dev.act.kyle@gmail.com).

## License

[LICENSE]

[changelog]: https://copier-template-tester.kyleking.me/docs/CHANGELOG
[code_tag_summary]: https://copier-template-tester.kyleking.me/docs/CODE_TAG_SUMMARY
[contributor-covenant]: https://www.contributor-covenant.org
[developer_guide]: https://copier-template-tester.kyleking.me/docs/DEVELOPER_GUIDE
[license]: https://github.com/kyleking/copier-template-tester/blob/main/LICENSE
[scripts]: https://github.com/kyleking/copier-template-tester/blob/main/scripts
[style_guide]: https://copier-template-tester.kyleking.me/docs/STYLE_GUIDE
[tests]: https://github.com/kyleking/copier-template-tester/blob/main/tests

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/kyleking/copier-template-tester",
    "name": "copier_template_tester",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0.0,>=3.10.9",
    "maintainer_email": null,
    "keywords": "calcipy_template",
    "author": "Kyle King",
    "author_email": "dev.act.kyle@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/33/8c/58f76f40690d36eec360debf5b23075b1fe171b8b199a9ae1def9670484f/copier_template_tester-2.2.0.tar.gz",
    "platform": null,
    "description": "# copier-template-tester\n\n![./ctt-logo.png](./ctt-logo.png)\n\nParametrize copier templates to test for syntax errors, check the expected output, and to check against copier versions.\n\nNote that `ctt` only tests the `copier copy` operation and doesn't check the `update` behavior and any version-specific logic that your template may contain because of how quickly those tests become complex.\n\n## Usage\n\n### Configuration File\n\nWhen creating a copier template repository, I recommend following the nested [\"subdirectory\" approach](https://copier.readthedocs.io/en/latest/configuring/#subdirectory) so that the directory looks like this:\n\n```sh\n\u2514\u2500\u2500 template_dir\n\u2502   \u2514\u2500\u2500 {{ _copier_conf.answers_file }}.jinja\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 copier.yml\n\u2514\u2500\u2500 ctt.toml\n```\n\nCreate a new `ctt.toml` file in the top-level directory of your copier repository. Populate the file to look like the below example.\n\n```toml\n# Specify shared data across all 'output' destinations\n# Note that the copier.yml defaults are used whenever the key is not set in this file\n[defaults]\nproject_name = \"placeholder\"\ncopyright_year = 2022\n\n# Parametrize each output with a relative path and optionally any values to override\n[output.\".ctt/defaults\"]\n\n[output.\".ctt/no_all\"]\npackage_name = \"testing-no-all\"\ninclude_all = false\n```\n\n#### Extra tasks\n\nAnything in the `_extra_tasks` key will be run after that project is generated. This is useful for running tests or other tasks that are not part of the copier template.\n\n```toml\n[defaults]\n_extra_tasks = [\n  \"pre-commit run --all-files\",\n]\n\n[output.\".ctt/also-run-pytest-here\"]\n_extra_tasks = [\n  \"poetry run pytest\",\n]\n```\n\n### Pre-Commit Hook\n\nFirst, add this section to your `.pre-commit-config.yml` file:\n\n```yaml\nrepos:\n  - repo: https://github.com/KyleKing/copier-template-tester\n    rev: main\n    hooks:\n      - id: copier-template-tester\n```\n\nInstall and update to the latest revision:\n\n```sh\npre-commit autoupdate\n```\n\nThe run with `pre-commit`:\n\n```sh\npre-commit run --all-files copier-template-tester\n```\n\n### pipx\n\nYou can also try `ctt` as a CLI tool by installing with `pipx`:\n\n```sh\npipx install copier-template-tester\n\ncd ~/your/copier/project\nctt\n```\n\n### More Examples\n\nFor more example code, see the [scripts] directory or the [tests].\n\n## Project Status\n\nSee the `Open Issues` and/or the [CODE_TAG_SUMMARY]. For release history, see the [CHANGELOG].\n\n## Contributing\n\nWe welcome pull requests! For your pull request to be accepted smoothly, we suggest that you first open a GitHub issue to discuss your idea. For resources on getting started with the code base, see the below documentation:\n\n- [DEVELOPER_GUIDE]\n- [STYLE_GUIDE]\n\n## Code of Conduct\n\nWe follow the [Contributor Covenant Code of Conduct][contributor-covenant].\n\n### Open Source Status\n\nWe try to reasonably meet most aspects of the \"OpenSSF scorecard\" from [Open Source Insights](https://deps.dev/pypi/copier-template-tester)\n\n## Responsible Disclosure\n\nIf you have any security issue to report, please contact the project maintainers privately. You can reach us at [dev.act.kyle@gmail.com](mailto:dev.act.kyle@gmail.com).\n\n## License\n\n[LICENSE]\n\n[changelog]: https://copier-template-tester.kyleking.me/docs/CHANGELOG\n[code_tag_summary]: https://copier-template-tester.kyleking.me/docs/CODE_TAG_SUMMARY\n[contributor-covenant]: https://www.contributor-covenant.org\n[developer_guide]: https://copier-template-tester.kyleking.me/docs/DEVELOPER_GUIDE\n[license]: https://github.com/kyleking/copier-template-tester/blob/main/LICENSE\n[scripts]: https://github.com/kyleking/copier-template-tester/blob/main/scripts\n[style_guide]: https://copier-template-tester.kyleking.me/docs/STYLE_GUIDE\n[tests]: https://github.com/kyleking/copier-template-tester/blob/main/tests\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Test copier templates",
    "version": "2.2.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/kyleking/copier-template-tester/issues",
        "Changelog": "https://github.com/kyleking/copier-template-tester/blob/main/docs/docs/CHANGELOG.md",
        "Documentation": "https://copier-template-tester.kyleking.me",
        "Homepage": "https://github.com/kyleking/copier-template-tester",
        "Repository": "https://github.com/kyleking/copier-template-tester"
    },
    "split_keywords": [
        "calcipy_template"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e6045825313e0e30c35be17effa2237380f6d88746c845d9875dd4c541f2c53b",
                "md5": "fae91b9d8fbde61cad3197483e41d00b",
                "sha256": "818e0d94da0653ce0db51d252b970959832801a79d6431e85e7b08d9dfb6f2e9"
            },
            "downloads": -1,
            "filename": "copier_template_tester-2.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fae91b9d8fbde61cad3197483e41d00b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0.0,>=3.10.9",
            "size": 10983,
            "upload_time": "2025-02-07T02:55:06",
            "upload_time_iso_8601": "2025-02-07T02:55:06.872328Z",
            "url": "https://files.pythonhosted.org/packages/e6/04/5825313e0e30c35be17effa2237380f6d88746c845d9875dd4c541f2c53b/copier_template_tester-2.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "338c58f76f40690d36eec360debf5b23075b1fe171b8b199a9ae1def9670484f",
                "md5": "9114d7dcda286f68008633769c87e8c7",
                "sha256": "dda9ee02024df700195f096211a4809ba0220b8806c2603a15801115e7f9ea25"
            },
            "downloads": -1,
            "filename": "copier_template_tester-2.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "9114d7dcda286f68008633769c87e8c7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0.0,>=3.10.9",
            "size": 9563,
            "upload_time": "2025-02-07T02:55:08",
            "upload_time_iso_8601": "2025-02-07T02:55:08.750668Z",
            "url": "https://files.pythonhosted.org/packages/33/8c/58f76f40690d36eec360debf5b23075b1fe171b8b199a9ae1def9670484f/copier_template_tester-2.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-07 02:55:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kyleking",
    "github_project": "copier-template-tester",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "copier_template_tester"
}
        
Elapsed time: 2.69507s