From 7f6a9d70f75117faff6b0faa240869f95104a6a4 Mon Sep 17 00:00:00 2001 From: Dan Buchholz Date: Mon, 22 Apr 2024 15:52:47 -0700 Subject: [PATCH] refactor: use 'slug', fix mypy path --- cookiecutter.json | 3 +-- .../.coveragerc | 0 .../.editorconfig | 0 .../.flake8 | 0 .../.github/ISSUE_TEMPLATE.md | 0 .../.gitignore | 0 .../.pre-commit-config.yaml | 0 .../LICENSE | 0 .../README.md | 12 ++++++------ .../pyproject.toml | 9 ++++----- .../src/{{cookiecutter.slug}}}/__init__.py | 0 .../src/{{cookiecutter.slug}}}/__main__.py | 0 .../src/{{cookiecutter.slug}}}/example.py | 0 .../test/test_{{cookiecutter.slug}}.py | 2 +- 14 files changed, 12 insertions(+), 14 deletions(-) rename {{{cookiecutter.underscored}} => {{cookiecutter.slug}}}/.coveragerc (100%) rename {{{cookiecutter.underscored}} => {{cookiecutter.slug}}}/.editorconfig (100%) rename {{{cookiecutter.underscored}} => {{cookiecutter.slug}}}/.flake8 (100%) rename {{{cookiecutter.underscored}} => {{cookiecutter.slug}}}/.github/ISSUE_TEMPLATE.md (100%) rename {{{cookiecutter.underscored}} => {{cookiecutter.slug}}}/.gitignore (100%) rename {{{cookiecutter.underscored}} => {{cookiecutter.slug}}}/.pre-commit-config.yaml (100%) rename {{{cookiecutter.underscored}} => {{cookiecutter.slug}}}/LICENSE (100%) rename {{{cookiecutter.underscored}} => {{cookiecutter.slug}}}/README.md (81%) rename {{{cookiecutter.underscored}} => {{cookiecutter.slug}}}/pyproject.toml (87%) rename {{{cookiecutter.underscored}}/src/{{cookiecutter.underscored}} => {{cookiecutter.slug}}/src/{{cookiecutter.slug}}}/__init__.py (100%) rename {{{cookiecutter.underscored}}/src/{{cookiecutter.underscored}} => {{cookiecutter.slug}}/src/{{cookiecutter.slug}}}/__main__.py (100%) rename {{{cookiecutter.underscored}}/src/{{cookiecutter.underscored}} => {{cookiecutter.slug}}/src/{{cookiecutter.slug}}}/example.py (100%) rename {{cookiecutter.underscored}}/tests/test_{{cookiecutter.underscored}}.py => {{cookiecutter.slug}}/test/test_{{cookiecutter.slug}}.py (52%) diff --git a/cookiecutter.json b/cookiecutter.json index e79140b..6d94246 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -1,8 +1,7 @@ { "project_name": "", "description": "", - "hyphenated": "{{ '-'.join(cookiecutter['project_name'].lower().split()).replace('_', '-') }}", - "underscored": "{{ cookiecutter.hyphenated.replace('-', '_') }}", + "slug": "{{ '_'.join(cookiecutter['project_name'].lower().split()) }}", "github_username": "", "author_name": "" } diff --git a/{{cookiecutter.underscored}}/.coveragerc b/{{cookiecutter.slug}}/.coveragerc similarity index 100% rename from {{cookiecutter.underscored}}/.coveragerc rename to {{cookiecutter.slug}}/.coveragerc diff --git a/{{cookiecutter.underscored}}/.editorconfig b/{{cookiecutter.slug}}/.editorconfig similarity index 100% rename from {{cookiecutter.underscored}}/.editorconfig rename to {{cookiecutter.slug}}/.editorconfig diff --git a/{{cookiecutter.underscored}}/.flake8 b/{{cookiecutter.slug}}/.flake8 similarity index 100% rename from {{cookiecutter.underscored}}/.flake8 rename to {{cookiecutter.slug}}/.flake8 diff --git a/{{cookiecutter.underscored}}/.github/ISSUE_TEMPLATE.md b/{{cookiecutter.slug}}/.github/ISSUE_TEMPLATE.md similarity index 100% rename from {{cookiecutter.underscored}}/.github/ISSUE_TEMPLATE.md rename to {{cookiecutter.slug}}/.github/ISSUE_TEMPLATE.md diff --git a/{{cookiecutter.underscored}}/.gitignore b/{{cookiecutter.slug}}/.gitignore similarity index 100% rename from {{cookiecutter.underscored}}/.gitignore rename to {{cookiecutter.slug}}/.gitignore diff --git a/{{cookiecutter.underscored}}/.pre-commit-config.yaml b/{{cookiecutter.slug}}/.pre-commit-config.yaml similarity index 100% rename from {{cookiecutter.underscored}}/.pre-commit-config.yaml rename to {{cookiecutter.slug}}/.pre-commit-config.yaml diff --git a/{{cookiecutter.underscored}}/LICENSE b/{{cookiecutter.slug}}/LICENSE similarity index 100% rename from {{cookiecutter.underscored}}/LICENSE rename to {{cookiecutter.slug}}/LICENSE diff --git a/{{cookiecutter.underscored}}/README.md b/{{cookiecutter.slug}}/README.md similarity index 81% rename from {{cookiecutter.underscored}}/README.md rename to {{cookiecutter.slug}}/README.md index 05d723b..1216700 100644 --- a/{{cookiecutter.underscored}}/README.md +++ b/{{cookiecutter.slug}}/README.md @@ -1,7 +1,7 @@ -# {{ cookiecutter.hyphenated }} +# {{ cookiecutter.project_name }} -[![PyPI](https://img.shields.io/pypi/v/{{ cookiecutter.hyphenated }}.svg)](https://pypi.org/project/{{ cookiecutter.hyphenated }}/){% if cookiecutter.github_username %} -[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.hyphenated }}/blob/main/LICENSE){% endif %} +[![PyPI](https://img.shields.io/pypi/v/{{ cookiecutter.slug }}.svg)](https://pypi.org/project/{{ cookiecutter.slug }}/){% if cookiecutter.github_username %} +[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.slug }}/blob/main/LICENSE){% endif %} [![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg)](https://github.com/RichardLitt/standard-readme) > {{ cookiecutter.description }} @@ -15,19 +15,19 @@ Background information goes here. You can install with `pip`: ```sh -pip install {{ cookiecutter.hyphenated }} +pip install {{ cookiecutter.slug }} ``` With `poetry`: ```sh -poetry add {{ cookiecutter.hyphenated }} +poetry add {{ cookiecutter.slug }} ``` Or with `pipenv`: ```sh -pipenv install {{ cookiecutter.hyphenated }} +pipenv install {{ cookiecutter.slug }} ``` ## Usage diff --git a/{{cookiecutter.underscored}}/pyproject.toml b/{{cookiecutter.slug}}/pyproject.toml similarity index 87% rename from {{cookiecutter.underscored}}/pyproject.toml rename to {{cookiecutter.slug}}/pyproject.toml index 917c6f9..c0a78d4 100644 --- a/{{cookiecutter.underscored}}/pyproject.toml +++ b/{{cookiecutter.slug}}/pyproject.toml @@ -1,9 +1,8 @@ [tool.poetry] -name = "{{ cookiecutter.hyphenated }}" -version = "0.0.0" -requires-python = ">=3.11" +name = "{{ cookiecutter.slug }}" +version = "0.0.1" description = "{{ cookiecutter.description or "" }}" -authors = [{name = "{{ cookiecutter.author_name }}"}] +authors = ["{{ cookiecutter.author_name }}"] license = "Apache-2.0" classifiers = [ "License :: OSI Approved :: Apache Software License" @@ -51,7 +50,7 @@ use_parentheses = true line_length = 88 [tool.mypy] -files = ["{{ cookiecutter.hyphenated }}", "test"] +files = ["src/{{ cookiecutter.slug }}", "test"] ignore_missing_imports = false [tool.pytest.ini_options] diff --git a/{{cookiecutter.underscored}}/src/{{cookiecutter.underscored}}/__init__.py b/{{cookiecutter.slug}}/src/{{cookiecutter.slug}}/__init__.py similarity index 100% rename from {{cookiecutter.underscored}}/src/{{cookiecutter.underscored}}/__init__.py rename to {{cookiecutter.slug}}/src/{{cookiecutter.slug}}/__init__.py diff --git a/{{cookiecutter.underscored}}/src/{{cookiecutter.underscored}}/__main__.py b/{{cookiecutter.slug}}/src/{{cookiecutter.slug}}/__main__.py similarity index 100% rename from {{cookiecutter.underscored}}/src/{{cookiecutter.underscored}}/__main__.py rename to {{cookiecutter.slug}}/src/{{cookiecutter.slug}}/__main__.py diff --git a/{{cookiecutter.underscored}}/src/{{cookiecutter.underscored}}/example.py b/{{cookiecutter.slug}}/src/{{cookiecutter.slug}}/example.py similarity index 100% rename from {{cookiecutter.underscored}}/src/{{cookiecutter.underscored}}/example.py rename to {{cookiecutter.slug}}/src/{{cookiecutter.slug}}/example.py diff --git a/{{cookiecutter.underscored}}/tests/test_{{cookiecutter.underscored}}.py b/{{cookiecutter.slug}}/test/test_{{cookiecutter.slug}}.py similarity index 52% rename from {{cookiecutter.underscored}}/tests/test_{{cookiecutter.underscored}}.py rename to {{cookiecutter.slug}}/test/test_{{cookiecutter.slug}}.py index ca3a695..b6bf985 100644 --- a/{{cookiecutter.underscored}}/tests/test_{{cookiecutter.underscored}}.py +++ b/{{cookiecutter.slug}}/test/test_{{cookiecutter.slug}}.py @@ -1,4 +1,4 @@ -from {{ cookiecutter.underscored }} import example_function +from {{ cookiecutter.slug }} import example_function def test_example_function():