From d5157de05868ea72f75752093fd628c7565aef9d Mon Sep 17 00:00:00 2001 From: Laurent Monin Date: Thu, 7 Sep 2023 17:39:06 +0200 Subject: [PATCH 1/3] Fix `isort` config Fix following error occuring with isort v5+: ERROR: Found resources import while parsing, but FIRSTPARTY was not included in the `sections` setting of your config. Please add it before continuing See https://pycqa.github.io/isort/#custom-sections-and-ordering for more info. --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a87c87308b..faaf2e62ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,10 +4,11 @@ build-backend = "setuptools.build_meta" [tool.isort] sections = [ - "FUTURE", "STDLIB", "THIRDPARTY", "QT", "TEST", "PICARD", "LOCALFOLDER", + "FUTURE", "STDLIB", "FIRSTPARTY", "THIRDPARTY", "QT", "TEST", "PICARD", "LOCALFOLDER", "RESOURCES", "PICARD_UI" ] default_section = "LOCALFOLDER" +known_first_party = [] known_picard = ["picard"] known_picard_ui = ["picard.ui"] known_qt = ["PyQt5"] From 9a688f25b5fa61411ad8707b1d36989853ecbe33 Mon Sep 17 00:00:00 2001 From: Laurent Monin Date: Thu, 7 Sep 2023 17:39:46 +0200 Subject: [PATCH 2/3] Update isort command and link --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 30f6d33f41..f8769543d5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,7 +16,7 @@ Developers may install few extra tools using: pip install -r requirements-dev.txt ``` -To fix or preserve imports style, one can use `isort -rc .` command (requires the [isort](https://github.com/timothycrosley/isort) tool, see `.isort.cfg`). +To fix or preserve imports style, one can use `isort .` command (requires the [isort](https://github.com/PyCQA/isort) tool, see `.isort.cfg`). It is recommended to add a pre-commit hook to check whether imports in changed code follow the conventions. Add a file `.git/hooks/pre-commit` with the following content From 46e554c533308e07362b6f9de151edfb17aac2a0 Mon Sep 17 00:00:00 2001 From: Laurent Monin Date: Thu, 7 Sep 2023 17:40:09 +0200 Subject: [PATCH 3/3] Apply isort changes to setup.py --- setup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 2e3998d7aa..73b108be68 100644 --- a/setup.py +++ b/setup.py @@ -57,6 +57,7 @@ from setuptools.command.install import install from setuptools.dist import Distribution + try: from setuptools.command.build import build except ImportError: @@ -401,7 +402,10 @@ def compile_ui(uifile, pyfile): if newer(uifile, pyfile): compile_ui(uifile, pyfile) - from resources import compile, makeqrc + from resources import ( + compile, + makeqrc, + ) makeqrc.main() compile.main()