pygeoapi
pygeoapi copied to clipboard
Dev style adoption
Is your feature request related to a problem? Please describe. It has been requested several times in different places to adopt a clear and concise set of best-practices for python developers. Let's open the discussion with some proposals about new tools. For reference, there is one previous issue #288
Describe the solution you'd like We are already using Flake8, pytest and sphinx.
We'd like to evaluate the use of the following eventually:
- Black - Uncompromisingly eliminating all ambiguity about where to put whitespace in python code. Black has moved under the Python Software Foundation umbrella in 2019, which is a strong endorsement.
- Pylint - It gives specific feedback to improve the code and how to better comply with conventions.
- pre-commit - Checking for linter errors even one more time before committing to your local git clone and pushing to a PR.
More importantly Poetry and its use of pyproject.toml PEP 518 which could be, in the most optimistic future, the Python's npm to evolve the tooling for dependencies management.
Describe alternatives you've considered Leave the tooling as it is
Additional context
workflow guidelines and code structure recommendations: https://github.com/geopython/pygeoapi/wiki/Code-development-workflow
@francbartoli has there been any progress on this matter?
Also, adding a simple devcontainer configuration could be useful for this project, so that the contributors participating in the project would have an identical development environment with all the necessary binaries, libraries and utilities.
Might I suggest ruff instead of pylint? isort is also nice.
I am using black+isort+ruff+pre-commit for my projects. Here is the template: https://github.com/NINAnor/nina-template-python Please notice that pyproject.toml includes a couple of lines to make them work together nicely.
After many frustrating situations in which I had to commit stuff with messages like 'fixed flake8 issue' after seeing CI turn red, I decided to add a .pre-commit-config.yaml
file with a standard flake8
hook. Proposed as #1508.
If the PR is merged, and there is some more traction to this discussion, I would be willing to add additional PRs with this type of DX-oriented stuff. IMO ruff and poetry would be two great additions.
This Issue has been inactive for 90 days. As per RFC4, in order to manage maintenance burden, it will be automatically closed in 7 days.
ruff can replace black, pylint, flake.
Poetry can be avoided when using regular pyproject.toml
file + pip-freezed dependencies within a regular venv, if needed.