From ef3ef2f7192f329ae25af12e6b9ddb265abfdb49 Mon Sep 17 00:00:00 2001 From: Santhosh Sundaram Date: Fri, 26 Jul 2024 23:58:39 +0530 Subject: [PATCH] changed vcs configuration --- cookiecutter.json | 4 ++-- {{cookiecutter.project_name}}/pyproject.toml | 6 +++--- .../src/{{cookiecutter.__project_slug}}/__init__.py | 4 ++-- ...f %} => {% if cookiecutter.vcs %}_version.py{% endif %}} | 0 4 files changed, 7 insertions(+), 7 deletions(-) rename {{cookiecutter.project_name}}/src/{{cookiecutter.__project_slug}}/{{% if cookiecutter.hatch_vcs %}_version.py{% endif %} => {% if cookiecutter.vcs %}_version.py{% endif %}} (100%) diff --git a/cookiecutter.json b/cookiecutter.json index 845d3d5..3693232 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -18,7 +18,7 @@ "backend": [ "hatch" ], - "hatch_vcs": false, + "vcs": false, "mypy": false, "__year": "{% now 'utc', '%Y' %}", "__project_slug": "{{ cookiecutter.project_name | lower | replace('-', '_') | replace('.', '_') }}", @@ -43,7 +43,7 @@ "backend": { "__prompt__": "Choose a build backend", "hatch": "Hatchling (recommended for pure Python projects)", - "hatch_vcs": "Enable hatch version control (vcs)?" + "vcs": "Enable hatch version control (vcs)?" }, "mypy": "Use mypy and static types" } diff --git a/{{cookiecutter.project_name}}/pyproject.toml b/{{cookiecutter.project_name}}/pyproject.toml index d0de355..1abee67 100644 --- a/{{cookiecutter.project_name}}/pyproject.toml +++ b/{{cookiecutter.project_name}}/pyproject.toml @@ -2,7 +2,7 @@ {%- if cookiecutter.backend == "hatch" %} requires = [ "hatchling", -{%- if cookiecutter.hatch_vcs == true %} +{%- if cookiecutter.backend == "hatch" and cookiecutter.vcs == true %} "hatch-vcs", {%- endif %} ] @@ -88,7 +88,7 @@ SPM = "{{ cookiecutter.__project_slug }}.models.input.SPM:SPM" {# keep this line here for newline #} {%- if cookiecutter.backend == "hatch" %} [tool.hatch] -{%- if cookiecutter.hatch_vcs == true %} +{%- if cookiecutter.backend == "hatch" and cookiecutter.vcs == true %} version.source = "vcs" build.hooks.vcs.version-file = "src/{{ cookiecutter.__project_slug }}/_version.py" {%- endif %} @@ -97,7 +97,7 @@ envs.default.dependencies = [ ] {%- endif %} -{%- if cookiecutter.hatch_vcs == false %} +{%- if cookiecutter.backend == "hatch" and cookiecutter.vcs == false %} [tool.hatch.version] path = "src/{{ cookiecutter.__project_slug }}/__init__.py" {%- endif %} diff --git a/{{cookiecutter.project_name}}/src/{{cookiecutter.__project_slug}}/__init__.py b/{{cookiecutter.project_name}}/src/{{cookiecutter.__project_slug}}/__init__.py index 2dd5887..c4a7540 100644 --- a/{{cookiecutter.project_name}}/src/{{cookiecutter.__project_slug}}/__init__.py +++ b/{{cookiecutter.project_name}}/src/{{cookiecutter.__project_slug}}/__init__.py @@ -7,7 +7,7 @@ from __future__ import annotations {%- endif %} -{%- if cookiecutter.hatch_vcs %} +{%- if cookiecutter.vcs %} from ._version import version as __version__ {%- else %} __version__ = "0.1.0" @@ -20,7 +20,7 @@ {%- else %} __all__ = [ {%- endif %} -{%- if cookiecutter.hatch_vcs %} +{%- if cookiecutter.vcs %} "__version__", {%- endif %} "pybamm", diff --git a/{{cookiecutter.project_name}}/src/{{cookiecutter.__project_slug}}/{% if cookiecutter.hatch_vcs %}_version.py{% endif %} b/{{cookiecutter.project_name}}/src/{{cookiecutter.__project_slug}}/{% if cookiecutter.vcs %}_version.py{% endif %} similarity index 100% rename from {{cookiecutter.project_name}}/src/{{cookiecutter.__project_slug}}/{% if cookiecutter.hatch_vcs %}_version.py{% endif %} rename to {{cookiecutter.project_name}}/src/{{cookiecutter.__project_slug}}/{% if cookiecutter.vcs %}_version.py{% endif %}