Skip to content

Python3 cookiecutter template + integration with: (github-docs-cookiecutter) Github docs & (sphinx-cookiecutter) Sphinx docs template generation.

License

Notifications You must be signed in to change notification settings

jcook3701/python3-cookiecutter

python3-cookiecutter

Author: Jared Cook
Version: 0.1.0

Overview

Python3 cookiecutter template project + Github docs template generation + Sphinx docs template generation.


dependency-check format-check lint-check security-audit spellcheck tests typecheck


Note: Unless you are using a newer version of cookiecutter >= 2, --no-input is necessary for template generation without error.

Usage Examples:

Example: Pull from main branch.
Note: Nutri-Matic is needed in active python environment.

  1. Pull Project with cookiecutter command:
$ cookiecutter git@github.com:jcook3701/python3-cookiecutter.git \
	--no-input \
	project_name="test-project"  

Example: Pull from develop branch.

  1. Pull code from development branch while testing updates.
$ cookiecutter git@github.com:jcook3701/python3-cookiecutter.git \
	 --checkout develop \
	  --no-input \
	  project_name="test-project"

replace test-project or any of the other variables with real context configuration variables:

Note: replace test-project or any of the other variables with real context configuration variables.


Development Strategy:

Note: All Makefile commands are used in ci/cd to ensure that if they pass locally they should also pass once pushed to github.

🐍️ Build environment (.venv)

$ make install

🧬 Dependency Management (deptry)

$ make dependency-check

🛡️ Security Audit (pip-audit)

$ make security

🎨 Formatting (black)

$ make format-check
$ make format-fix

🔍 Linting (jinja2-cli, ruff, tomllint, & yaml-lint)

$ make lint-check
$ make lint-fix

🎓 Spellchecking (codespell)

$ make spellcheck

🧠 Typechecking (mypy)

$ make typecheck

🧪 Testing (pytest)

$ make test

🚀 Release (git tag)

$ make release

❓ Build Help

$ make help

Commit Help:

Note: Commits are required to be conventional git commit message. This helps with the auto-generation of the changelog files and is enforced by pre-commit.
example:

<type>[optional scope]: <description>

[optional body]

[optional footer(s)]

  • <type>: A required noun that describes the nature of the change.
  • [optional scope]: An optional phrase within parentheses that specifies the part of the codebase being affected (e.g., fix(parser):).
  • <description>: A required short, imperative-mood summary of the changes.
  • [optional body]: A longer description providing additional context and “what and why” details.
  • [optional footer(s)]: Used for adding meta-information, such as issue references (Fixes #123) or indicating breaking changes.

Requirements:

Python 3.11

$ sudo apt install python3.11

Nutri-Matic
Note: This is needed for the cookiecutter hooks to run correctly. Without this package installed in active python environment cookiecutter pull will fail.

$ pip install nutri-matic

rustup
Note: I found that it is easiest to use rustup to manage rustc and cargo but this is not required.
Example: Install rustup with the following:

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

git-cliff
Note: git-cliff can generate changelog files from the Git history by utilizing conventional commits as well as regex-powered custom parsers.

$ cargo install git-cliff

Future Ideas:

  1. Organizing cookiecutters in directories
    • Add freecad paths for freecad projects.
    • etc.
  2. Create python repository to make it easy to swap nested vars but might eventually use newer version of cookiecutter from pypi.
  3. Update configuration file to include or disclude the Dockerfile (Only needed for a webapp)
  4. Create separate repo to utilize cookiecutter 1.7 with custom json config in order to update pyproject.toml variables in ‘config’ variable.

Authors Notes:

  1. This code currently works with cookiecutter 1.7 from Ubuntu’s apt repositories.

About

Python3 cookiecutter template + integration with: (github-docs-cookiecutter) Github docs & (sphinx-cookiecutter) Sphinx docs template generation.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published