diff --git a/copier.yml b/copier.yml new file mode 100644 index 0000000..728dbef --- /dev/null +++ b/copier.yml @@ -0,0 +1,35 @@ +project_slug: + type: str + help: "The slug of the project (used in package names, etc.)" + +project_long_description: + type: str + help: "A long description of the project. It will be added to the README.md of this project" + default: "" + +project_getting_started: + type: str + help: "A short description of how to get started with the project" + +git_username: + type: str + help: "The GitHub username or organization name" + default: "pyfar" + +logo_path_gallery: + type: str + help: "What is the path to the logo image for the pyfar gallery?" + default: "resources/logos/pyfar_logos_fixed_size_{{ project_slug }}.png" + +minimum_python_version: + type: str + help: "The minimum Python version required" + choices: + - "3.9" + - "3.10" + - "3.11" + - "3.12" + - "3.13" + - "3.14" + +_subdirectory: "template" \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index ba82cfc..398125c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,10 +25,8 @@ classifiers = [ ] dependencies = [ - - - - + "copier", + "numpy", ] [project.optional-dependencies] @@ -41,6 +39,7 @@ deploy = [ ] tests = [ "pytest", + "pytest-copie", "pytest-cov", "watchdog", "ruff==0.8.3", diff --git a/template/README.md.jinja b/template/README.md.jinja new file mode 100644 index 0000000..46da30b --- /dev/null +++ b/template/README.md.jinja @@ -0,0 +1,28 @@ +

+ +


+ +[![PyPI version](https://badge.fury.io/py/{{ project_slug }}.svg)](https://badge.fury.io/py/{{ project_slug }}) +[![Documentation Status](https://readthedocs.org/projects/{{ project_slug }}/badge/?version=latest)](https://{{ project_slug }}.readthedocs.io/en/latest/?badge=latest) +[![CircleCI](https://circleci.com/gh/{{ git_username }}/{{ project_slug | replace("_", "-") }}.svg?style=shield)](https://circleci.com/gh/{{ git_username }}/{{ project_slug | replace("_", "-") }}) +[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/pyfar/gallery/main?labpath=docs/gallery/interactive/pyfar_introduction.ipynb) + +{{ project_long_description }} + +## Getting Started + +{{ project_getting_started }} + +## Installation + +Use pip to install {{ project_slug }} + + pip install {{ project_slug }} + +(Requires Python {{ minimum_python_version }} or higher) + +If the installation fails, please check out the [help section](https://pyfar-gallery.readthedocs.io/en/latest/help). + +## Contributing + +Check out the [contributing guidelines](https://{{ project_slug }}.readthedocs.io/en/stable/contributing.html) if you want to become part of pyfar. diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..930a22f --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,11 @@ +import pytest + +@pytest.fixture(scope='session') +def copier_project_defaults(): + return { + "project_slug": "my_project", + "project_long_description": "my_project_description", + "project_getting_started": "This is how to get started.", + "git_username": "pyfar", + "minimum_python_version": "3.11", + } diff --git a/tests/test_copier.py b/tests/test_copier.py new file mode 100644 index 0000000..2b3fad5 --- /dev/null +++ b/tests/test_copier.py @@ -0,0 +1,37 @@ +import pytest + + +def test_project_folder(copie, copier_project_defaults): + project_defaults = copier_project_defaults + project = copie.copy(extra_answers=project_defaults) + + assert project.exit_code == 0 + assert project.exception is None + assert project.project_dir.is_dir() + + +@pytest.mark.parametrize("file_name", [ + "README.md", +]) +def test_generated_file_exists(copie, copier_project_defaults, file_name): + project = copie.copy(extra_answers=copier_project_defaults) + + assert project.project_dir.joinpath(file_name).exists() + + +@pytest.mark.parametrize("desired", [ + "\nmy_project_description\n", + "pip install my_project", + "https://circleci.com/gh/pyfar/my-project", + "main/docs/resources/logos/pyfar_logos_fixed_size_my_project.png", + "Python 3.11 or higher", + "py/my_project.svg", + "https://my_project.readthedocs.io/en/stable/contributing.html", + "\nThis is how to get started.\n", +]) +def test_content_readme(copie, copier_project_defaults, desired): + project = copie.copy(extra_answers=copier_project_defaults) + + content = project.project_dir.joinpath("README.md").read_text() + assert desired in content +