diff --git a/copier.yml b/copier.yml index 760d41a..3af4c6a 100644 --- a/copier.yml +++ b/copier.yml @@ -7,6 +7,10 @@ project_slug: type: str help: Your Python package name (should be in `snake_case`) default: "{{ project_name|lower|replace('-', '_')|replace(' ', '_') }}" + validator: | + {% if ('-' in project_slug or ' ' in project_slug) %} + Package name should not contain empty spaces or hyphens + {% endif %} platform: type: str @@ -81,22 +85,8 @@ _jinja_extensions: - jinja2_time.TimeExtension _subdirectory: template -#_exclude: - #- .git - #- .github/ - #- docs/ - #- hooks/ - #- src/ - #- tests/ - #- .gitginore - #- .pre-commit-config.yaml - #- .readthedocs.yml - #- CODE-OF-CONDUCT.md - #- CONTRIBUTING.md - #- cookiecutter.json - #- copier.yml - #- LICENSE - #- LICENSES-bundled.txt - #- noxfile.py - #- pyproject.toml - #- README.md + +_tasks: + - git init -b {{branch}} + - git config user.name {{full_name}} + - git config user.email {{email}} diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py deleted file mode 100644 index 8ad5b9a..0000000 --- a/hooks/post_gen_project.py +++ /dev/null @@ -1,23 +0,0 @@ -import subprocess - -from pathlib import Path - -def prepare_git() -> None: - - git_author_name = "{{full_name}}" - git_author_email = "{{email}}" - git_branch = "{{branch}}" - - # Initialise git - subprocess.call( - ["git", "init", "-b", git_branch] - ) - subprocess.call( - ["git", "config", "user.name", git_author_name] - ) - subprocess.call( - ["git", "config", "user.email", git_author_email] - ) - -if __name__ == "__main__": - prepare_git() diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index 2af78f6..604673e 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -100,6 +100,9 @@ envs.default.dependencies = [ {%- if backend == "hatch" and vcs == false %} [tool.hatch.version] path = "src/{{ project_slug }}/__init__.py" + +[tool.hatch.build.targets.wheel] +packages = ["src/{{ project_slug }}"] {%- endif %} {# keep this line here for newline #} {%- if mypy %}