From 01bd80d2782a82f33dd8f30c96f3af6caa5b13e4 Mon Sep 17 00:00:00 2001
From: vincentsarago <vincent.sarago@gmail.com>
Date: Fri, 20 Dec 2024 15:04:27 +0100
Subject: [PATCH] update pre-commit and bump config

---
 .bumpversion.cfg        |  9 ---------
 .pre-commit-config.yaml | 15 +++++----------
 pyproject.toml          | 15 ++++++++++++++-
 rio_tiler_pds/utils.py  |  1 +
 tests/test_sentinel2.py |  6 +++---
 5 files changed, 23 insertions(+), 23 deletions(-)
 delete mode 100644 .bumpversion.cfg

diff --git a/.bumpversion.cfg b/.bumpversion.cfg
deleted file mode 100644
index 03828e4..0000000
--- a/.bumpversion.cfg
+++ /dev/null
@@ -1,9 +0,0 @@
-[bumpversion]
-current_version = 0.10.1
-commit = True
-tag = True
-tag_name = {new_version}
-
-[bumpversion:file:rio_tiler_pds/__init__.py]
-search = __version__ = "{current_version}"
-replace = __version__ = "{new_version}"
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index ddf48d7..ee70349 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -4,26 +4,21 @@ repos:
     hooks:
       - id: validate-pyproject
 
-  - repo: https://github.com/psf/black
-    rev: 22.12.0
-    hooks:
-      - id: black
-        language_version: python
-
   - repo: https://github.com/PyCQA/isort
-    rev: 5.12.0
+    rev: 5.13.2
     hooks:
       - id: isort
         language_version: python
 
-  - repo: https://github.com/charliermarsh/ruff-pre-commit
-    rev: v0.0.238
+  - repo: https://github.com/astral-sh/ruff-pre-commit
+    rev: v0.8.4
     hooks:
       - id: ruff
         args: ["--fix"]
+      - id: ruff-format
 
   - repo: https://github.com/pre-commit/mirrors-mypy
-    rev: v0.991
+    rev: v1.11.2
     hooks:
       - id: mypy
         language_version: python
diff --git a/pyproject.toml b/pyproject.toml
index 5df9fe0..507afcf 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -67,7 +67,7 @@ default_section = "THIRDPARTY"
 [tool.mypy]
 no_strict_optional = "True"
 
-[tool.ruff]
+[tool.ruff.lint]
 select = [
     "D1",  # pydocstyle errors
     "E",  # pycodestyle errors
@@ -82,3 +82,16 @@ ignore = [
 ]
 
 
+[tool.bumpversion]
+current_version = "0.10.1"
+search = "{current_version}"
+replace = "{new_version}"
+regex = false
+tag = true
+commit = true
+tag_name = "{new_version}"
+
+[[tool.bumpversion.files]]
+filename = "rio_tiler_pds/__init__.py"
+search = '__version__ = "{current_version}"'
+replace = '__version__ = "{new_version}"'
diff --git a/rio_tiler_pds/utils.py b/rio_tiler_pds/utils.py
index bd1eada..25c8fb1 100644
--- a/rio_tiler_pds/utils.py
+++ b/rio_tiler_pds/utils.py
@@ -66,6 +66,7 @@ def get_object(bucket: str, key: str, request_pays: bool = False) -> bytes:
     warnings.warn(
         "`rio_tiler_pds.utils.get_object` will be removed in version 1.0, Please use `rio_tiler_pds.utils.fetch`",
         DeprecationWarning,
+        stacklevel=1,
     )
     return aws_get_object(bucket, key, request_pays=request_pays)
 
diff --git a/tests/test_sentinel2.py b/tests/test_sentinel2.py
index cebee94..70cf53a 100644
--- a/tests/test_sentinel2.py
+++ b/tests/test_sentinel2.py
@@ -513,13 +513,13 @@ def test_sentinel_productid_valid():
 
 def test_no_readers():
     """Test no reader found for level."""
-    with pytest.raises(Exception):
+    with pytest.raises(Exception):  # noqa: B017
         S2JP2Reader("S2B_L1B_20170729_19UDP_0")
 
-    with pytest.raises(Exception):
+    with pytest.raises(Exception):  # noqa: B017
         S2JP2Reader("S2A_L2C_20170729_19UDP_0")
 
-    with pytest.raises(Exception):
+    with pytest.raises(Exception):  # noqa: B017
         S2COGReader("S2A_29RKH_20200219_0_L2C")