Skip to content

Commit a9d9a0c

Browse files
authored
Merge pull request #187 from siapy/fix
chore: [pre-commit.ci] pre-commit autoupdate
2 parents fe0bfbd + 00223e5 commit a9d9a0c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+673
-992
lines changed

.github/workflows/docs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ jobs:
1818
uses: actions/checkout@v4
1919
- name: Setup PDM
2020
uses: pdm-project/setup-pdm@v4
21+
with:
22+
python-version: 3.10
23+
cache: true
2124
- name: Install dependencies
2225
run: pdm install -G docs
2326
- name: Build MkDocs site

.github/workflows/publish.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
- uses: actions/checkout@v4
3737
- uses: pdm-project/setup-pdm@v4
3838
with:
39-
version: "head"
39+
python-version: 3.10
40+
cache: true
4041
- name: Publish package distributions to PyPI
4142
run: pdm publish

.github/workflows/test.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,22 @@ on:
1111
jobs:
1212
test:
1313
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python-version: ["3.10", "3.11", "3.12"]
17+
fail-fast: false
18+
19+
name: Test Python ${{ matrix.python-version }}
1420
steps:
1521
- name: Checkout
1622
uses: actions/checkout@v4
1723
with:
1824
lfs: true # This option ensures that Git LFS files are checked out
1925
- name: Setup PDM
2026
uses: pdm-project/setup-pdm@v4
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
cache: true
2130
- name: Install dependencies
2231
run: pdm install
2332
- name: Lint code
@@ -27,6 +36,8 @@ jobs:
2736
run: ./scripts/test.sh "Coverage for ${{ github.sha }}"
2837
- name: Store coverage files
2938
uses: actions/upload-artifact@v4
39+
# Only upload for Python 3.12
40+
if: matrix.python-version == '3.12'
3041
with:
3142
name: coverage-html
3243
path: htmlcov

Makefile

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ lint: .pdm
3030
test: .pdm
3131
./scripts/test.sh "Develop"
3232

33+
.PHONY: flt ## Run format, lint, and test
34+
flt: format lint test
35+
3336
.PHONY: codespell ## Use Codespell to do spellchecking
3437
codespell: .pre-commit
3538
pdm run pre-commit run codespell --all-files
@@ -47,24 +50,7 @@ update-branches:
4750

4851
.PHONY: clean ## Clear local caches and build artifacts
4952
clean:
50-
rm -rf `find . -name __pycache__`
51-
rm -f `find . -type f -name '*.py[co]'`
52-
rm -f `find . -type f -name '*~'`
53-
rm -f `find . -type f -name '.*~'`
54-
rm -rf .pdm-build
55-
rm -rf .mypy_cache
56-
rm -rf .cache
57-
rm -rf .pytest_cache
58-
rm -rf .ruff_cache
59-
rm -rf htmlcov
60-
rm -rf *.egg-info
61-
rm -f .coverage
62-
rm -f .coverage.*
63-
rm -rf build
64-
rm -rf dist
65-
rm -rf site
66-
rm -rf docs/_build
67-
rm -rf coverage.xml
53+
./scripts/clean.sh
6854

6955
.PHONY: generate-docs ## Generate the docs
7056
generate-docs:

docs/examples/src/spectral_imageset_load_01.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55

66
print("Libraries detected successfully.")
77
except ImportError as e:
8-
print(
9-
f"Error: {e}. Please ensure that the SiaPy library is installed and the environment is activated."
10-
)
8+
print(f"Error: {e}. Please ensure that the SiaPy library is installed and the environment is activated.")
119
exit(1)
1210

1311
# Set the path to the directory containing the data

docs/examples/src/transformations_02.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@
4040
selected_areas_vnir = pixels_select_lasso(image_vnir)
4141

4242
# Transform the selected areas from the VNIR image to the space of the SWIR image.
43-
selected_areas_swir = [
44-
corregistrator.transform(pixels_vnir, matx) for pixels_vnir in selected_areas_vnir
45-
]
43+
selected_areas_swir = [corregistrator.transform(pixels_vnir, matx) for pixels_vnir in selected_areas_vnir]
4644

4745
# Display the selected areas in both images
4846
display_multiple_images_with_areas(

pdm.lock

Lines changed: 199 additions & 331 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "siapy"
33
version = "0.5.9"
44
description = "A python library for efficient processing of spectral images."
55
authors = [{ name = "janezlapajne", email = "janez.lapajne@kis.si" }]
6-
requires-python = ">=3.10"
6+
requires-python = ">=3.10,<3.13"
77
readme = "README.md"
88
license = { text = "MIT" }
99

@@ -43,13 +43,7 @@ dependencies = [
4343
]
4444

4545
[dependency-groups]
46-
lint = [
47-
"black>=24.4.2",
48-
"flake8>=7.0.0",
49-
"ruff>=0.4.8",
50-
"mypy>=1.10.1",
51-
"pandas-stubs>=2.2.2.240603",
52-
]
46+
lint = ["ruff>=0.4.8", "mypy>=1.10.1", "pandas-stubs>=2.2.2.240603"]
5347
dev = ["pre-commit>=3.7.1", "tomli>=2.0.1", "codespell>=2.3.0"]
5448
test = ["pytest>=8.2.2", "pytest-cov>=5.0.0", "pytest-xdist>=3.6.1"]
5549
docs = [
@@ -95,14 +89,8 @@ ignore_missing_imports = true
9589
module = "sklearn.*"
9690
ignore_missing_imports = true
9791

98-
[tool.flake8]
99-
ignore = "E302, E305, E203, E501, W503, E501"
100-
select = "C,E,F,W,B,B950"
101-
max-line-length = 100
102-
exclude = [".git", "__pycache__", "__init__.py", ".mypy_cache", ".pytest_cache"]
103-
per-file-ignores = ["tests/*:F401,F811"]
104-
10592
[tool.ruff]
93+
line-length = 120
10694
extend-exclude = []
10795
exclude = []
10896
lint.ignore = ["F811"]

scripts/clean.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
set -x
5+
6+
rm -rf $(find . -name __pycache__)
7+
rm -f $(find . -type f -name '*.py[co]')
8+
rm -f $(find . -type f -name '*~')
9+
rm -f $(find . -type f -name '.*~')
10+
rm -rf .pdm-build
11+
rm -rf .mypy_cache
12+
rm -rf .cache
13+
rm -rf .pytest_cache
14+
rm -rf .ruff_cache
15+
rm -rf htmlcov
16+
rm -rf *.egg-info
17+
rm -f .coverage
18+
rm -f .coverage.*
19+
rm -rf build
20+
rm -rf dist
21+
rm -rf site
22+
rm -rf docs/_build
23+
rm -rf coverage.xml

siapy/core/exceptions.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ def __init__(
5151
self.input_type: Any = type(input_value)
5252
self.allowed_types: type | tuple[type, ...] = allowed_types
5353
self.message: str = message
54-
super().__init__(
55-
f"{message}: {input_value} (type: {self.input_type}). Allowed types: {allowed_types}"
56-
)
54+
super().__init__(f"{message}: {input_value} (type: {self.input_type}). Allowed types: {allowed_types}")
5755

5856

5957
class ProcessingError(SiapyError):
@@ -78,9 +76,7 @@ class MethodNotImplementedError(SiapyError):
7876
def __init__(self, class_name: str, method_name: str) -> None:
7977
self.class_name: str = class_name
8078
self.method_name: str = method_name
81-
super().__init__(
82-
f"Method '{method_name}' not implemented in class '{class_name}'"
83-
)
79+
super().__init__(f"Method '{method_name}' not implemented in class '{class_name}'")
8480

8581

8682
class DirectInitializationError(SiapyError):

0 commit comments

Comments
 (0)