diff --git a/copier.yml b/copier.yml index 4cef954..c392b47 100644 --- a/copier.yml +++ b/copier.yml @@ -18,6 +18,17 @@ custom_install: retrofitting existing project: retrofit custom: custom +contains_code: + help: The repo contains some code that should be tested. + type: bool + default: >- + {% if custom_install != 'notebook' %} + true + {% else %} + false + {% endif %} + when: false # Automatically determined, not asked to the user. + project_name: type: str help: What is the name of your project? @@ -119,7 +130,7 @@ mypy_type_checking: create_example_module: help: Do you want to create some example module code? type: bool - default: yes + default: "{{ contains_code }}" choices: yes: true no: false @@ -153,7 +164,7 @@ include_dev_guide: include_benchmarks: help: Do you want to enable benchmarking? type: bool - default: yes + default: "{{ contains_code }}" choices: yes: true no: false diff --git a/python-project-template/.github/workflows/publish-to-pypi.yml.jinja b/python-project-template/.github/workflows/{% if contains_code %}publish-to-pypi.yml{% endif %}.jinja similarity index 100% rename from python-project-template/.github/workflows/publish-to-pypi.yml.jinja rename to python-project-template/.github/workflows/{% if contains_code %}publish-to-pypi.yml{% endif %}.jinja diff --git a/python-project-template/.github/workflows/smoke-test.yml.jinja b/python-project-template/.github/workflows/{% if contains_code %}smoke-test.yml{% endif %}.jinja similarity index 100% rename from python-project-template/.github/workflows/smoke-test.yml.jinja rename to python-project-template/.github/workflows/{% if contains_code %}smoke-test.yml{% endif %}.jinja diff --git a/python-project-template/.github/workflows/testing-and-coverage.yml.jinja b/python-project-template/.github/workflows/{% if contains_code %}testing-and-coverage.yml{% endif %}.jinja similarity index 100% rename from python-project-template/.github/workflows/testing-and-coverage.yml.jinja rename to python-project-template/.github/workflows/{% if contains_code %}testing-and-coverage.yml{% endif %}.jinja diff --git a/python-project-template/.pre-commit-config.yaml.jinja b/python-project-template/.pre-commit-config.yaml.jinja index 64956f6..4be5d0a 100644 --- a/python-project-template/.pre-commit-config.yaml.jinja +++ b/python-project-template/.pre-commit-config.yaml.jinja @@ -151,6 +151,7 @@ repos: args: ["docs/pre_executed/"] {%- endif %} +{%- if contains_code %} # Run unit tests, verify that they pass. Note that coverage is run against # the ./src directory here because that is what will be committed. In the # github workflow script, the coverage is run against the installed package @@ -165,3 +166,4 @@ repos: language: system pass_filenames: false always_run: true +{%- endif %} diff --git a/python-project-template/src/{% if 'pylint' in enforce_style %}.pylintrc{% endif %}.jinja b/python-project-template/{% if contains_code %}src{% endif %}/{% if 'pylint' in enforce_style %}.pylintrc{% endif %}.jinja similarity index 100% rename from python-project-template/src/{% if 'pylint' in enforce_style %}.pylintrc{% endif %}.jinja rename to python-project-template/{% if contains_code %}src{% endif %}/{% if 'pylint' in enforce_style %}.pylintrc{% endif %}.jinja diff --git a/python-project-template/src/{{package_name}}/__init__.py.jinja b/python-project-template/{% if contains_code %}src{% endif %}/{{package_name}}/__init__.py.jinja similarity index 100% rename from python-project-template/src/{{package_name}}/__init__.py.jinja rename to python-project-template/{% if contains_code %}src{% endif %}/{{package_name}}/__init__.py.jinja diff --git a/python-project-template/src/{{package_name}}/{% if create_example_module %}example_module.py{% endif %} b/python-project-template/{% if contains_code %}src{% endif %}/{{package_name}}/{% if create_example_module %}example_module.py{% endif %} similarity index 100% rename from python-project-template/src/{{package_name}}/{% if create_example_module %}example_module.py{% endif %} rename to python-project-template/{% if contains_code %}src{% endif %}/{{package_name}}/{% if create_example_module %}example_module.py{% endif %} diff --git a/python-project-template/src/{{package_name}}/{% if include_benchmarks %}example_benchmarks.py{% endif %} b/python-project-template/{% if contains_code %}src{% endif %}/{{package_name}}/{% if include_benchmarks %}example_benchmarks.py{% endif %} similarity index 100% rename from python-project-template/src/{{package_name}}/{% if include_benchmarks %}example_benchmarks.py{% endif %} rename to python-project-template/{% if contains_code %}src{% endif %}/{{package_name}}/{% if include_benchmarks %}example_benchmarks.py{% endif %} diff --git a/python-project-template/src/{{package_name}}/{% if mypy_type_checking != 'none' %}py.typed{% endif %}.jinja b/python-project-template/{% if contains_code %}src{% endif %}/{{package_name}}/{% if mypy_type_checking != 'none' %}py.typed{% endif %}.jinja similarity index 100% rename from python-project-template/src/{{package_name}}/{% if mypy_type_checking != 'none' %}py.typed{% endif %}.jinja rename to python-project-template/{% if contains_code %}src{% endif %}/{{package_name}}/{% if mypy_type_checking != 'none' %}py.typed{% endif %}.jinja diff --git a/python-project-template/tests/{% if 'pylint' in enforce_style %}.pylintrc{% endif %}.jinja b/python-project-template/{% if contains_code %}tests{% endif %}/{% if 'pylint' in enforce_style %}.pylintrc{% endif %}.jinja similarity index 100% rename from python-project-template/tests/{% if 'pylint' in enforce_style %}.pylintrc{% endif %}.jinja rename to python-project-template/{% if contains_code %}tests{% endif %}/{% if 'pylint' in enforce_style %}.pylintrc{% endif %}.jinja diff --git a/python-project-template/tests/{% if 'ruff' in enforce_style %}.ruff.toml{% endif %} b/python-project-template/{% if contains_code %}tests{% endif %}/{% if 'ruff' in enforce_style %}.ruff.toml{% endif %} similarity index 100% rename from python-project-template/tests/{% if 'ruff' in enforce_style %}.ruff.toml{% endif %} rename to python-project-template/{% if contains_code %}tests{% endif %}/{% if 'ruff' in enforce_style %}.ruff.toml{% endif %} diff --git a/python-project-template/tests/{{package_name}}/conftest.py b/python-project-template/{% if contains_code %}tests{% endif %}/{{package_name}}/conftest.py similarity index 100% rename from python-project-template/tests/{{package_name}}/conftest.py rename to python-project-template/{% if contains_code %}tests{% endif %}/{{package_name}}/conftest.py diff --git a/python-project-template/tests/{{package_name}}/test_packaging.py.jinja b/python-project-template/{% if contains_code %}tests{% endif %}/{{package_name}}/test_packaging.py.jinja similarity index 100% rename from python-project-template/tests/{{package_name}}/test_packaging.py.jinja rename to python-project-template/{% if contains_code %}tests{% endif %}/{{package_name}}/test_packaging.py.jinja diff --git a/python-project-template/tests/{{package_name}}/{% if create_example_module %}test_example_module.py{% endif %}.jinja b/python-project-template/{% if contains_code %}tests{% endif %}/{{package_name}}/{% if create_example_module %}test_example_module.py{% endif %}.jinja similarity index 100% rename from python-project-template/tests/{{package_name}}/{% if create_example_module %}test_example_module.py{% endif %}.jinja rename to python-project-template/{% if contains_code %}tests{% endif %}/{{package_name}}/{% if create_example_module %}test_example_module.py{% endif %}.jinja