pygeoapi icon indicating copy to clipboard operation
pygeoapi copied to clipboard

Dev style adoption

Open francbartoli opened this issue 4 years ago • 8 comments

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

francbartoli avatar Dec 21 '20 17:12 francbartoli

workflow guidelines and code structure recommendations: https://github.com/geopython/pygeoapi/wiki/Code-development-workflow

jorgejesus avatar Dec 21 '20 18:12 jorgejesus

@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.

solismaam avatar Oct 17 '22 11:10 solismaam

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.

frafra avatar Jan 10 '23 12:01 frafra

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.

ricardogsilva avatar Jan 19 '24 16:01 ricardogsilva

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.

github-actions[bot] avatar Apr 21 '24 03:04 github-actions[bot]

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.

frafra avatar Apr 21 '24 17:04 frafra