Package: pypj
pypjprovides you a modern python project template. All the basic dev package installations, their configurations, and test workflows will be done, so you can focus on coding.What will be providedWhat the"Modern"means is expressed as following directory structure. Some developers prefer another tools, and you can remove or customize the tools to be prepared. Most of all configurations regarding the code style tools, like formatter and linter, are aggregated inpyproject.toml.my-package/
├── .github
│   ├── dependabot.yml       # Dependency updater
│   └── workflows
│       ├── publish.yml      # Tagging on GitHub triggers publishing to Pypi
│       └── unittest.yml     # On each push and PR, execute the unittest
├── .pre-commit-config.yaml  # Checks format and styles of each file
├── .venv                    # venv can be outside of project directory
├── .vscode
│   └── settings.json        # Format, Lint, Type check and Import sort on save
├── Makefile                 # Useful command alias
├── README.md                # How to start with pypj
├── my-package               # Your package, can be "src"
├── poetry.lock
├── pyproject.toml           # Configured settings
└── testsDeveloping tools pypj providesPackage manager:poetryFormatter:blackLinter:pflake8(*1)Plugin:flake8-bugbearType checker:mypyImport sorter:isortTest framework:pytestpytest-covpytest-mocktoxtox-gh-actionsGit hooks manager:pre-commit(*1)pflake8wrapsflake8to aggregate settings topyproject.tomlCoding format pypj providesMax line length:119as defaultType hinting:requiredAnd some detailed configurationsCustomizeHere is an actual interaction to customize.Package name: my-package
Do you want to customize settings? (y/N): y
Max line length (119):
Use src directory (y/N):
Keep venv in project (Y/n):
Use github workflows (Y/n):
Use vscode settings (Y/n):
Use pre-commit (Y/n):
Use command alias as Makefile (Y/n):
Are you sure? (Y/n): yOther featuresSingle filed configurations onpyproject.tomlSingle sourced versioning:single-sourceCommand alias:makeCI/CDunittest workflowpublish package workflowdependency updater configurationRequirementspython3poetry[Installation guide]InstallationpipinstallpypjUsageSee alsoREADME.mdwhich will be generated withpypjcommand, it shows more actual usage.$ pypj

┌─┐┬ ┬┌─┐┬
├─┘└┬┘├─┘│    python : 3.8.5
┴   ┴ ┴ └┘    poetry : 1.1.8

Package name: my-package
Do you want to customize settings? (y/N): N
Do you want to proceed? (y/N): y
Task: Initialize package: my-package
      Command: poetry new my-package ✨
      Poetry new done 🚀
      Command: poetry config virtualenvs.in-project true ✨
      Command: poetry add -D black ✨
      Command: poetry add -D pyproject-flake8 ✨
      Command: poetry add -D mypy ✨
      Command: poetry add -D isort ✨
      Command: poetry add -D pytest ✨
      Command: poetry add -D tox ✨
      Command: poetry add -D pytest-cov ✨
      Command: poetry add -D pytest-mock ✨
      Command: poetry add -D tox-gh-actions ✨
      Configure: __init__.py  ✨
      Create : my-package ✨
Task: Create README.md
      Create : README.md ✨
Task: Configure pyproject.toml settings
      Write  : pyproject.toml ✨
Task: Create github actions
      Create : unittest.yml ✨
      Create : publish.yml ✨
      Create : dependabot.yml ✨
Task: Configure vscode settings
      Create : .vscode/settings.json ✨
Task: Create makefile
      Create : Makefile ✨
Task: Configure pre-commit
      Create : .pre-commit-config.yaml ✨

Complete! 🚀
Let's make the world better! ✨😋🐍🌎Example configurations onpyproject.tomlWith default setting, this kind ofpyproject.tomlfile will be generated.[tool.poetry]name="my-package"version="0.1.0"description=""authors=["you <you@example.com>"][tool.poetry.dependencies]python="^3.8"[tool.poetry.dev-dependencies]pytest="^5.2"black="^21.8b0"pyproject-flake8="^0.0.1-alpha.2"mypy="^0.910"isort="^5.9.3"tox="^3.24.3"pytest-cov="^2.12.1"pytest-mock="^3.6.1"tox-gh-actions="^2.7.0"[build-system]requires=["poetry-core>=1.0.0"]build-backend="poetry.core.masonry.api"[tool.black]line-length=119exclude='''(migrations| .mypy_cache| .pytest_cache| .tox| .venv| dist)'''[tool.flake8]max-line-length=119max-complexity=10select="C,E,F,W,B"ignore="E203"[tool.mypy]# commonpython_version=3.8show_column_numbers=trueshow_error_context=trueignore_missing_imports=truecheck_untyped_defs=truedisallow_untyped_defs=true# warningwarn_return_any=truewarn_unused_configs=truewarn_redundant_casts=true[tool.isort]profile="black"line_length=119[tool.tox]legacy_tox_ini="""[tox]envlist = py38, flake8, black, mypy, isortskipsdist = trueisolated_build = trueskip_missing_interpreters = true[testenv]whitelist_externals = poetryrequire_locked_deps = trueinstall_dev_deps = truecommands =poetry install -vv --no-rootpytest ./tests -v --cov=pypj --cov-branch --durations=0[testenv:flake8]commands = poetry run pflake8 ./my-package[testenv:black]commands = poetry run black ./my-package[testenv:mypy]commands = poetry run mypy ./my-package[testenv:isort]commands = poetry run isort ./my-package"""Alias as Makefile.PHONY:installupdatecleanbuildrundebugteststylePACKAGE:=$(shellgrepnamepyproject.toml-m1|awk-F" "'{print $$3}')VERSION:=$(shellgrepversionpyproject.toml-m1|awk-F" "'{print $$3}')install:poetryinstallpoetryrunpre-commitinstallupdate:poetryupdatepoetryrunpre-commitautoupdateclean:rm-rfdistbuild:cleanpoetrybuildrun:poetryrun${PACKAGE}# Just in case the package provides a commanddebug:poetryrunpytest./tests-s-v--cov=pypj--cov-branch--durations=0test:poetryruntoxstyle:poetryruntox-eblack,flake8,mypy,isortSupported python versionsSupported:3.8,3.9,3.10Not supported:3.7or lessNOTE: According toStatus of Python branches, the EoL of Python 3.7 is2023-06-27.FAQIs there any restrictions regarding the package naming?A name of python package is defined atPEP-008 #Package and Module Namesand it can be expressed as regex:/^[a-zA-Z][0-9a-zA-Z\-_]*/.pypjfollows this rule.Can I use current git initialized directory as a package root?NO. Instead of that, you can initialize the generated package directory with git.git initgit remote add origin https://github.com/USER/my-repository.gitgit push -u origin main