super-mario-python
super-mario-python copied to clipboard
feat: move to poetry + pre commit linting
Description
This PR moves from pip requirements to poetry, this way we can ensure that everyone uses same python version and dependecies.
Also adds pre-commit for formatting and linting and be more compliant with code style
Details
- Added
pyproject.tomlfor poetry and remove requirements.txt - Added
.pre-commit-config.yamlas this repository format and linting suite - Added a github action to check if a PR is compliant with pre-commit
- Updated
README.md - pre-commit fixed automatically most of the python and json files to be compliant with the codestyle
About pre-commit checks
General checks
- Avoid users to commit changes in master (even locally)
- Checks that JSON files are valid
- Prettify JSON files (if needed)
- Normalizes end of files and end of lines to avoid trailing whitespaces
- Ensures that the PR doesn't include any line introduced for local debugging
Python Checks
- Code is formatted automatically with
black(codestyle),autoflake(remove unused imports and variables) andisort(import sorting) - Flake8 as general linter
- Mypy for typing checks
@mx0c I can't add you as a reviewer, but let me know if you have any question about this PR.
I only added one github action to check linting, but I think it's a good idea to open at least 2 more to ensure that a PR acomplish the following:
- Run unit tests (need tests first 😄 ) -> With this we can check that every function still doing what we expect from them even if something is changed, also works very good as documentation 😃
- A check that runs
main.pywithout crashing -> The game is still working as expected in the PR - Linting (added in this PR) -> changed code is compliant with the repository codestyle