From 316c25303d4b066dd4f9aba7334d394918780b8f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 21 Dec 2021 15:33:59 -0600 Subject: [PATCH 1/2] Provide a protocol for `Font`s --- shared-bindings/fontio/BuiltinFont.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/shared-bindings/fontio/BuiltinFont.c b/shared-bindings/fontio/BuiltinFont.c index 171a50dab3..fcbde4e80d 100644 --- a/shared-bindings/fontio/BuiltinFont.c +++ b/shared-bindings/fontio/BuiltinFont.c @@ -36,6 +36,25 @@ #include "shared-bindings/util.h" #include "supervisor/shared/translate.h" +//| from typing_extensions import Protocol # for compat with python < 3.8 +//| +//| class FontProtocol(Protocol): +//| """A protocol shared by `BuiltinFont` and classes in ``adafruit_bitmap_font``""" +//| def get_bounding_box(self) -> Union[Tuple[int, int], Tuple[int, int, int, int]]: +//| """Retrieve the maximum bounding box of any glyph in the font. +//| +//| The four element version is ``(width, height, x_offset, y_offset)``. +//| The two element version is ``(width, height)``, in which +//| ``x_offset`` and ``y_offset`` are assumed to be zero.""" +//| pass +//| +//| def get_glyph(self, codepoint: int) -> Optional[Glyph]: +//| """Retrieve the Glyph for a given code point +//| +//| If the code point is not present in the font, `None` is returned.""" +//| pass +//| + //| class BuiltinFont: //| """A font built into CircuitPython""" //| From 75857ce141e90f543f382c70003ebc290b498efe Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 27 Dec 2021 10:36:56 -0600 Subject: [PATCH 2/2] Install setuptool_scm for `make check-stubs` This fixes the lengthy build-time message > setuptools_scm-6.3.2-py3.9.egg/setuptools_scm/integration.py:16: RuntimeWarning: > ERROR: setuptools==44.1.1 is used in combination with setuptools_scm>=6.x > > Your build configuration is incomplete and previously worked by accident! > > > This happens as setuptools is unable to replace itself when a activated build dependency requires a more recent setuptools version (it does not respect "setuptools>X" in setup_requires). > > > setuptools>=31 is required for setup.cfg metadata support > setuptools>=42 is required for pyproject.toml configuration support > > Suggested workarounds if applicable: > - preinstalling build dependencies like setuptools_scm before running setup.py > - installing setuptools_scm using the system package manager to ensure consistency > - migrating from the deprecated setup_requires mechanism to pep517/518 and using a pyproject.toml to declare build dependencies which are reliably pre-installed before running the build tools --- requirements-doc.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements-doc.txt b/requirements-doc.txt index cefd7dc51d..5bd9e61d8b 100644 --- a/requirements-doc.txt +++ b/requirements-doc.txt @@ -6,6 +6,7 @@ twine wheel astroid setuptools +setuptools_scm # For sphinx Sphinx<4