Skip to content

Commit 2a4e34b

Browse files
authored
Merge pull request #34 from GispoCoding/update-lint-dependencies
Upgrade development and linting dependencies
2 parents 97ca84d + f94d6d8 commit 2a4e34b

9 files changed

+179
-50
lines changed

.flake8

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
# Black compatible values https://black.readthedocs.io/en/stable/compatible_configs.html#flake8
33
max-line-length = 88
44
extend-ignore =
5-
E203, # whitespace before ':'
6-
ANN101 # Missing type annotation for self in method
5+
# E203: whitespace before ':'
6+
E203,
7+
# ANN101: Missing type annotation for self in method
8+
ANN101

.github/workflows/code-style.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ jobs:
99
pre-commit:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v2
13-
- uses: actions/setup-python@v2
14-
- uses: pre-commit/[email protected]
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-python@v4
14+
with:
15+
python-version: "3.9"
16+
cache: pip
17+
- uses: pre-commit/[email protected]

.github/workflows/tests.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,22 @@ jobs:
1616
strategy:
1717
matrix:
1818
# Remove unsupported versions and add more versions. Use LTR version in the cov_tests job
19-
docker_tags: [release-3_10, release-3_16, latest]
19+
docker_tags: [release-3_28, latest]
2020
fail-fast: false
2121

2222
# Steps represent a sequence of tasks that will be executed as part of the job
2323
steps:
2424
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
25-
- uses: actions/checkout@v2
25+
- uses: actions/checkout@v4
2626
with:
2727
submodules: true
2828

29+
- uses: actions/setup-python@v4
30+
with:
31+
cache: pip
32+
- run: pip install pip-tools
33+
- run: pip-compile requirements-dev.in
34+
2935
- name: Pull qgis
3036
run: docker pull qgis/qgis:${{ matrix.docker_tags }}
3137

@@ -62,7 +68,7 @@ jobs:
6268
- name: Run tests
6369
shell: pwsh
6470
run: |
65-
$env:PATH="C:\Program Files\QGIS 3.16\bin;$env:PATH"
71+
$env:PATH=(Get-ChildItem -Path "C:\Program Files" -Directory QGIS*).FullName +"\bin;$env:PATH"
6672
$env:QGIS_PLUGIN_IN_CI=1
6773
python-qgis-ltr.bat -m pip install -qr requirements-dev.txt
6874
python-qgis-ltr.bat -m pytest -v

.pre-commit-config.yaml

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.0.1
5+
rev: v4.5.0
66
hooks:
77
- id: trailing-whitespace
88
- id: end-of-file-fixer
99
- id: check-yaml
1010
- id: check-added-large-files
1111
- repo: https://github.com/PyCQA/isort
12-
rev: 5.9.3
12+
rev: 5.12.0
1313
hooks:
1414
- id: isort
1515
- repo: https://github.com/psf/black
16-
rev: 21.7b0
16+
rev: 23.11.0
1717
hooks:
1818
- id: black
1919
- repo: https://github.com/PyCQA/flake8
20-
rev: 3.9.2
20+
rev: 6.1.0
2121
hooks:
2222
- id: flake8
2323
additional_dependencies:
24-
- flake8-bugbear~=21.4.3
25-
- pep8-naming~=0.12.1
26-
- flake8-qgis>=0.1.4
24+
- flake8-bugbear~=23.9.16
25+
- pep8-naming~=0.13.3
26+
- flake8-qgis>=1.0.0

.qgis-plugin-ci

-5
This file was deleted.

nlsgpkgloader/nls_geopackage_loader.py

+16-18
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def __init__(self):
8989

9090
# Declare instance attributes
9191
self.actions = []
92-
self.menu = self.tr(u"&NLS GeoPackage Downloader")
92+
self.menu = self.tr("&NLS GeoPackage Downloader")
9393

9494
# Check if plugin was started the first time in current QGIS session
9595
# Must be set in initGui() to survive plugin reloads
@@ -200,7 +200,7 @@ def initGui(self): # noqa N802
200200

201201
self.add_action(
202202
resources_path("icons", "icon.png"),
203-
text=self.tr(u"NLS GeoPackage Downloader"),
203+
text=self.tr("NLS GeoPackage Downloader"),
204204
callback=self.run,
205205
parent=self.iface.mainWindow(),
206206
)
@@ -220,7 +220,7 @@ def _migrate_settings():
220220
def unload(self):
221221
"""Removes the plugin menu item and icon from QGIS GUI."""
222222
for action in self.actions:
223-
self.iface.removePluginMenu(self.tr(u"&NLS GeoPackage Downloader"), action)
223+
self.iface.removePluginMenu(self.tr("&NLS GeoPackage Downloader"), action)
224224
self.iface.removeToolBarIcon(action)
225225

226226
def run(self):
@@ -249,8 +249,8 @@ def run(self):
249249
if not self.load_layers():
250250
QMessageBox.critical(
251251
self.iface.mainWindow(),
252-
self.tr(u"Failed to load data"),
253-
self.tr(u"Check that necessary files exist in data folder"),
252+
self.tr("Failed to load data"),
253+
self.tr("Check that necessary files exist in data folder"),
254254
)
255255
return
256256

@@ -292,8 +292,8 @@ def run(self):
292292
if self.fileName == "":
293293
QMessageBox.critical(
294294
self.iface.mainWindow(),
295-
self.tr(u"Invalid filename"),
296-
self.tr(u"Please enter a filename"),
295+
self.tr("Invalid filename"),
296+
self.tr("Please enter a filename"),
297297
)
298298
return
299299
if self.fileName.split(".")[-1].lower() != "gpkg":
@@ -391,8 +391,8 @@ def run(self):
391391
self.progress_dialog.hide()
392392
QMessageBox.critical(
393393
self.iface.mainWindow(),
394-
self.tr(u"Invalid selection"),
395-
self.tr(u"Found nothing to download!"),
394+
self.tr("Invalid selection"),
395+
self.tr("Found nothing to download!"),
396396
)
397397
return
398398

@@ -673,7 +673,7 @@ def get_intersecting_features(self, features, layer, selected_mun_names=None):
673673
if selected_mun_names:
674674
expression = ""
675675
for mun in selected_mun_names:
676-
expression += u'"NAMEFIN" = \'' + mun + u"' OR "
676+
expression += '"NAMEFIN" = \'' + mun + "' OR "
677677
expression = expression[:-4]
678678

679679
iter = self.municipality_layer.getFeatures(expression)
@@ -694,7 +694,6 @@ def get_intersecting_features(self, features, layer, selected_mun_names=None):
694694
self.utm25lr_features.append(layer_feature)
695695

696696
def download_data(self, product_types):
697-
698697
self.all_urls = []
699698
self.total_download_count = 0
700699
self.download_count = 0
@@ -858,9 +857,8 @@ def finish_processing(self):
858857
)
859858
)
860859
self.iface.messageBar().pushMessage(
861-
self.tr(u"GeoPackage creation finished"),
862-
self.tr(u"NLS data download finished. Data located under ")
863-
+ self.gpkg_path,
860+
self.tr("GeoPackage creation finished"),
861+
self.tr("NLS data download finished. Data located under ") + self.gpkg_path,
864862
level=3,
865863
)
866864
self.progress_dialog.hide()
@@ -887,8 +885,8 @@ def show_settings_dialog(self):
887885
# cannot work without the key, so user needs to be notified
888886
QMessageBox.critical(
889887
self.iface.mainWindow(),
890-
self.tr(u"User-key is needed"),
891-
self.tr(u"Data cannot be downloaded without the NLS key"),
888+
self.tr("User-key is needed"),
889+
self.tr("Data cannot be downloaded without the NLS key"),
892890
)
893891
return False
894892
self.data_download_dir = (
@@ -903,8 +901,8 @@ def show_settings_dialog(self):
903901
# cannot work without the key, so user needs to be notified
904902
QMessageBox.critical(
905903
self.iface.mainWindow(),
906-
self.tr(u"User-key is needed"),
907-
self.tr(u"Data cannot be downloaded without the NLS key"),
904+
self.tr("User-key is needed"),
905+
self.tr("Data cannot be downloaded without the NLS key"),
908906
)
909907
return False
910908

pyproject.toml

+5
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,8 @@ testpaths = "tests"
1717

1818
[tool.coverage.report]
1919
omit = ["nlsgpkgloader/qgis_plugin_tools/*"]
20+
21+
[tool.qgis-plugin-ci]
22+
plugin_path = "nlsgpkgloader"
23+
github_organization_slug = "GispoCoding"
24+
project_slug = "NLSgpkgloader"

requirements-dev.in

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
pip-tools
2+
3+
# Testing
4+
pytest
5+
pytest-cov
6+
pytest-qgis
7+
8+
# Linting and formatting
9+
pre-commit
10+
black
11+
isort
12+
flake8
13+
flake8-bugbear
14+
pep8-naming
15+
flake8-qgis
16+
PyQt5-stubs

requirements-dev.txt

+116-12
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,117 @@
1-
# Testing
2-
pytest~=6.2.3
3-
pytest-cov~=2.12.1
4-
pytest-qgis~=0.1.0
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.9
3+
# by the following command:
4+
#
5+
# pip-compile '.\requirements-dev.in'
6+
#
7+
astor==0.8.1
8+
# via flake8-qgis
9+
attrs==23.1.0
10+
# via flake8-bugbear
11+
black==23.11.0
12+
# via -r .\requirements-dev.in
13+
build==1.0.3
14+
# via pip-tools
15+
cfgv==3.4.0
16+
# via pre-commit
17+
click==8.1.7
18+
# via
19+
# black
20+
# pip-tools
21+
colorama==0.4.6
22+
# via
23+
# build
24+
# click
25+
# pytest
26+
coverage[toml]==7.3.2
27+
# via
28+
# coverage
29+
# pytest-cov
30+
distlib==0.3.7
31+
# via virtualenv
32+
exceptiongroup==1.1.3
33+
# via pytest
34+
filelock==3.13.1
35+
# via virtualenv
36+
flake8==6.1.0
37+
# via
38+
# -r .\requirements-dev.in
39+
# flake8-bugbear
40+
# flake8-qgis
41+
# pep8-naming
42+
flake8-bugbear==23.9.16
43+
# via -r .\requirements-dev.in
44+
flake8-qgis==1.0.0
45+
# via -r .\requirements-dev.in
46+
identify==2.5.31
47+
# via pre-commit
48+
importlib-metadata==6.8.0
49+
# via build
50+
iniconfig==2.0.0
51+
# via pytest
52+
isort==5.12.0
53+
# via -r .\requirements-dev.in
54+
mccabe==0.7.0
55+
# via flake8
56+
mypy-extensions==1.0.0
57+
# via black
58+
nodeenv==1.8.0
59+
# via pre-commit
60+
packaging==23.2
61+
# via
62+
# black
63+
# build
64+
# pytest
65+
pathspec==0.11.2
66+
# via black
67+
pep8-naming==0.13.3
68+
# via -r .\requirements-dev.in
69+
pip-tools==7.3.0
70+
# via -r .\requirements-dev.in
71+
platformdirs==3.11.0
72+
# via
73+
# black
74+
# virtualenv
75+
pluggy==1.3.0
76+
# via pytest
77+
pre-commit==3.5.0
78+
# via -r .\requirements-dev.in
79+
pycodestyle==2.11.1
80+
# via flake8
81+
pyflakes==3.1.0
82+
# via flake8
83+
pyproject-hooks==1.0.0
84+
# via build
85+
pyqt5-stubs==5.15.6.0
86+
# via -r .\requirements-dev.in
87+
pytest==7.4.3
88+
# via
89+
# -r .\requirements-dev.in
90+
# pytest-cov
91+
# pytest-qgis
92+
pytest-cov==4.1.0
93+
# via -r .\requirements-dev.in
94+
pytest-qgis==1.3.5
95+
# via -r .\requirements-dev.in
96+
pyyaml==6.0.1
97+
# via pre-commit
98+
tomli==2.0.1
99+
# via
100+
# black
101+
# build
102+
# coverage
103+
# pip-tools
104+
# pyproject-hooks
105+
# pytest
106+
typing-extensions==4.8.0
107+
# via black
108+
virtualenv==20.24.6
109+
# via pre-commit
110+
wheel==0.41.3
111+
# via pip-tools
112+
zipp==3.17.0
113+
# via importlib-metadata
5114

6-
# Linting and formatting
7-
pre-commit>=2.12.1
8-
black~=21.7b0
9-
isort~=5.9.3
10-
flake8~=3.9.2
11-
flake8-bugbear~=21.4.3
12-
pep8-naming~=0.12.1
13-
flake8-qgis>=0.1.4
115+
# The following packages are considered to be unsafe in a requirements file:
116+
# pip
117+
# setuptools

0 commit comments

Comments
 (0)