Skip to content

b1r3k/python-poetry-boilerplate

Repository files navigation

Modern python app boilerplate

Included in this boilerplate:

  • pyenv for python version management
  • poetry for dependency management integrated with pyenv
  • pre-commit for linting and formatting
  • pytest for testing
  • black for formatting
  • flake8 for linting
  • isort for sorting imports
  • mypy for static type checking
  • virtualenv created by poetry resides in .venv folder

How to start

  1. Make sure you have python required interpreter installed in pyenv e.g.
  2. Rename project:
  • Rename app folder to your app name if needed (mv app_name new_app_name) and then:

    find ./ -type f -not -path "./.git/*" -exec sed -i 's/app_name/new_app_name/g' {} \;
    find ./ -type f -not -path "./.git/*" -exec sed -i 's/app-name/new-app-name/g' {} \;
    
  • or use make rename-project NEW_APP_NAME=new_app_name to do it for you

  1. make install
  2. make test
  3. Make sure it's working: poetry run app-cli "Developer"
  4. Optionally, squeeze history into one commit: git reset $(git commit-tree HEAD^{tree} -m "Initial commit")

Other useful commands

  • Check current poetry virtualenv and change it
   $ poetry env info
   $ poetry env list
   $ poetry env remove /home/PATH/bin/python
   $ make install
  • Cherry-pick commit from repository cloned from this one:
   $ git remote add projectB /home/you/projectB
   $ git fetch projectB
   $ git cherry-pick <commit from projectB repo>

About

modern python app boilerplate

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published