[Git][debian-gis-team/python-affine][upstream] New upstream version 3.0.1

Bas Couwenberg (@sebastic) gitlab at salsa.debian.org
Sat Aug 29 06:31:50 BST 2026



Bas Couwenberg pushed to branch upstream at Debian GIS Project / python-affine


Commits:
bc3212fd by Bas Couwenberg at 2026-08-29T07:27:05+02:00
New upstream version 3.0.1
- - - - -


10 changed files:

- .github/workflows/ci.yml
- .pre-commit-config.yaml
- AUTHORS.txt
- CHANGES.txt
- README.rst
- pyproject.toml
- src/affine/__init__.py
- tests/test_numpy.py
- tests/test_transform.py
- tox.ini


Changes:

=====================================
.github/workflows/ci.yml
=====================================
@@ -23,7 +23,7 @@ jobs:
         shell: bash
         run: |
           python -m pip install --upgrade pip
-          python -m pip install pre-commit
+          python -m pip install --group dev
           pre-commit run --show-diff-on-failure --all-files
 
   tests:
@@ -42,7 +42,7 @@ jobs:
       - name: Install affine
         run: |
           python -m pip install --upgrade pip
-          python -m pip install .["test"]
+          python -m pip install . --group tests
 
       - name: Run tests
         run: |
@@ -50,7 +50,7 @@ jobs:
 
       - name: Upload Coverage Results
         if: ${{ matrix.python-version == env.LATEST_PY_VERSION }}
-        uses: codecov/codecov-action at v3
+        uses: codecov/codecov-action at v5
         with:
           files: ./coverage.xml
           flags: unittests


=====================================
.pre-commit-config.yaml
=====================================
@@ -8,7 +8,7 @@ repos:
     - id: end-of-file-fixer
     - id: trailing-whitespace
   - repo: https://github.com/astral-sh/ruff-pre-commit
-    rev: v0.14.10
+    rev: v0.16.3
     hooks:
       # Run the linter.
       - id: ruff-check
@@ -16,7 +16,7 @@ repos:
       # Run the formatter.
       - id: ruff-format
   - repo: https://github.com/pre-commit/mirrors-mypy
-    rev: v1.19.1
+    rev: v2.3.0
     hooks:
       - id: mypy
         additional_dependencies: [attrs]


=====================================
AUTHORS.txt
=====================================
@@ -7,6 +7,7 @@ Authors
 - Juan Luis Cano Rodríguez
 - Kevin Wurster
 - Kirill Kouzoubov
+- L. Viallon-Galinier
 - Loïc Dutrieux
 - Michael Wess
 - Mike Taves


=====================================
CHANGES.txt
=====================================
@@ -1,6 +1,18 @@
 CHANGES
 =======
 
+3.0.1 (2026-08-28)
+------------------
+
+Deprecations:
+
+- Affine now raises PendingDeprecationWarning when the * operator is used for
+  matrix multiplication. This is intended for developers to see (gh-146).
+
+Bug fixes:
+
+- Affine requires attrs>=21.3.0 (gh-148).
+
 3.0.0 (2026-08-08)
 ------------------
 


=====================================
README.rst
=====================================
@@ -52,21 +52,26 @@ Matrices can be created by passing the values ``a, b, c, d, e, f`` to the
          0.7071067811865475, 0.7071067811865476, 0.0)
 
 These matrices can be applied to ``(x, y)`` tuples using the
-``*`` operator (or the ``@`` matrix multiplier operator for
-future releases) to obtain transformed coordinates ``(x', y')``.
+``@`` matrix multiplier operator to obtain transformed
+coordinates ``(x', y')``.
 
 .. code-block:: pycon
 
-  >>> Affine.translation(1.0, 5.0) * (1.0, 1.0)
+  >>> Affine.translation(1.0, 5.0) @ (1.0, 1.0)
   (2.0, 6.0)
-  >>> Affine.rotation(45.0) * (1.0, 1.0)
+  >>> Affine.rotation(45.0) @ (1.0, 1.0)
   (1.1102230246251565e-16, 1.414213562373095)
 
+.. note::
+   Versions before 3.0.0 only supported the ``*`` operator for
+   matrix multiplication. To use these examples with previous
+   releases, replace ``@`` with ``*``.
+
 They may also be multiplied together to combine transformations.
 
 .. code-block:: pycon
 
-  >>> Affine.translation(1.0, 5.0) * Affine.rotation(45.0)
+  >>> Affine.translation(1.0, 5.0) @ Affine.rotation(45.0)
   Affine(0.7071067811865476, -0.7071067811865475, 1.0,
          0.7071067811865475, 0.7071067811865476, 5.0)
 
@@ -89,7 +94,7 @@ origin can be easily computed.
   >>> geotransform = (-237481.5, 425.0, 0.0, 237536.4, 0.0, -425.0)
   >>> fwd = Affine.from_gdal(*geotransform)
   >>> col, row = 0, 100
-  >>> fwd * (col, row)
+  >>> fwd @ (col, row)
   (-237481.5, 195036.4)
 
 The reverse transformation is obtained using the ``~`` inverse operator.
@@ -97,5 +102,5 @@ The reverse transformation is obtained using the ``~`` inverse operator.
 .. code-block:: pycon
 
   >>> rev = ~fwd
-  >>> rev * fwd * (col, row)
+  >>> rev @ fwd @ (col, row)
   (0.0, 99.99999999999999)


=====================================
pyproject.toml
=====================================
@@ -1,5 +1,5 @@
 [build-system]
-requires = ["flit_core >=3.2,<4"]
+requires = ["flit_core >=3.11,<4"]
 build-backend = "flit_core.buildapi"
 
 [project]
@@ -13,28 +13,37 @@ readme = "README.rst"
 keywords = ["affine", "transformation", "matrix"]
 classifiers = [
     "Development Status :: 5 - Production/Stable",
-    "License :: OSI Approved :: BSD License",
     "Operating System :: OS Independent",
     "Programming Language :: Python :: 3 :: Only",
+    "Programming Language :: Python :: 3.10",
+    "Programming Language :: Python :: 3.11",
+    "Programming Language :: Python :: 3.12",
+    "Programming Language :: Python :: 3.13",
+    "Programming Language :: Python :: 3.14",
+    "Programming Language :: Python :: 3.15",
     "Topic :: Multimedia :: Graphics :: Graphics Conversion",
     "Topic :: Scientific/Engineering :: GIS",
     "Typing :: Typed",
 ]
-license = {text = "BSD-3-Clause"}
+license = "BSD-3-Clause"
+license-files = ["AUTHORS.txt", "LICENSE.txt"]
 requires-python = ">=3.9"
 dependencies = [
-    "attrs",
+    "attrs>=21.3.0",
 ]
 
-[project.optional-dependencies]
-test = [
+[dependency-groups]
+dev = [
+    "coveralls>=3.0",
+    "pre-commit>=4.3.0",
+    "tox>=4.22",
+    {include-group = "tests"},
+]
+tests = [
     "numpy>=1.20",
     "pytest>=6.0",
     "pytest-cov",
 ]
-dev = [
-    "coveralls>=3.0",
-]
 
 [project.urls]
 Source = "https://github.com/rasterio/affine"


=====================================
src/affine/__init__.py
=====================================
@@ -44,7 +44,7 @@ from attrs import astuple, define, field
 
 __all__ = ["Affine"]
 __author__ = "Sean Gillies"
-__version__ = "3.0.0"
+__version__ = "3.0.1"
 
 EPSILON: float = 1e-5
 EPSILON2: float = 1e-10
@@ -615,13 +615,16 @@ class Affine:
         Returns
         -------
         Affine or a tuple of two items
+
+        .. deprecated:: 3.1.0
+            Use `@` matmul instead of `*` mul operator for matrix multiplication.
         """
-        # TODO: consider enabling this for 3.1
-        # warnings.warn(
-        #     "Use `@` matmul instead of `*` mul operator for matrix multiplication",
-        #     PendingDeprecationWarning,
-        #     stacklevel=2,
-        # )
+        # TODO: consider elevating to DeprecationWarning for 3.2
+        warnings.warn(
+            "Use `@` matmul instead of `*` mul operator for matrix multiplication",
+            PendingDeprecationWarning,
+            stacklevel=2,
+        )
         if isinstance(other, Affine):
             return self.__matmul__(other)
         try:


=====================================
tests/test_numpy.py
=====================================
@@ -107,7 +107,8 @@ def test_matmul_items():
     testing.assert_array_equal(pw, np.ones(shape))
 
     # see GH-125 with mul `*` op
-    px, py = A * (vx, vy)
+    with pytest.deprecated_call():
+        px, py = A * (vx, vy)
     testing.assert_allclose(px, expected_px)
     testing.assert_allclose(py, expected_py)
 
@@ -126,7 +127,7 @@ def test_matmul_item_errors():
 def test_mul_item_errors():
     shape = (4, 5)
     vx, vy = np.meshgrid(np.arange(shape[1]), np.arange(shape[0]))
-    with pytest.raises(TypeError):
+    with pytest.raises(TypeError), pytest.deprecated_call():
         Affine.identity() * (vx, vy, 1)
-    with pytest.raises(TypeError):
+    with pytest.raises(TypeError), pytest.deprecated_call():
         Affine.identity() * (vx, vy, np.zeros(shape))


=====================================
tests/test_transform.py
=====================================
@@ -376,7 +376,7 @@ def test_itransform():
 
 
 def test_mul_wrong_type():
-    with pytest.raises(TypeError):
+    with pytest.raises(TypeError), pytest.deprecated_call():
         Affine(1, 2, 3, 4, 5, 6) * None
 
 
@@ -394,7 +394,7 @@ def test_matmul_sequence_wrong_member_types():
         def __iter__():
             yield 0
 
-    with pytest.raises(TypeError):
+    with pytest.raises(TypeError), pytest.deprecated_call():
         Affine(1, 2, 3, 4, 5, 6) * NotPtSeq()
 
     with pytest.raises(TypeError):
@@ -403,7 +403,7 @@ def test_matmul_sequence_wrong_member_types():
 
 def test_imul_errors():
     t = Affine.identity()
-    with pytest.raises(TypeError):
+    with pytest.raises(TypeError), pytest.deprecated_call():
         t *= 2.0
 
 
@@ -427,7 +427,8 @@ def test_imul_tuple():
 
 def test_imul_transform():
     t = Affine.translation(3, 5)
-    t *= Affine.translation(-2, 3.5)
+    with pytest.deprecated_call():
+        t *= Affine.translation(-2, 3.5)
     assert isinstance(t, Affine)
     seq_almost_equal(t, Affine.translation(1, 8.5))
 
@@ -532,8 +533,9 @@ def test_rmatmul_errors():
 
 def test_mul_tuple():
     t = Affine(1, 2, 3, 4, 5, 6)
-    assert t * (2, 2) == (9, 24)
-    with pytest.raises(TypeError):
+    with pytest.deprecated_call():
+        assert t * (2, 2) == (9, 24)
+    with pytest.raises(TypeError), pytest.deprecated_call():
         t * (2, 2, 1)
 
 
@@ -607,7 +609,8 @@ def test_mul_fallback_unpack():
         def __rmatmul__(self, other):
             return other @ (1, 2)
 
-    assert Affine.identity() * TextPoint() == (1, 2)
+    with pytest.deprecated_call():
+        assert Affine.identity() * TextPoint() == (1, 2)
 
     assert Affine.identity() @ TextPoint() == (1, 2)
 
@@ -628,7 +631,8 @@ def test_mul_fallback_type_error():
         def __rmatmul__(self, other):
             return other @ (1, 2)
 
-    assert Affine.identity() * TextPoint() == (1, 2)
+    with pytest.deprecated_call():
+        assert Affine.identity() * TextPoint() == (1, 2)
     assert Affine.identity() @ TextPoint() == (1, 2)
 
 


=====================================
tox.ini
=====================================
@@ -1,11 +1,11 @@
 [tox]
 envlist =
-    py39,py310,py311,py312,py313,py314
+    py39,py310,py311,py312,py313,py314,py315
+requires =
+    tox>4.22
 
 [testenv]
 usedevelop = true
-deps =
-    numpy
-    pytest-cov
+dependency_groups = tests
 commands =
     python -m pytest  --cov affine --cov-report term-missing



View it on GitLab: https://salsa.debian.org/debian-gis-team/python-affine/-/commit/bc3212fd94b14411d92e83a8a776bb35d3050749

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-affine/-/commit/bc3212fd94b14411d92e83a8a776bb35d3050749
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20260829/a7e4f2cf/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list