From cd4457a528d3b14d610129cbee19544fcd806b09 Mon Sep 17 00:00:00 2001 From: Yehuda Deutsch Date: Tue, 29 Apr 2025 17:19:46 -0400 Subject: [PATCH] Improve template --- LICENSE | 21 +++++++++++++++++++ README.md | 3 +++ copier.yml | 14 +++++++++++-- .gitignore => template/.gitignore | 0 template/.pre-commit-config.yaml.jinja | 10 +++++++++ .../.python-version.jinja | 0 README.md.jinja => template/README.md.jinja | 0 template/project-name.jinja | 1 + .../pyproject.toml.jinja | 2 +- ...icense == 'MIT' %}LICENSE{% endif %}.jinja | 21 +++++++++++++++++++ .../__init__.py | 0 .../{{ _copier_conf.answers_file }}.jinja | 0 12 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 LICENSE create mode 100644 README.md rename .gitignore => template/.gitignore (100%) create mode 100644 template/.pre-commit-config.yaml.jinja rename .python-version.jinja => template/.python-version.jinja (100%) rename README.md.jinja => template/README.md.jinja (100%) create mode 100644 template/project-name.jinja rename pyproject.toml.jinja => template/pyproject.toml.jinja (93%) create mode 100644 template/{% if license == 'MIT' %}LICENSE{% endif %}.jinja rename {{{project_name}} => template/{% include 'project-name.jinja' %}}/__init__.py (100%) rename {{ _copier_conf.answers_file }}.jinja => template/{{ _copier_conf.answers_file }}.jinja (100%) diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..80a39ea --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Yehuda Deutsch + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..134b13a --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Ajal Template - Python + +An opinionated python template, managed using [copier](https://copier.readthedocs.io/) diff --git a/copier.yml b/copier.yml index fe5c513..be36d0e 100644 --- a/copier.yml +++ b/copier.yml @@ -1,3 +1,5 @@ +_subdirectory: template + # Questions project_name: type: str @@ -6,17 +8,25 @@ project_name: project_description: type: str help: Describe your project - default: A project based on ajal-template-python + default: A python project based on ajal-template-python minimum_python_version: type: str - help: Minmum python version + help: Minimum python version choices: - "3.10" - "3.11" - "3.12" - "3.13" +license: + type: str + help: A license for the project + default: MIT + choices: + - "" + - "MIT" + dependency_manager: type: str help: Python dependency manager diff --git a/.gitignore b/template/.gitignore similarity index 100% rename from .gitignore rename to template/.gitignore diff --git a/template/.pre-commit-config.yaml.jinja b/template/.pre-commit-config.yaml.jinja new file mode 100644 index 0000000..1e41275 --- /dev/null +++ b/template/.pre-commit-config.yaml.jinja @@ -0,0 +1,10 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files diff --git a/.python-version.jinja b/template/.python-version.jinja similarity index 100% rename from .python-version.jinja rename to template/.python-version.jinja diff --git a/README.md.jinja b/template/README.md.jinja similarity index 100% rename from README.md.jinja rename to template/README.md.jinja diff --git a/template/project-name.jinja b/template/project-name.jinja new file mode 100644 index 0000000..36209e2 --- /dev/null +++ b/template/project-name.jinja @@ -0,0 +1 @@ +{{ project_name | lower | replace(' ', '_') | replace('-', '_') }} \ No newline at end of file diff --git a/pyproject.toml.jinja b/template/pyproject.toml.jinja similarity index 93% rename from pyproject.toml.jinja rename to template/pyproject.toml.jinja index dacb14c..8e0d285 100644 --- a/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -1,5 +1,5 @@ [project] -name = "{{project_name}}" +name = "{{ project_name | lower | replace(' ', '-') }}" version = "0.1.0" description = "{{project_description}}" authors = [ diff --git a/template/{% if license == 'MIT' %}LICENSE{% endif %}.jinja b/template/{% if license == 'MIT' %}LICENSE{% endif %}.jinja new file mode 100644 index 0000000..d5ef7b3 --- /dev/null +++ b/template/{% if license == 'MIT' %}LICENSE{% endif %}.jinja @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 {{user_name}} + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/{{project_name}}/__init__.py b/template/{% include 'project-name.jinja' %}/__init__.py similarity index 100% rename from {{project_name}}/__init__.py rename to template/{% include 'project-name.jinja' %}/__init__.py diff --git a/{{ _copier_conf.answers_file }}.jinja b/template/{{ _copier_conf.answers_file }}.jinja similarity index 100% rename from {{ _copier_conf.answers_file }}.jinja rename to template/{{ _copier_conf.answers_file }}.jinja