Skip to content

Generate a Project#

copier copy --trust https://github.com/sidisinsane/copier-python-hatch-template.git PATH/TO/DESTINATION

or

copier copy --trust gh:sidisinsane/copier-python-hatch-template PATH/TO/DESTINATION
Note

You can also clone the project template using git clone https://github.com/sidisinsane/copier-python-hatch-template.git, modify it and generate a project the locally cloned repo.

copier copy --trust PATH/TO/CLONED/PROJECT/TEMPLATE PATH/TO/DESTINATION

Prompts#

Copier will request your input for some prompts. Prompts are configured in the copier.yml file.

Note

This template only supports GitHub as repository provider!

project_name#

๐ŸŽค Your project name (main heading)
  [None]
Configuration
project_name:
type: str
help: Your project name (main heading)

project_description#

๐ŸŽค Your project description (main description)
  [None]
Configuration
project_description:
type: str
help: Your project description (main description)

author_fullname#

๐ŸŽค Your full name (project.authors.name in pyproject.toml)
  ['Dirk Sidney Jansen' | git_user_name]

Note

The git_user_name variable is handled by the custom Jinja2 extension at extensions/git.py.

Configuration
author_fullname:
type: str
help: Your full name (project.authors.name in pyproject.toml)
default: "{{ 'Dirk Sidney Jansen' | git_user_name }}"

author_email#

๐ŸŽค Your email (project.authors.email in pyproject.toml)
  ['sidisinsane@users.noreply.github.com' | git_user_email]

Note

The git_user_email variable is handled by the custom Jinja2 extension at extensions/git.py.

Configuration
author_email:
type: str
help: Your email (project.authors.email in pyproject.toml)
default: "{{ 'sidisinsane@users.noreply.github.com' | git_user_email }}"

author_username#

๐ŸŽค Your GitHub username
  [sidisinsane]
Configuration
author_username:
type: str
help: Your GitHub username
default: sidisinsane

repository_provider#

๐ŸŽค Your repository provider
ยป github.com
Configuration
repository_provider:
type: str
help: Your repository provider
default: github.com
choices:
    - github.com

repository_namespace#

๐ŸŽค Your repository namespace
  [author_username] 
Configuration
repository_namespace:
type: str
help: Your repository namespace
default: "{{ author_username }}"

repository_name#

๐ŸŽค Your repository name
  [project_name | slugify]

Note

The slugify method is handled by the custom Jinja2 extension at extensions/slugify.py.

Configuration
repository_name:
type: str
help: Your repository name
default: "{{ project_name | slugify }}"
๐ŸŽค The name of the person/entity holding the copyright
  [author_fullname]
Configuration
copyright_holder:
type: str
help: The name of the person/entity holding the copyright
default: "{{ author_fullname }}"
๐ŸŽค The email of the person/entity holding the copyright
  [author_email]
Configuration
copyright_holder_email:
type: str
help: The email of the person/entity holding the copyright
default: "{{ author_email }}"
๐ŸŽค The copyright date
  [current_year]

Note

The current_year variable is handled by the custom Jinja2 extension at date/git.py.

Configuration
copyright_date:
type: str
help: The copyright date
default: "{{ current_year }}"
๐ŸŽค Your project's license
  (Use arrow keys)
  Apache-2.0
  BSD-2-Clause
  BSD-3-Clause
  CDDL-1.0
  EPL-2.0
  GPL-2.0
  GPL-3.0-only
  ISC
  LGPL-2.0-only
  LGPL-2.1
  LGPL-3.0-only
ยป MIT
  MPL-2.0 
Configuration
copyright_license:
type: str
help: Your project's license
default: MIT
choices:
- Apache-2.0
- BSD-2-Clause
- BSD-3-Clause
- CDDL-1.0
- EPL-2.0
- GPL-2.0
- GPL-3.0-only
- ISC
- LGPL-2.0-only
- LGPL-2.1
- LGPL-3.0-only
- MIT
- MPL-2.0

Note

To add more licenses, add the SPDX identifier to the copier.yml and the license text to the project/LICENSE.jinja file. License texts can be found at choosealicense.com.

python_package_distribution_name#

๐ŸŽค Your Python package distribution name (for `pip install NAME`)
  [project_name | slugify]
Configuration
python_package_distribution_name:
type: str
help: Your Python package distribution name
default: "{{ project_name | slugify }}"

The name under which your Python package will be distributed. This will be the name of your project on pypi.org for example.

python_package_import_name#

๐ŸŽค Your Python package import name (for `import NAME` in Python code)
  [project_name | slugify('_')]
Configuration
python_package_import_name:
type: str
help: Your Python package import name (for `import NAME` in Python code)
default: "{{ project_name | slugify('_') }}"

The name that will be used to import your package in Python code. Yes, distribution name and import name can be different!

python_package_command_line_name#

๐ŸŽค Your CLI name if any (for use in the shell)
  [project_name | slugify] 
Configuration
python_package_command_line_name:
type: str
help: Your CLI name if any (for use in the shell)
default: "{{ project_name | slugify }}"

Output#

Copying from template version 0.0.0.post14.dev0+b7759ea
    create  .
    create  bandit.yml
    create  .pylintrc
    create  mkdocs.yml
    create  pytest.ini
    create  .pre-commit-config.yaml
    create  README.md
    create  tests
    create  tests/test_calc.py
    create  tests/__init__.py
    create  .coveragerc
    create  LICENSE
    create  mypy.ini
    create  .gitignore
    create  .github
    create  .github/workflows
    create  .github/workflows/test.yml
    create  .github/workflows/codeql.yml
    create  .github/workflows/ci.yml
    create  .github/workflows/gh-pages-deploy.yml
    create  commitlint.config.js
    create  mkdocs
    create  mkdocs/license.md
    create  mkdocs/images
    create  mkdocs/images/logo.svg
    create  mkdocs/images/favicon.svg
    create  mkdocs/index.md
    create  mkdocs/javascripts
    create  mkdocs/javascripts/mathjax.js
    create  .vscode
    create  .vscode/settings.json
    create  .vscode/extensions.json
    create  .markdownlint.yml
    create  pyproject.toml
    create  src
    create  src/PYTHON_PACKAGE_IMPORT_NAME
    create  src/PYTHON_PACKAGE_IMPORT_NAME/__init__.py
    create  src/PYTHON_PACKAGE_IMPORT_NAME/calc.py
    create  src/PYTHON_PACKAGE_IMPORT_NAME/__about__.py

The generated project will have the following structure in the specified directory:

PYTHON-PACKAGE-DISTRIBUTION-NAME
โ”œโ”€โ”€ .github
โ”‚   โ””โ”€โ”€ workflows
โ”‚       โ”œโ”€โ”€ ci.yml
โ”‚       โ”œโ”€โ”€ codeql.yml
โ”‚       โ”œโ”€โ”€ gh-pages-deploy.yml
โ”‚       โ””โ”€โ”€ test.yml
โ”œโ”€โ”€ .vscode
โ”‚   โ”œโ”€โ”€ extensions.json
โ”‚   โ””โ”€โ”€ settings.json
โ”œโ”€โ”€ mkdocs
โ”‚   โ”œโ”€โ”€ images
โ”‚   โ”‚   โ”œโ”€โ”€ favicon.svg
โ”‚   โ”‚   โ””โ”€โ”€ logo.svg
โ”‚   โ”œโ”€โ”€ javascripts
โ”‚   โ”‚   โ””โ”€โ”€ mathjax.js
โ”‚   โ”œโ”€โ”€ index.md
โ”‚   โ””โ”€โ”€ license.md
โ”œโ”€โ”€ src
โ”‚   โ””โ”€โ”€ PYTHON_PACKAGE_IMPORT_NAME
โ”‚       โ”œโ”€โ”€ __about__.py
โ”‚       โ”œโ”€โ”€ __init__.py
โ”‚       โ””โ”€โ”€ calc.py
โ”œโ”€โ”€ tests
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ test_calc.py
โ”œโ”€โ”€ .coveragerc
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ .markdownlint.yml
โ”œโ”€โ”€ .pre-commit-config.yaml
โ”œโ”€โ”€ .pylintrc
โ”œโ”€โ”€ bandit.yml
โ”œโ”€โ”€ commitlint.config.js
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ mkdocs.yml
โ”œโ”€โ”€ mypy.ini
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ pytest.ini
โ””โ”€โ”€ README.md