[Git][debian-gis-team/pycoast][upstream] New upstream version 1.7.1+dfsg

Antonio Valentino (@antonio.valentino) gitlab at salsa.debian.org
Tue Jul 2 20:09:27 BST 2024



Antonio Valentino pushed to branch upstream at Debian GIS Project / pycoast


Commits:
735515af by Antonio Valentino at 2024-07-02T20:59:50+02:00
New upstream version 1.7.1+dfsg
- - - - -


12 changed files:

- .github/dependabot.yml
- .github/workflows/ci.yaml
- .github/workflows/deploy-sdist.yaml
- .pre-commit-config.yaml
- CHANGELOG.md
- MANIFEST.in
- continuous_integration/environment.yaml
- pycoast/cw_base.py
- pycoast/tests/test_pycoast.py
- pycoast/version.py
- pyproject.toml
- setup.py


Changes:

=====================================
.github/dependabot.yml
=====================================
@@ -8,4 +8,4 @@ updates:
   - package-ecosystem: "github-actions" # See documentation for possible values
     directory: "/" # Location of package manifests
     schedule:
-      interval: "weekly"
+      interval: "monthly"


=====================================
.github/workflows/ci.yaml
=====================================
@@ -28,7 +28,7 @@ jobs:
         uses: actions/checkout at v4
 
       - name: Setup Conda Environment
-        uses: conda-incubator/setup-miniconda at v2
+        uses: conda-incubator/setup-miniconda at v3
         with:
           miniforge-variant: Mambaforge
           miniforge-version: latest
@@ -49,6 +49,7 @@ jobs:
       - name: Install pycoast
         shell: bash -l {0}
         run: |
+          python -m pip install pytest-lazy-fixtures
           python -m pip install --no-deps -e .
 
       - name: Run unit tests


=====================================
.github/workflows/deploy-sdist.yaml
=====================================
@@ -1,6 +1,8 @@
 name: Deploy sdist
 
 on:
+  push:
+  pull_request:
   release:
     types:
       - published
@@ -15,11 +17,11 @@ jobs:
 
       - name: Create sdist
         shell: bash -l {0}
-        run: python setup.py sdist
+        run: python -m pip install -q build; python -m build
 
       - name: Publish package to PyPI
         if: github.event.action == 'published'
-        uses: pypa/gh-action-pypi-publish at v1.8.11
+        uses: pypa/gh-action-pypi-publish at v1.8.14
         with:
           user: __token__
           password: ${{ secrets.pypi_password }}


=====================================
.pre-commit-config.yaml
=====================================
@@ -2,7 +2,7 @@ exclude: '^$'
 fail_fast: false
 repos:
   - repo: https://github.com/psf/black
-    rev: 23.11.0
+    rev: 24.4.2
     hooks:
       - id: black
         language_version: python3
@@ -10,30 +10,30 @@ repos:
         args:
           - --target-version=py38
   - repo: https://github.com/pycqa/isort
-    rev: 5.12.0
+    rev: 5.13.2
     hooks:
       - id: isort
         language_version: python3
   - repo: https://github.com/PyCQA/flake8
-    rev: 6.1.0
+    rev: 7.0.0
     hooks:
       - id: flake8
         additional_dependencies: [flake8-docstrings, flake8-debugger, flake8-bugbear, mccabe]
         args: [--max-complexity, "10"]
   - repo: https://github.com/pre-commit/pre-commit-hooks
-    rev: v4.5.0
+    rev: v4.6.0
     hooks:
       - id: trailing-whitespace
       - id: end-of-file-fixer
       - id: check-yaml
         args: [--unsafe]
   - repo: https://github.com/PyCQA/bandit
-    rev: '1.7.5'
+    rev: '1.7.8'
     hooks:
       - id: bandit
         args: [--ini, .bandit]
   - repo: https://github.com/pre-commit/mirrors-mypy
-    rev: 'v1.7.1'  # Use the sha / tag you want to point at
+    rev: 'v1.10.0'  # Use the sha / tag you want to point at
     hooks:
       - id: mypy
         additional_dependencies:
@@ -44,3 +44,4 @@ repos:
 ci:
   # To trigger manually, comment on a pull request with "pre-commit.ci autofix"
   autofix_prs: false
+  autoupdate_schedule: "monthly"


=====================================
CHANGELOG.md
=====================================
@@ -1,3 +1,59 @@
+## Version 1.7.1 (2024/07/01)
+
+### Issues Closed
+
+* [Issue 57](https://github.com/pytroll/pycoast/issues/57) - Test failure on debian sid
+
+In this release 1 issue was closed.
+
+### Pull Requests Merged
+
+#### Bugs fixed
+
+* [PR 126](https://github.com/pytroll/pycoast/pull/126) - Fix numpy 2 compatibility
+
+#### Features added
+
+* [PR 124](https://github.com/pytroll/pycoast/pull/124) - Switch to pytest-lazy-fixtures
+
+In this release 2 pull requests were closed.
+
+
+## Version 1.7.0 (2023/11/30)
+
+### Issues Closed
+
+* [Issue 107](https://github.com/pytroll/pycoast/issues/107) - Incompatibility with Pillow 10 ([PR 108](https://github.com/pytroll/pycoast/pull/108) by [@avalentino](https://github.com/avalentino))
+* [Issue 95](https://github.com/pytroll/pycoast/issues/95) - Cached overlays are pale
+* [Issue 82](https://github.com/pytroll/pycoast/issues/82) - Test failure with Pillow 9.4 ([PR 84](https://github.com/pytroll/pycoast/pull/84) by [@mraspaud](https://github.com/mraspaud))
+* [Issue 49](https://github.com/pytroll/pycoast/issues/49) - add install instructions to docs
+
+In this release 4 issues were closed.
+
+### Pull Requests Merged
+
+#### Bugs fixed
+
+* [PR 108](https://github.com/pytroll/pycoast/pull/108) - Fix compatibility with Pillow 10 (Draw.textsize versus Draw.textbbox) ([107](https://github.com/pytroll/pycoast/issues/107))
+* [PR 98](https://github.com/pytroll/pycoast/pull/98) - Remove special handling of geographic (longlat) CRSes
+* [PR 96](https://github.com/pytroll/pycoast/pull/96) - Fix cached images producing different results without caching
+
+#### Features added
+
+* [PR 105](https://github.com/pytroll/pycoast/pull/105) - [pre-commit.ci] pre-commit autoupdate
+* [PR 86](https://github.com/pytroll/pycoast/pull/86) - Fix the pycoast tests further
+* [PR 85](https://github.com/pytroll/pycoast/pull/85) - Cleanup tests
+* [PR 84](https://github.com/pytroll/pycoast/pull/84) - Fix reference images for pillow 9.4 ([82](https://github.com/pytroll/pycoast/issues/82))
+* [PR 83](https://github.com/pytroll/pycoast/pull/83) - Factorize font path computation
+
+#### Documentation changes
+
+* [PR 113](https://github.com/pytroll/pycoast/pull/113) - Update shapefile URL in docs to HTTPS
+* [PR 96](https://github.com/pytroll/pycoast/pull/96) - Fix cached images producing different results without caching
+
+In this release 10 pull requests were closed.
+
+
 ## Version 1.6.1 (2022/11/07)
 
 ### Pull Requests Merged


=====================================
MANIFEST.in
=====================================
@@ -3,7 +3,6 @@ recursive-include docs/source *
 include pycoast/tests/*.png
 recursive-include pycoast/tests/ *
 include LICENSE.txt
-include MANIFEST.in
 
 include versioneer.py
 include pycoast/version.py


=====================================
continuous_integration/environment.yaml
=====================================
@@ -10,6 +10,5 @@ dependencies:
   - aggdraw
   - pyshp
   - pyresample
-  - pytest
+  - pytest <8.0
   - pytest-cov
-  - pytest-lazy-fixture


=====================================
pycoast/cw_base.py
=====================================
@@ -26,6 +26,7 @@ import json
 import logging
 import math
 import os
+from pathlib import Path
 from typing import Generator
 
 import numpy as np
@@ -501,11 +502,11 @@ class ContourWriterBase(object):
         return overlays
 
     def add_overlay_from_dict(self, overlays, area_def, cache_epoch=None, background=None):
-        """Create and return a transparent image adding all the overlays contained in the `overlays` dict.
+        """Create and return a transparent image adding all the overlays contained in the ``overlays`` dict.
 
         Optionally caches overlay results for faster rendering of images with
         the same provided AreaDefinition and parameters. Cached results are
-        identified by hashing the AreaDefinition and the overlays dictionary.
+        identified by hashing the AreaDefinition and the ``overlays`` dictionary.
 
         Note that if ``background`` is provided and caching is not used, the
         result will be the final result of applying the overlays onto the
@@ -530,24 +531,33 @@ class ContourWriterBase(object):
                 provided dictionary (see below).
             background: pillow image instance
                 The image on which to write the overlays on. If it's None (default),
-                a new image is created, otherwise the provide background is
+                a new image is created, otherwise the provided background is
                 used and changed *in place*.
 
+        The keys in ``overlays`` that will be taken into account are:
+        cache, coasts, rivers, borders, shapefiles, grid, cities, points
 
-            The keys in `overlays` that will be taken into account are:
-            cache, coasts, rivers, borders, shapefiles, grid, cities, points
+        For all of them except ``cache``, the items are the same as the
+        corresponding functions in pycoast, so refer to the docstrings of
+        these functions (add_coastlines, add_rivers, add_borders,
+        add_shapefile_shapes, add_grid, add_cities, add_points).
+        For cache, two parameters are configurable:
 
-            For all of them except `cache`, the items are the same as the
-            corresponding functions in pycoast, so refer to the docstrings of
-            these functions (add_coastlines, add_rivers, add_borders,
-            add_shapefile_shapes, add_grid, add_cities, add_points).
-            For cache, two parameters are configurable:
+        - `file`:
+            specify the directory and the prefix
+            of the file to save the caches decoration to (for example
+            /var/run/black_coasts_red_borders)
+        - `regenerate`:
+            True or False (default) to force the overwriting
+            of an already cached file.
 
-            - `file`: specify the directory and the prefix
-                  of the file to save the caches decoration to (for example
-                  /var/run/black_coasts_red_borders)
-            - `regenerate`: True or False (default) to force the overwriting
-                  of an already cached file.
+        :Returns: PIL.Image.Image
+
+            Resulting overlays as an Image object. If caching was used then
+            the Image wraps an open file and should be closed by the caller.
+            If caching was not used or the cached image was recreated then
+            this is an in-memory Image object. Regardless, it can be closed
+            by calling the ``.close()`` method of the Image.
 
         """
         overlay_helper = _OverlaysFromDict(self, overlays, area_def, cache_epoch, background)
@@ -556,12 +566,22 @@ class ContourWriterBase(object):
     def add_overlay_from_config(self, config_file, area_def, background=None):
         """Create and return a transparent image adding all the overlays contained in a configuration file.
 
+        See :meth:`add_overlay_from_dict` for more information.
+
         :Parameters:
             config_file : str
                 Configuration file name
             area_def : object
                 Area Definition of the creating image
 
+        :Returns: PIL.Image.Image
+
+            Resulting overlays as an Image object. If caching was used then
+            the Image wraps an open file and should be closed by the caller.
+            If caching was not used or the cached image was recreated then
+            this is an in-memory Image object. Regardless, it can be closed
+            by calling the ``.close()`` method of the Image.
+
         """
         overlays = self._config_to_dict(config_file)
         return self.add_overlay_from_dict(overlays, area_def, os.path.getmtime(config_file), background)
@@ -705,8 +725,7 @@ class ContourWriterBase(object):
         # cities.red is a reduced version of the files avalable at http://download.geonames.org
         # Fields: 0=name (UTF-8), 1=asciiname, 2=longitude [°E], 3=latitude [°N], 4=countrycode
         cities_filename = os.path.join(db_root_path, os.path.join("CITIES", "cities.txt"))
-        cities_parser = GeoNamesCitiesParser(cities_filename)
-        for city_name, lon, lat in cities_parser.iter_cities_names_lon_lat(cities_list):
+        for city_name, lon, lat in iter_cities_names_lon_lat(cities_filename, cities_list):
             try:
                 x, y = area_def.get_array_indices_from_lonlat(lon, lat)
             except ValueError:
@@ -1132,14 +1151,12 @@ def _get_pixel_index(shape, area_extent, x_size, y_size, prj, x_offset=0, y_offs
     return index_arrays, is_reduced
 
 
-class GeoNamesCitiesParser:
-    """Helper for parsing citiesN.txt files from GeoNames.org."""
-
-    def __init__(self, cities_filename: str):
-        self._cities_file = open(cities_filename, mode="r", encoding="utf-8")
-
-    def iter_cities_names_lon_lat(self, cities_list: list[str]) -> Generator[tuple[str, float, float], None, None]:
-        for city_row in self._cities_file:
+def iter_cities_names_lon_lat(
+    cities_filename: str | Path, cities_list: list[str]
+) -> Generator[tuple[str, float, float], None, None]:
+    """Iterate over citiesN.txt files from GeoNames.org."""
+    with open(cities_filename, mode="r", encoding="utf-8") as cities_file:
+        for city_row in cities_file:
             city_info = city_row.split("\t")
             if not city_info or not (city_info[1] in cities_list or city_info[2] in cities_list):
                 continue
@@ -1441,7 +1458,7 @@ class _OverlaysFromDict:
 def _apply_cached_foreground_on_background(background, foreground):
     premult_foreground = foreground.convert("RGBa")
     if background.mode == "RGBA":
-        # Cached foreground and background are both RGBA, not extra conversions needed
+        # Cached foreground and background are both RGBA, no extra conversions needed
         background.paste(premult_foreground, mask=premult_foreground)
         return
     background_rgba = background.convert("RGBA")
@@ -1521,7 +1538,7 @@ class _GridDrawer:
         min_lons[min_lons > 180] = min_lons[min_lons > 180] - 360
 
         # Get min_lons not in maj_lons
-        min_lons = np.lib.arraysetops.setdiff1d(min_lons, maj_lons)
+        min_lons = np.setdiff1d(min_lons, maj_lons)
 
         # lats along major lon lines
         lin_lats = np.arange(
@@ -1542,7 +1559,7 @@ class _GridDrawer:
         min_lats = np.arange(round_lat_min + increase_min_lat, lat_max - shorten_max_lat, dlat)
 
         # Get min_lats not in maj_lats
-        min_lats = np.lib.arraysetops.setdiff1d(min_lats, maj_lats)
+        min_lats = np.setdiff1d(min_lats, maj_lats)
 
         # lons along major lat lines (extended slightly to avoid missing the end)
         lin_lons = np.linspace(lon_min, lon_max + Dlon / 5.0, max(self._x_size, self._y_size) // 5)


=====================================
pycoast/tests/test_pycoast.py
=====================================
@@ -30,7 +30,7 @@ import shapefile
 from PIL import Image, ImageFont
 from pyproj import CRS
 from pyresample.geometry import AreaDefinition
-from pytest_lazyfixture import lazy_fixture
+from pytest_lazy_fixtures import lf as lazy_fixture
 
 LOCAL_DIR = os.path.dirname(__file__)
 
@@ -1900,6 +1900,7 @@ class TestFromConfig:
         # Create the original cache file
         img = cw.add_overlay_from_dict(overlays, area_def)
         res = np.array(img)
+        img.close()
         cache_glob = glob(os.path.join(tmpdir, "pycoast_cache_*.png"))
         assert len(cache_glob) == 1
         cache_filename = cache_glob[0]
@@ -1910,22 +1911,26 @@ class TestFromConfig:
         # Reuse the generated cache file
         img = cw.add_overlay_from_dict(overlays, area_def)
         res = np.array(img)
+        img.close()
         assert fft_metric(euro_data, res), "Writing of contours failed"
         assert os.path.isfile(cache_filename)
         assert os.path.getmtime(cache_filename) == mtime
 
         # Regenerate cache file
         current_time = time.time()
-        cw.add_overlay_from_dict(overlays, area_def, current_time)
+        fg_img = cw.add_overlay_from_dict(overlays, area_def, current_time)
+        fg_img.close()
         mtime = os.path.getmtime(cache_filename)
         assert mtime > current_time
         assert fft_metric(euro_data, res), "Writing of contours failed"
 
-        cw.add_overlay_from_dict(overlays, area_def, current_time)
+        fg_img = cw.add_overlay_from_dict(overlays, area_def, current_time)
+        fg_img.close()
         assert os.path.getmtime(cache_filename) == mtime
         assert fft_metric(euro_data, res), "Writing of contours failed"
         overlays["cache"]["regenerate"] = True
-        cw.add_overlay_from_dict(overlays, area_def)
+        fg_img = cw.add_overlay_from_dict(overlays, area_def)
+        fg_img.close()
 
         assert os.path.getmtime(cache_filename) != mtime
         assert fft_metric(euro_data, res), "Writing of contours failed"
@@ -1943,7 +1948,8 @@ class TestFromConfig:
             "lat_placement": "lr",
             "lon_placement": "b",
         }
-        cw.add_overlay_from_dict(overlays, area_def)
+        fg_img = cw.add_overlay_from_dict(overlays, area_def)
+        fg_img.close()
         os.remove(cache_filename)
 
     def test_caching_with_param_changes(self, tmpdir):
@@ -1962,7 +1968,8 @@ class TestFromConfig:
         }
 
         # Create the original cache file
-        cw.add_overlay_from_dict(overlays, area_def)
+        fg_img = cw.add_overlay_from_dict(overlays, area_def)
+        fg_img.close()
         cache_glob = glob(os.path.join(tmpdir, "pycoast_cache_*.png"))
         assert len(cache_glob) == 1
         cache_filename = cache_glob[0]
@@ -1970,7 +1977,8 @@ class TestFromConfig:
         mtime = os.path.getmtime(cache_filename)
 
         # Reuse the generated cache file
-        cw.add_overlay_from_dict(overlays, area_def)
+        fg_img = cw.add_overlay_from_dict(overlays, area_def)
+        fg_img.close()
         cache_glob = glob(os.path.join(tmpdir, "pycoast_cache_*.png"))
         assert len(cache_glob) == 1
         assert os.path.isfile(cache_filename)
@@ -1979,7 +1987,8 @@ class TestFromConfig:
         # Remove the font option, should produce the same result
         # font is not considered when caching
         del overlays["grid"]["font"]
-        cw.add_overlay_from_dict(overlays, area_def)
+        fg_img = cw.add_overlay_from_dict(overlays, area_def)
+        fg_img.close()
         cache_glob = glob(os.path.join(tmpdir, "pycoast_cache_*.png"))
         assert len(cache_glob) == 1
         assert os.path.isfile(cache_filename)
@@ -1990,7 +1999,8 @@ class TestFromConfig:
             "cache": {"file": os.path.join(tmpdir, "pycoast_cache")},
             "grid": {"width": 2.0},
         }
-        cw.add_overlay_from_dict(overlays, area_def)
+        fg_img = cw.add_overlay_from_dict(overlays, area_def)
+        fg_img.close()
         cache_glob = glob(os.path.join(tmpdir, "pycoast_cache_*.png"))
         assert len(cache_glob) == 2
         assert os.path.isfile(cache_filename)


=====================================
pycoast/version.py
=====================================
@@ -26,9 +26,9 @@ def get_keywords():
     # setup.py/versioneer.py will grep for the variable names, so they must
     # each be defined on a line of their own. _version.py will just call
     # get_keywords().
-    git_refnames = " (tag: v1.7.0)"
-    git_full = "b2497177a877e25561142af580f3c0534d79397a"
-    git_date = "2023-11-30 08:53:01 -0600"
+    git_refnames = " (tag: v1.7.1)"
+    git_full = "c526f4e2f3c1578b1c7ed95d3bfdfca49b31d1d9"
+    git_date = "2024-07-01 10:44:04 -0500"
     keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
     return keywords
 


=====================================
pyproject.toml
=====================================
@@ -14,3 +14,9 @@ exclude = '''
 )
 
 '''
+
+[tool.pytest.ini_options]
+filterwarnings = [
+    "error",
+    "ignore:numpy.ndarray size changed:RuntimeWarning",
+]


=====================================
setup.py
=====================================
@@ -16,7 +16,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """Setuptools-based packaging and installation configuration."""
 
-from setuptools import setup
+from setuptools import find_packages, setup
 
 import versioneer
 
@@ -27,11 +27,11 @@ extras_require = {
         "sphinx",
         "pyresample",
         "pytest",
-        "pytest-lazy-fixture",
+        "pytest-lazy-fixtures",
         "sphinx_rtd_theme",
         "sphinxcontrib-apidoc",
     ],
-    "tests": ["pyresample", "pytest", "pytest-cov", "coverage", "coveralls", "pytest-lazy-fixture"],
+    "tests": ["pyresample", "pytest", "pytest-cov", "coverage", "coveralls", "pytest-lazy-fixtures"],
 }
 
 with open("README", "r") as readme_file:
@@ -45,7 +45,7 @@ setup(
     long_description=long_description,
     author="Esben S. Nielsen",
     author_email="esn at dmi.dk",
-    packages=["pycoast", "pycoast.tests"],
+    packages=find_packages(),
     include_package_data=True,
     install_requires=requires,
     extras_require=extras_require,



View it on GitLab: https://salsa.debian.org/debian-gis-team/pycoast/-/commit/735515af4ad65126df5f757fb8b35af28802ea9f

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://salsa.debian.org/debian-gis-team/pycoast/-/commit/735515af4ad65126df5f757fb8b35af28802ea9f
You're receiving this email because of your account on salsa.debian.org.


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


More information about the Pkg-grass-devel mailing list