[Git][debian-gis-team/pydecorate][upstream] New upstream version 0.4.0
Antonio Valentino (@antonio.valentino)
gitlab at salsa.debian.org
Sat Sep 23 12:35:05 BST 2023
Antonio Valentino pushed to branch upstream at Debian GIS Project / pydecorate
Commits:
8951a82d by Antonio Valentino at 2023-09-23T10:57:56+00:00
New upstream version 0.4.0
- - - - -
19 changed files:
- .git_archival.txt
- .github/workflows/ci.yaml
- .github/workflows/deploy-sdist.yaml
- .gitignore
- .pre-commit-config.yaml
- + .readthedocs.yml
- CHANGELOG.md
- + doc/source/api/.gitkeep
- − doc/source/api/pydecorate.fonts.rst
- − doc/source/api/pydecorate.rst
- doc/source/conf.py
- doc/source/index.rst
- pydecorate/decorator_agg.py
- pydecorate/decorator_base.py
- pydecorate/fonts/__init__.py
- pydecorate/tests/test_decorator_agg.py
- pydecorate/tests/test_legacy.py
- pyproject.toml
- setup.py
Changes:
=====================================
.git_archival.txt
=====================================
@@ -1 +1 @@
-ref-names: tag: v0.3.4
+ref-names: HEAD -> main, tag: v0.4.0
=====================================
.github/workflows/ci.yaml
=====================================
@@ -8,31 +8,6 @@ concurrency:
on: [push, pull_request]
jobs:
- website:
- name: build website
- runs-on: ubuntu-latest
- steps:
- - name: Checkout source
- uses: actions/checkout at v3
- with:
- fetch-depth: 0
-
- - name: Set up Python
- uses: actions/setup-python at v4
- with:
- python-version: 3.11
-
- - name: Install Pydecorate
- shell: bash -l {0}
- run: |
- pip install -e .[docs]
-
- - name: Run Sphinx Build
- shell: bash -l {0}
- run: |
- cd doc; \
- make html SPHINXOPTS="-W"
-
test:
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
@@ -55,7 +30,7 @@ jobs:
steps:
- name: Checkout source
- uses: actions/checkout at v3
+ uses: actions/checkout at v4
- name: Setup Conda Environment
uses: conda-incubator/setup-miniconda at v2
=====================================
.github/workflows/deploy-sdist.yaml
=====================================
@@ -11,7 +11,7 @@ jobs:
steps:
- name: Checkout source
- uses: actions/checkout at v3
+ uses: actions/checkout at v4
- name: Create sdist
shell: bash -l {0}
@@ -21,7 +21,7 @@ jobs:
- name: Publish package to PyPI
if: github.event.action == 'published'
- uses: pypa/gh-action-pypi-publish at v1.6.4
+ uses: pypa/gh-action-pypi-publish at v1.8.10
with:
user: __token__
password: ${{ secrets.pypi_password }}
=====================================
.gitignore
=====================================
@@ -67,3 +67,5 @@ nosetests.xml
# vi / vim swp files
*.swp
+
+doc/source/api/*.rst
=====================================
.pre-commit-config.yaml
=====================================
@@ -2,7 +2,7 @@ exclude: '^$'
fail_fast: false
repos:
- repo: https://github.com/psf/black
- rev: 23.1.0
+ rev: 23.9.1
hooks:
- id: black
language_version: python3
@@ -10,7 +10,7 @@ repos:
args:
- --target-version=py38
- repo: https://github.com/PyCQA/flake8
- rev: 6.0.0
+ rev: 6.1.0
hooks:
- id: flake8
additional_dependencies: [flake8-docstrings, flake8-debugger, flake8-bugbear, mccabe]
@@ -23,12 +23,12 @@ repos:
- id: check-yaml
args: [--unsafe]
- repo: https://github.com/PyCQA/bandit
- rev: '1.7.4' # Update me!
+ rev: '1.7.5' # Update me!
hooks:
- id: bandit
args: [--ini, .bandit]
- repo: https://github.com/pre-commit/mirrors-mypy
- rev: 'v1.0.0' # Use the sha / tag you want to point at
+ rev: 'v1.5.1' # Use the sha / tag you want to point at
hooks:
- id: mypy
additional_dependencies:
=====================================
.readthedocs.yml
=====================================
@@ -0,0 +1,22 @@
+# Read the Docs configuration file
+# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
+version: 2
+# Build documentation in the docs/ directory with Sphinx
+sphinx:
+ configuration: doc/source/conf.py
+ fail_on_warning: true
+
+# Optionally build your docs in additional formats such as PDF and ePub
+formats: all
+
+build:
+ os: "ubuntu-22.04"
+ tools:
+ python: "3.11"
+
+python:
+ install:
+ - method: pip
+ path: .
+ extra_requirements:
+ - docs
=====================================
CHANGELOG.md
=====================================
@@ -1,3 +1,31 @@
+## Version 0.4.0 (2023/09/20)
+
+### Issues Closed
+
+* [Issue 49](https://github.com/pytroll/pydecorate/issues/49) - pkg_resources is deprecated as an API ([PR 50](https://github.com/pytroll/pydecorate/pull/50) by [@zmoon](https://github.com/zmoon))
+* [Issue 47](https://github.com/pytroll/pydecorate/issues/47) - Add logo incompat with Pillow v10 ([PR 48](https://github.com/pytroll/pydecorate/pull/48) by [@zmoon](https://github.com/zmoon))
+* [Issue 43](https://github.com/pytroll/pydecorate/issues/43) - "OSError: cannot load font (no text renderer)"
+
+In this release 3 issues were closed.
+
+### Pull Requests Merged
+
+#### Bugs fixed
+
+* [PR 48](https://github.com/pytroll/pydecorate/pull/48) - Fix add logo functionality for Pillow v10 ([47](https://github.com/pytroll/pydecorate/issues/47))
+
+#### Features added
+
+* [PR 50](https://github.com/pytroll/pydecorate/pull/50) - Stop using `pkg_resources` ([49](https://github.com/pytroll/pydecorate/issues/49))
+* [PR 44](https://github.com/pytroll/pydecorate/pull/44) - [pre-commit.ci] pre-commit autoupdate
+
+#### Documentation changes
+
+* [PR 35](https://github.com/pytroll/pydecorate/pull/35) - Fix readthedocs building after Python 3.8 was dropped
+
+In this release 4 pull requests were closed.
+
+
## Version 0.3.4 (2023/02/15)
### Issues Closed
=====================================
doc/source/api/.gitkeep
=====================================
=====================================
doc/source/api/pydecorate.fonts.rst deleted
=====================================
@@ -1,10 +0,0 @@
-pydecorate.fonts package
-========================
-
-Module contents
----------------
-
-.. automodule:: pydecorate.fonts
- :members:
- :undoc-members:
- :show-inheritance:
=====================================
doc/source/api/pydecorate.rst deleted
=====================================
@@ -1,45 +0,0 @@
-pydecorate package
-==================
-
-Subpackages
------------
-
-.. toctree::
-
- pydecorate.fonts
-
-Submodules
-----------
-
-pydecorate.decorator module
----------------------------
-
-.. automodule:: pydecorate.decorator
- :members:
- :undoc-members:
- :show-inheritance:
-
-pydecorate.decorator\_agg module
---------------------------------
-
-.. automodule:: pydecorate.decorator_agg
- :members:
- :undoc-members:
- :show-inheritance:
-
-pydecorate.decorator\_base module
----------------------------------
-
-.. automodule:: pydecorate.decorator_base
- :members:
- :undoc-members:
- :show-inheritance:
-
-
-Module contents
----------------
-
-.. automodule:: pydecorate
- :members:
- :undoc-members:
- :show-inheritance:
=====================================
doc/source/conf.py
=====================================
@@ -18,8 +18,7 @@ from __future__ import annotations
import os
import sys
-
-from pkg_resources import get_distribution
+from importlib.metadata import version as get_version
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
@@ -33,7 +32,12 @@ sys.path.insert(0, os.path.abspath("../../"))
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ["sphinx.ext.autodoc", "sphinx.ext.doctest"]
+extensions = ["sphinx.ext.autodoc", "sphinx.ext.doctest", "sphinxcontrib.apidoc"]
+
+# API docs
+apidoc_module_dir = "../../pydecorate"
+apidoc_output_dir = "api"
+apidoc_separate_modules = True
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
@@ -56,7 +60,7 @@ copyright = "2013, Hrobjartur Thorsteinsson"
# built documents.
#
# get version using setuptools-scm
-release = get_distribution("pydecorate").version
+release = get_version("pydecorate")
# The full version, including alpha/beta/rc tags.
# for example take major/minor
version = ".".join(release.split(".")[:2])
=====================================
doc/source/index.rst
=====================================
@@ -25,7 +25,7 @@ Contents
installation
usage
- Pydecorate API <api/pydecorate>
+ Pydecorate API <api/modules>
Indices and tables
++++++++++++++++++
=====================================
pydecorate/decorator_agg.py
=====================================
@@ -17,11 +17,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Aggdraw-based image decoration class."""
+from pathlib import Path
+
import aggdraw
-from pkg_resources import resource_filename
from pydecorate.decorator_base import DecoratorBase
+HERE = Path(__file__).parent
+
class DecoratorAGG(DecoratorBase):
"""Aggdraw-based image decoration class."""
@@ -30,8 +33,8 @@ class DecoratorAGG(DecoratorBase):
self._add_scale(colormap, **kwargs)
def _load_default_font(self):
- font_path = resource_filename("pydecorate.fonts", "DejaVuSerif.ttf")
- return aggdraw.Font("black", font_path, size=16)
+ font_path = HERE / "fonts" / "DejaVuSerif.ttf"
+ return aggdraw.Font("black", font_path.as_posix(), size=16)
def _load_font(self):
try:
=====================================
pydecorate/decorator_base.py
=====================================
@@ -354,7 +354,7 @@ class DecoratorBase(object):
nyi = int(round(nxi * aspect))
ny = nyi + 2 * my
- logo = logo.resize((nxi, nyi), resample=Image.ANTIALIAS)
+ logo = logo.resize((nxi, nyi), resample=Image.Resampling.LANCZOS)
# draw base
px = self.style["propagation"][0] + self.style["newline_propagation"][0]
=====================================
pydecorate/fonts/__init__.py
=====================================
@@ -1 +0,0 @@
-# Need this directory to be a module so that pkg_resources.resource_filename properly finds it
=====================================
pydecorate/tests/test_decorator_agg.py
=====================================
@@ -17,6 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Tests for the aggdraw-based decorator."""
+from pathlib import Path
from unittest import mock
import numpy as np
@@ -27,6 +28,9 @@ from trollimage.colormap import rdbu
from pydecorate import DecoratorAGG
+HERE = Path(__file__).parent
+REPO = HERE.parent.parent
+
@pytest.mark.parametrize(
"orientation_func_name", ["write_vertically", "write_horizontally"]
@@ -66,6 +70,20 @@ def test_colorbar(tmp_path, orientation_func_name, align_func_name, clims):
)
+def test_add_logo(tmp_path):
+ fn = tmp_path / "add_logo_pytroll.png"
+ img = Image.fromarray(np.zeros((200, 200, 3), dtype=np.uint8))
+ dc = DecoratorAGG(img)
+ dc.add_logo(REPO / "logos" / "pytroll_light_big.png")
+ img.save(fn)
+
+ # Check results
+ output_img = Image.open(fn)
+ arr = np.array(output_img)
+ assert not (arr == 0).all()
+ assert (arr[-1, -1, :] == 0).all(), "logo is in top left corner"
+
+
def assert_colorbar_increasing_tick_order(draw_text_wrapper) -> None:
last_float_text = None
for call_args in draw_text_wrapper.call_args_list:
=====================================
pydecorate/tests/test_legacy.py
=====================================
@@ -13,7 +13,7 @@ FONTS_ROOT = os.path.join(REPOS_ROOT, "pydecorate", "fonts")
DEJAVU_FONT = os.path.join(FONTS_ROOT, "DejaVuSerif.ttf")
-def test_style_retention():
+def test_style_retention(tmp_path):
# import aggdraw
from PIL import Image
from trollimage.colormap import rdbu
@@ -52,7 +52,7 @@ def test_style_retention():
# line_opacity=100, width=60, unit='K')
# img.show()
- img.save("style_retention.png")
+ img.save(tmp_path / "style_retention.png")
# #dc.align_right()
# #dc.align_bottom()
=====================================
pyproject.toml
=====================================
@@ -1,5 +1,5 @@
[build-system]
-requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4", "setuptools_scm_git_archive"]
+requires = ["setuptools>=60", "wheel", "setuptools_scm[toml]>=8.0"]
[tool.setuptools_scm]
write_to = "pydecorate/version.py"
=====================================
setup.py
=====================================
@@ -57,15 +57,20 @@ setup(
packages=["pydecorate"],
include_package_data=True,
package_data={"pydecorate": ["fonts/*.ttf"]},
- install_requires=["pillow", "aggdraw", "numpy", "setuptools"],
+ install_requires=["pillow", "aggdraw", "numpy"],
setup_requires=["setuptools_scm", "setuptools_scm_git_archive"],
scripts=[],
data_files=[],
python_requires=">=3.9",
extras_require={
"tests": tests_require,
- "docs": ["sphinx", "sphinx_rtd_theme", "sphinxcontrib-apidoc", "trollimage"],
+ "docs": [
+ "sphinx",
+ "sphinx_rtd_theme",
+ "sphinxcontrib-apidoc",
+ "trollimage",
+ "pytest",
+ ],
},
- use_scm_version={"write_to": "pydecorate/version.py"},
zip_safe=False,
)
View it on GitLab: https://salsa.debian.org/debian-gis-team/pydecorate/-/commit/8951a82d725f706e9c6bbaf02155c79788a83095
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/pydecorate/-/commit/8951a82d725f706e9c6bbaf02155c79788a83095
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/20230923/097cb0fd/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list