Skip to content

diflores/poetry-python-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Template

I built this repository to have a template for all my Python projects. It uses Poetry for managing dependencies and pre-commit to avoid commits with violations to linter rules.

How to use

  1. Install Poetry:
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
  1. Install requirements with: poetry install.

Customize

  1. You can change the name of your project editing the second line of pyproject.toml. Example: name = "my-awesome-project". Don't use spaces, or you'll get a syntax error.
  2. To add a new dependency, run poetry add name-of-your-dependency. Example poetry add pandas. It will update pyproject.toml and poetry.lock. You must include poetry.lock on git, since it will assure that you and your team have the same version of every package of your project.
  3. For running anything using Poetry virtualenv, use poetry run. Example poetry run my_script.py.
  4. If you want to adapt some linter rule to your project, edit setup.cfg.

Optional: pre-commit hook

In order to mantain an optimal code quality, you can use the .pre-commit-config.yaml file to setup a git pre-commit hook. It won't let you commit if your code violates some of the rules specified in the setup.cfg file. If you want to use it, run poetry run pre-commit install.

About

A template for all my Python Projects, with Poetry and pre-commit hooks.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published