copier-template-tester


Namecopier-template-tester JSON
Version 1.2.4 PyPI version JSON
download
home_pagehttps://github.com/kyleking/copier-template-tester
SummaryTest copier templates
upload_time2023-05-22 22:55:55
maintainer
docs_urlNone
authorKyle King
requires_python>=3.10.5,<4.0.0
licenseMIT
keywords
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
```

### 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": "",
    "docs_url": null,
    "requires_python": ">=3.10.5,<4.0.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Kyle King",
    "author_email": "dev.act.kyle@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/dc/81/a4c07e1a04adc2151d2bced7d8e639ab1977c54a8c13733d1be0c9b186e5/copier_template_tester-1.2.4.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### 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": "1.2.4",
    "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": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "de405efc44ae424952474cd7ebd87f689a103c2ff388031ff7fb372798c9370f",
                "md5": "ab5db98229bf518fbf23f6e2df5cbcba",
                "sha256": "e88a7e4be5ad27b803667924aabc1ba053eee63e378944f393b456ffd16c6f35"
            },
            "downloads": -1,
            "filename": "copier_template_tester-1.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ab5db98229bf518fbf23f6e2df5cbcba",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10.5,<4.0.0",
            "size": 9413,
            "upload_time": "2023-05-22T22:55:54",
            "upload_time_iso_8601": "2023-05-22T22:55:54.115393Z",
            "url": "https://files.pythonhosted.org/packages/de/40/5efc44ae424952474cd7ebd87f689a103c2ff388031ff7fb372798c9370f/copier_template_tester-1.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dc81a4c07e1a04adc2151d2bced7d8e639ab1977c54a8c13733d1be0c9b186e5",
                "md5": "c2812165541b14b4f85e183d10abc768",
                "sha256": "c302008565bb45b5f81a0c08cfe35f8825b6754dd2cefbb2f380695941de1246"
            },
            "downloads": -1,
            "filename": "copier_template_tester-1.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "c2812165541b14b4f85e183d10abc768",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10.5,<4.0.0",
            "size": 6762,
            "upload_time": "2023-05-22T22:55:55",
            "upload_time_iso_8601": "2023-05-22T22:55:55.534242Z",
            "url": "https://files.pythonhosted.org/packages/dc/81/a4c07e1a04adc2151d2bced7d8e639ab1977c54a8c13733d1be0c9b186e5/copier_template_tester-1.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-22 22:55:55",
    "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: 0.70881s