Skip to content
/ template-poetry Public template

Full-featured, very opinionated template for Python projects

Notifications You must be signed in to change notification settings

Steffo99/template-poetry

Repository files navigation

Steffo's Python Template

Full-featured, very opinionated template for Python projects

Features

Usage

This template is intended to be used with pipx and cookiecutter.

To initialize a new project with this template, follow the instructions in the next sections.

Pre-requisites

  1. Install pipx following the instructions for your platform.

  2. Install cookiecutter using pipx:

    $ pipx install cookiecutter

Project creation

  1. Use cookiecutter to initialize a new project, then answer the questions to fill in the template:

    $ cookiecutter gh:Steffo99/template-poetry
    project_name [example-project]: 
    project_identifier [example_project]: 
    Select project_type:
    1 - application
    2 - library
    Choose from 1, 2 [1]: 
    project_description [A demo of Steffo99/template-poetry]: 
    Select project_docs:
    1 - sphinx
    2 - none
    Choose from 1, 2 [1]: 
    Select project_tests:
    1 - compileall
    2 - none
    3 - pytest
    Choose from 1, 2, 3 [1]:
    project_license [AGPL-3.0-or-later]: 
    project_author_name [Firstname Lastname]: 
    project_author_email [somebody@example.org]: 
    project_author_full [Firstname Lastname <somebody@example.org>]: 
    docs_theme_color [#123abc]: 
    github_owner [ghost]: 
  2. Access the created directory:

    $ cd example-project
  3. Initialize a Git repository in it:

    $ git init
    $ git add .
    $ git commit --message "First commit"
  4. Create a new repository on GitHub for it, either via the web interface or via gh, then add it as a remote on your local copy of the repository and force push to it:

    $ gh repo create --public --template Steffo99/template-poetry example-project
    $ git remote add origin git@github.com:ghost/example-project.git
    $ git push --force --set-upstream origin main

Publishing

  1. Create an API token on PyPI and set it on GitHub as the PYPI_TOKEN repository secret.

Documentation

  1. Register your project on Read the Docs.

Deploying

  1. Create a stack on [Portainer], configure it to be updated via webhook, and set the webhook URL on GitHub as the PORTAINER_HOOK_URL repository secret.