magnet-cl / django-project-template

A project template for Django in python 3
MIT License
14 stars 8 forks source link

feat: refactor ci steps and add pre-commit validations #124

Open KnowYourselves opened 2 years ago

KnowYourselves commented 2 years ago

What is being added

This PR refactors the CI steps executed by CircleCI and adds a new series of pre-commit and pre-push validations by using git hooks, husky, and pre-commit (python package).

The following packages are being used:

The CI steps are changed in the following ways:

How is everything configured

pyproject.toml

The last two years a new settings format, pyproject.toml has been gaining traction.

Now we can configure a lot of python-only tools (like poetry) in this file. For example, all the isort configuration is in this file under [tools.isort], which allows the dev to simply use isort isntead of a really long line of flags and configs. If we where to configure black, we would use this file too.

Pytest added support for this format on its 6.0.0 version, since we are already on that version I moved the configuration to this file.

The only problem with this setup is that flake8 doesn't support this config file.

TO-DO

Flake8 is a good linter as is, but we would have to add another file to configure it. If we where to use another linter, for example, pylint, that supports pyproject.toml, we could have all our python-only config in just one file.