Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bindings: python: migrate metadata out of setup.py to pyproject.toml #107

Closed
vfazio opened this issue Nov 8, 2024 · 17 comments
Closed

bindings: python: migrate metadata out of setup.py to pyproject.toml #107

vfazio opened this issue Nov 8, 2024 · 17 comments

Comments

@vfazio
Copy link
Contributor

vfazio commented Nov 8, 2024

PyPA recommends migrating to pyproject.toml where possible: https://packaging.python.org/en/latest/guides/modernize-setup-py-project/

We have one, but it's sparse. We do not explicitly specify the build-backend:

[build-system]
requires = ["setuptools>=59.0.0", "packaging"] # we need 59.0.0 for https://github.com/pypa/setuptools/commit/974dbb03769a500c5077d37291817f30359a0d7b
build-backend = "setuptools.build_meta"

I don't think we need "wheel" as a dependency to generate wheels (testing shows we don't at least).

As part of the migration, we can specify proper Trove classifiers. Newer versions of setuptools support dynamic fields in the toml file.

More configuration will slowly start landing in the toml file as a result of #97, so we may as well make it comprehensive.

@brgl
Copy link
Owner

brgl commented Nov 19, 2024

@vfazio was this achieved by your big series I applied today?

@vfazio
Copy link
Contributor Author

vfazio commented Nov 19, 2024

@vfazio was this achieved by your big series I applied today?

It was not. I was trying to keep the typing related stuff in that series and this is outside of that scope.

I think some of this is pretty simple, but i need to make sure that after the migration to pyproject.toml that the wheels and what not still look kosher.

@brgl
Copy link
Owner

brgl commented Nov 19, 2024

Got it.

@vfazio
Copy link
Contributor Author

vfazio commented Nov 20, 2024

@brgl I can certainly work on this if you want me to. Is this something you wanted to close out as part of 2.2.3 or 2.3.x? I'm not 100% sure of the binding versioning scheme.

My availability to work on this stuff is a little limited with the holidays coming up in the US and other travel plans of mine. (also why i haven't responded to the other issue, i'm way behind on other work, I haven't forgotten about it however).

@brgl
Copy link
Owner

brgl commented Nov 20, 2024

The next version is going to be v2.3.0. I think the recent rework deserves a minor release.

@vfazio
Copy link
Contributor Author

vfazio commented Nov 20, 2024

The next version is going to be v2.3.0. I think the recent rework deserves a minor release.

Are there other fixups or changes you want to include before tagging 2.3.0? I would like to help get those resolved for you if I can.

@brgl
Copy link
Owner

brgl commented Nov 20, 2024

The migration to pyproject.toml would be handy. :)

@vfazio
Copy link
Contributor Author

vfazio commented Nov 21, 2024

I've got this mostly working. I need to compare the outputs from the migration to previous sdist and wheels to make sure the contents look correct. I'll let you know how that goes.

@vfazio
Copy link
Contributor Author

vfazio commented Nov 21, 2024

I'm going to post a diff here and then explain some things and then post some evidence just to have a discussion before actually posting the patch to the ML especially since my dev environment is different than yours.

diff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml
index d6f5f9b..a87055c 100644
--- a/bindings/python/pyproject.toml
+++ b/bindings/python/pyproject.toml
@@ -2,7 +2,48 @@
 # SPDX-FileCopyrightText: 2023 Phil Howard <phil@gadgetoid.com>
 
 [build-system]
-requires = ["setuptools", "wheel", "packaging"]
+requires = ["setuptools>=69.0.0"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "gpiod"
+dynamic = ["version"]
+description = "Python bindings for libgpiod"
+readme = "README.md"
+license = {text = "LGPL-2.1"}
+requires-python = ">=3.9.0"
+authors = [
+    { name = "Bartosz Golaszewski", email = "brgl@bgdev.pl" },
+]
+classifiers = [
+  "Development Status :: 5 - Production/Stable",
+  "License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)",
+  "Operating System :: POSIX :: Linux",
+  "Typing :: Typed",
+  "Programming Language :: Python",
+  "Programming Language :: Python :: 3",
+  "Programming Language :: Python :: 3 :: Only",
+  "Programming Language :: Python :: 3.9",
+  "Programming Language :: Python :: 3.10",
+  "Programming Language :: Python :: 3.11",
+  "Programming Language :: Python :: 3.12",
+  "Programming Language :: Python :: 3.13",
+]
+
+[tool.setuptools]
+platforms = ["linux"]
+include-package-data = false
+
+[tool.setuptools.dynamic]
+version = {attr = "gpiod.version.__version__"}
+
+[tool.setuptools.packages.find]
+include = ["gpiod"]
+namespaces = false
+
+[project.urls]
+Homepage = "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git"
+Issues = "https://github.com/brgl/libgpiod/issues/"
 
 [tool.mypy]
 python_version = "3.9"
diff --git a/bindings/python/setup.py b/bindings/python/setup.py
index 0d518af..1af4709 100644
--- a/bindings/python/setup.py
+++ b/bindings/python/setup.py
@@ -4,7 +4,7 @@
 from os import getenv, path, unlink
 from shutil import copytree, rmtree
 
-from setuptools import Extension, find_packages, setup
+from setuptools import Extension, setup
 from setuptools.command.build_ext import build_ext as orig_build_ext
 from setuptools.command.sdist import log
 from setuptools.command.sdist import sdist as orig_sdist
@@ -18,11 +18,6 @@ TAR_FILENAME = "libgpiod-{version}.tar.gz"
 ASC_FILENAME = "sha256sums.asc"
 SHA256_CHUNK_SIZE = 2048
 
-# __version__
-with open("gpiod/version.py", "r") as fd:
-    exec(fd.read())
-
-
 def sha256(filename):
     """
     Return a sha256sum for a specific filename, loading the file in chunks
@@ -225,19 +220,6 @@ gpiod_ext = Extension(
 )
 
 setup(
-    name="gpiod",
-    url="https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git",
-    packages=find_packages(exclude=["tests", "tests.*"]),
-    package_data={"gpiod": ["py.typed", "_ext.pyi"]},
-    python_requires=">=3.9.0",
     ext_modules=[gpiod_ext],
     cmdclass={"build_ext": build_ext, "sdist": sdist},
-    version=__version__,
-    author="Bartosz Golaszewski",
-    author_email="brgl@bgdev.pl",
-    description="Python bindings for libgpiod",
-    long_description=open("README.md", "r").read(),
-    long_description_content_type="text/markdown",
-    platforms=["linux"],
-    license="LGPLv2.1",
 )

With the above changes, I compared both the 2.2.2 sdist and a 2.2.2 wheel against those generated by ./generate_pypi_artifacts.sh after these changes:

For the sdist:

vfazio@vfazio4 ~/Downloads $ diff <(tar -tvf gpiod-2.2.2.tar.gz | awk '{print $6}' | sort | cut -f2- -d'/') <(tar -tvf ~/development/libgpiod/bindings/python/dist/gpiod-2.2.0.tar.gz | awk '{print $7}' | sort | cut -f2- -d'/')
12a13,14
> gpiod/_ext.pyi
> gpiod/_internal.py
26d27
< gpiod/internal.py
30a32
> gpiod/py.typed

Just the extra files we expect to include and the renamed "internal"

For the wheel:

vfazio@vfazio4 ~/Downloads $ diff <(unzip -l gpiod-2.2.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | awk '{print $4}' | sort ) <(unzip -l ~/development/libgpiod/bindings/python/dist/gpiod-2.2.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | awk '{print $4}' | sort)
6,11c6,10
< gpiod-2.2.2.dist-info/
< gpiod-2.2.2.dist-info/METADATA
< gpiod-2.2.2.dist-info/RECORD
< gpiod-2.2.2.dist-info/WHEEL
< gpiod-2.2.2.dist-info/top_level.txt
< gpiod.libs/
---
> gpiod-2.2.0.dist-info/
> gpiod-2.2.0.dist-info/METADATA
> gpiod-2.2.0.dist-info/RECORD
> gpiod-2.2.0.dist-info/WHEEL
> gpiod-2.2.0.dist-info/top_level.txt
14a14,15
> gpiod/_ext.pyi
> gpiod/_internal.py
20d20
< gpiod/internal.py
24a25
> gpiod/py.typed

The difference is the empty gpiod.libs directory is no longer included. The py.typed and _ext.pyi files are included even without being specified in data-files due to requiring a minimum version of setuptools that includes pypa/setuptools#4021

As mentioned, the sdist and wheel script works:

20 wheels produced in 6 minutes:
  gpiod-2.2.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl    99 kB
  gpiod-2.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl      99 kB
  gpiod-2.2.0-cp310-cp310-musllinux_1_2_aarch64.whl                           97 kB
  gpiod-2.2.0-cp310-cp310-musllinux_1_2_x86_64.whl                            97 kB
  gpiod-2.2.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl   101 kB
  gpiod-2.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl     100 kB
  gpiod-2.2.0-cp311-cp311-musllinux_1_2_aarch64.whl                           99 kB
  gpiod-2.2.0-cp311-cp311-musllinux_1_2_x86_64.whl                            98 kB
  gpiod-2.2.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl   100 kB
  gpiod-2.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl     100 kB
  gpiod-2.2.0-cp312-cp312-musllinux_1_2_aarch64.whl                           99 kB
  gpiod-2.2.0-cp312-cp312-musllinux_1_2_x86_64.whl                            98 kB
  gpiod-2.2.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl   100 kB
  gpiod-2.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl     100 kB
  gpiod-2.2.0-cp313-cp313-musllinux_1_2_aarch64.whl                           99 kB
  gpiod-2.2.0-cp313-cp313-musllinux_1_2_x86_64.whl                            98 kB
  gpiod-2.2.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl      99 kB
  gpiod-2.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl        98 kB
  gpiod-2.2.0-cp39-cp39-musllinux_1_2_aarch64.whl                             96 kB
  gpiod-2.2.0-cp39-cp39-musllinux_1_2_x86_64.whl                              96 kB

I tested the resultant wheel by tying two lines together and watching edge events:

(venv) root@rpi-87fa00:/var/tmp/tmp.0emZxixLEE# head -n25 venv/lib/python3.11/site-packages/gpiod-2.2.0.dist-info/METADATA
Metadata-Version: 2.1
Name: gpiod
Version: 2.2.0
Summary: Python bindings for libgpiod
Author-email: Bartosz Golaszewski <brgl@bgdev.pl>
License: LGPL-2.1
Project-URL: Homepage, https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git
Project-URL: Issues, https://github.com/brgl/libgpiod/issues/
Platform: linux
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)
Classifier: Operating System :: POSIX :: Linux
Classifier: Typing :: Typed
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.9.0
Description-Content-Type: text/markdown

<!-- SPDX-License-Identifier: CC-BY-SA-4.0 -->

(venv) root@rpi-87fa00:/var/tmp/tmp.0emZxixLEE# python3 -c "import gpiod; print(gpiod.__version__); print(gpiod.is_gpiochip_device('/dev/gpiochip0'))"
2.2.0
True

(venv) root@rpi-87fa00:/var/tmp/tmp.0emZxixLEE# cat example.py
import gpiod

from gpiod.line import Edge


def watch_line_rising(chip_path, line_offset):
    with gpiod.request_lines(
        chip_path,
        consumer="watch-line-rising",
        config={line_offset: gpiod.LineSettings(edge_detection=Edge.RISING)},
    ) as request:
        while True:
            # Blocks until at least one event is available
            for event in request.read_edge_events():
                print(
                    "line: {}  type: Rising   event #{}".format(
                        event.line_offset, event.line_seqno
                    )
                )


if __name__ == "__main__":
    try:
        watch_line_rising("/dev/gpiochip0", 40)
    except OSError as ex:
        print(ex, "\nCustomise the example configuration to suit your situation")  


(venv) root@rpi-87fa00:/var/tmp/tmp.0emZxixLEE# gpioset -t 500 -z -c gpiochip0 41=0
(venv) root@rpi-87fa00:/var/tmp/tmp.0emZxixLEE# python3 example.py
line: 40  type: Rising   event #1
line: 40  type: Rising   event #2
line: 40  type: Rising   event #3
line: 40  type: Rising   event #4
line: 40  type: Rising   event #5
^CTraceback (most recent call last):
  File "/var/tmp/tmp.0emZxixLEE/example.py", line 24, in <module>
    watch_line_rising("/dev/gpiochip0", 40)
  File "/var/tmp/tmp.0emZxixLEE/example.py", line 14, in watch_line_rising
    for event in request.read_edge_events():
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/tmp/tmp.0emZxixLEE/venv/lib/python3.11/site-packages/gpiod/line_request.py", line 225, in read_edge_events
    return cast(_ext.Request, self._req).read_edge_events(max_events)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyboardInterrupt

(venv) root@rpi-87fa00:/var/tmp/tmp.0emZxixLEE# pkill gpioset

The repo's top level default make target continues to build without error. The python tests continue to build and work as well.

Rationale behind the changes:

@vfazio
Copy link
Contributor Author

vfazio commented Nov 21, 2024

it looks like i did LGPL-2.1 and should have done 2.1+ based on the SPDX headers on the files. I will fix that when i actually make the patch. I was going off of the license value formerly in setup.py.

@vfazio
Copy link
Contributor Author

vfazio commented Nov 22, 2024

Sorry to ping you, @brgl does this seem reasonable?

@brgl
Copy link
Owner

brgl commented Nov 22, 2024

Yes, awesome. Are tests still packaged in sdist?

@vfazio
Copy link
Contributor Author

vfazio commented Nov 22, 2024

Yes, awesome. Are tests still packaged in sdist?

Yep, they are still packaged in sdist.

(venv) vfazio@vfazio4 /mnt/development/libgpiod/bindings/python $ LIBGPIOD_VERSION=2.2 python3 -m build --sdist
* Creating isolated environment: virtualenv+pip...
* Installing packages in isolated environment:
  - setuptools>=69.0.0
* Getting build dependencies for sdist...
running egg_info
writing gpiod.egg-info/PKG-INFO
writing dependency_links to gpiod.egg-info/dependency_links.txt
writing top-level names to gpiod.egg-info/top_level.txt
reading manifest file 'gpiod.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'libgpiod-version.txt'
warning: no files found matching '*.c' under directory 'lib'
warning: no files found matching '*.h' under directory 'lib'
warning: no files found matching '*.h' under directory 'include'
writing manifest file 'gpiod.egg-info/SOURCES.txt'
* Building sdist...
running sdist
fetching: https://mirrors.edge.kernel.org/pub/software/libs/libgpiod/sha256sums.asc
fetching: https://mirrors.edge.kernel.org/pub/software/libs/libgpiod/libgpiod-2.2.tar.gz
verifying: libgpiod-2.2.tar.gz
unpacking: libgpiod-2.2.tar.gz
running egg_info
writing gpiod.egg-info/PKG-INFO
writing dependency_links to gpiod.egg-info/dependency_links.txt
writing top-level names to gpiod.egg-info/top_level.txt
reading manifest file 'gpiod.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'gpiod.egg-info/SOURCES.txt'
running check
creating gpiod-2.2.0
creating gpiod-2.2.0/gpiod
creating gpiod-2.2.0/gpiod.egg-info
creating gpiod-2.2.0/gpiod/ext
creating gpiod-2.2.0/include
creating gpiod-2.2.0/lib
creating gpiod-2.2.0/lib/uapi
creating gpiod-2.2.0/tests
creating gpiod-2.2.0/tests/gpiosim
creating gpiod-2.2.0/tests/procname
copying files to gpiod-2.2.0...
copying MANIFEST.in -> gpiod-2.2.0
copying README.md -> gpiod-2.2.0
copying build_tests.py -> gpiod-2.2.0
copying libgpiod-version.txt -> gpiod-2.2.0
copying pyproject.toml -> gpiod-2.2.0
copying setup.py -> gpiod-2.2.0
copying gpiod/__init__.py -> gpiod-2.2.0/gpiod
copying gpiod/_ext.pyi -> gpiod-2.2.0/gpiod
copying gpiod/_internal.py -> gpiod-2.2.0/gpiod
copying gpiod/chip.py -> gpiod-2.2.0/gpiod
copying gpiod/chip_info.py -> gpiod-2.2.0/gpiod
copying gpiod/edge_event.py -> gpiod-2.2.0/gpiod
copying gpiod/exception.py -> gpiod-2.2.0/gpiod
copying gpiod/info_event.py -> gpiod-2.2.0/gpiod
copying gpiod/line.py -> gpiod-2.2.0/gpiod
copying gpiod/line_info.py -> gpiod-2.2.0/gpiod
copying gpiod/line_request.py -> gpiod-2.2.0/gpiod
copying gpiod/line_settings.py -> gpiod-2.2.0/gpiod
copying gpiod/py.typed -> gpiod-2.2.0/gpiod
copying gpiod/version.py -> gpiod-2.2.0/gpiod
copying gpiod.egg-info/PKG-INFO -> gpiod-2.2.0/gpiod.egg-info
copying gpiod.egg-info/SOURCES.txt -> gpiod-2.2.0/gpiod.egg-info
copying gpiod.egg-info/dependency_links.txt -> gpiod-2.2.0/gpiod.egg-info
copying gpiod.egg-info/top_level.txt -> gpiod-2.2.0/gpiod.egg-info
copying gpiod/ext/chip.c -> gpiod-2.2.0/gpiod/ext
copying gpiod/ext/common.c -> gpiod-2.2.0/gpiod/ext
copying gpiod/ext/internal.h -> gpiod-2.2.0/gpiod/ext
copying gpiod/ext/line-config.c -> gpiod-2.2.0/gpiod/ext
copying gpiod/ext/line-settings.c -> gpiod-2.2.0/gpiod/ext
copying gpiod/ext/module.c -> gpiod-2.2.0/gpiod/ext
copying gpiod/ext/request.c -> gpiod-2.2.0/gpiod/ext
copying include/gpiod.h -> gpiod-2.2.0/include
copying lib/chip-info.c -> gpiod-2.2.0/lib
copying lib/chip.c -> gpiod-2.2.0/lib
copying lib/edge-event.c -> gpiod-2.2.0/lib
copying lib/info-event.c -> gpiod-2.2.0/lib
copying lib/internal.c -> gpiod-2.2.0/lib
copying lib/internal.h -> gpiod-2.2.0/lib
copying lib/line-config.c -> gpiod-2.2.0/lib
copying lib/line-info.c -> gpiod-2.2.0/lib
copying lib/line-request.c -> gpiod-2.2.0/lib
copying lib/line-settings.c -> gpiod-2.2.0/lib
copying lib/misc.c -> gpiod-2.2.0/lib
copying lib/request-config.c -> gpiod-2.2.0/lib
copying lib/uapi/gpio.h -> gpiod-2.2.0/lib/uapi
copying tests/__init__.py -> gpiod-2.2.0/tests
copying tests/__main__.py -> gpiod-2.2.0/tests
copying tests/helpers.py -> gpiod-2.2.0/tests
copying tests/tests_chip.py -> gpiod-2.2.0/tests
copying tests/tests_chip_info.py -> gpiod-2.2.0/tests
copying tests/tests_edge_event.py -> gpiod-2.2.0/tests
copying tests/tests_info_event.py -> gpiod-2.2.0/tests
copying tests/tests_line.py -> gpiod-2.2.0/tests
copying tests/tests_line_info.py -> gpiod-2.2.0/tests
copying tests/tests_line_request.py -> gpiod-2.2.0/tests
copying tests/tests_line_settings.py -> gpiod-2.2.0/tests
copying tests/tests_module.py -> gpiod-2.2.0/tests
copying tests/gpiosim/__init__.py -> gpiod-2.2.0/tests/gpiosim
copying tests/gpiosim/chip.py -> gpiod-2.2.0/tests/gpiosim
copying tests/gpiosim/ext.c -> gpiod-2.2.0/tests/gpiosim
copying tests/procname/__init__.py -> gpiod-2.2.0/tests/procname
copying tests/procname/ext.c -> gpiod-2.2.0/tests/procname
copying gpiod.egg-info/SOURCES.txt -> gpiod-2.2.0/gpiod.egg-info
Writing gpiod-2.2.0/setup.cfg
Creating tar archive
removing 'gpiod-2.2.0' (and everything under it)
Successfully built gpiod-2.2.0.tar.gz

(venv) vfazio@vfazio4 /mnt/development/libgpiod/bindings/python $ tar -tvf dist/gpiod-2.2.0.tar.gz | awk '{print $7}' | cut -f2- -d '/'

MANIFEST.in
PKG-INFO
README.md
build_tests.py
gpiod/
gpiod/__init__.py
gpiod/_ext.pyi
gpiod/_internal.py
gpiod/chip.py
gpiod/chip_info.py
gpiod/edge_event.py
gpiod/exception.py
gpiod/ext/
gpiod/ext/chip.c
gpiod/ext/common.c
gpiod/ext/internal.h
gpiod/ext/line-config.c
gpiod/ext/line-settings.c
gpiod/ext/module.c
gpiod/ext/request.c
gpiod/info_event.py
gpiod/line.py
gpiod/line_info.py
gpiod/line_request.py
gpiod/line_settings.py
gpiod/py.typed
gpiod/version.py
gpiod.egg-info/
gpiod.egg-info/PKG-INFO
gpiod.egg-info/SOURCES.txt
gpiod.egg-info/dependency_links.txt
gpiod.egg-info/top_level.txt
include/
include/gpiod.h
lib/
lib/chip-info.c
lib/chip.c
lib/edge-event.c
lib/info-event.c
lib/internal.c
lib/internal.h
lib/line-config.c
lib/line-info.c
lib/line-request.c
lib/line-settings.c
lib/misc.c
lib/request-config.c
lib/uapi/
lib/uapi/gpio.h
libgpiod-version.txt
pyproject.toml
setup.cfg
setup.py
tests/
tests/__init__.py
tests/__main__.py
tests/gpiosim/
tests/gpiosim/__init__.py
tests/gpiosim/chip.py
tests/gpiosim/ext.c
tests/helpers.py
tests/procname/
tests/procname/__init__.py
tests/procname/ext.c
tests/tests_chip.py
tests/tests_chip_info.py
tests/tests_edge_event.py
tests/tests_info_event.py
tests/tests_line.py
tests/tests_line_info.py
tests/tests_line_request.py
tests/tests_line_settings.py
tests/tests_module.py

@vfazio
Copy link
Contributor Author

vfazio commented Nov 22, 2024

For good measure, I went ahead and also validated that wheels worked on Alpine too:

(venv) localhost:/tmp/tmp.OijHbF# cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.20.3
PRETTY_NAME="Alpine Linux v3.20"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"

(venv) localhost:/tmp/tmp.OijHbF# pip install /root/gpiod-2.2.0-cp312-cp312-musl
linux_1_2_aarch64.whl


(venv) localhost:/tmp/tmp.OijHbF# head -n25 venv/lib/python3.12/site-packages/gpiod-2.2.0.dist-info/METADATA
Metadata-Version: 2.1
Name: gpiod
Version: 2.2.0
Summary: Python bindings for libgpiod
Author-email: Bartosz Golaszewski <brgl@bgdev.pl>
License: LGPL-2.1-or-later
Project-URL: Homepage, https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git
Project-URL: Issues, https://github.com/brgl/libgpiod/issues/
Platform: linux
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)
Classifier: Operating System :: POSIX :: Linux
Classifier: Typing :: Typed
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.9.0
Description-Content-Type: text/markdown

<!-- SPDX-License-Identifier: CC-BY-SA-4.0 -->


(venv) localhost:/tmp/tmp.OijHbF# python3 example.py
line: 40  type: Rising   event #1
line: 40  type: Rising   event #2
line: 40  type: Rising   event #3
line: 40  type: Rising   event #4
^CTraceback (most recent call last):
  File "/tmp/tmp.OijHbF/example.py", line 24, in <module>
    watch_line_rising("/dev/gpiochip0", 40)
  File "/tmp/tmp.OijHbF/example.py", line 14, in watch_line_rising
    for event in request.read_edge_events():
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/tmp.OijHbF/venv/lib/python3.12/site-packages/gpiod/line_request.py", line 225, in read_edge_events
    return cast(_ext.Request, self._req).read_edge_events(max_events)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyboardInterrupt


I'll post a patch in a bit

@vfazio
Copy link
Contributor Author

vfazio commented Nov 22, 2024

@brgl
Copy link
Owner

brgl commented Nov 27, 2024

I applied the patch, awesome work, thank you. Everything I could think of still works.

@vfazio
Copy link
Contributor Author

vfazio commented Nov 27, 2024

I applied the patch, awesome work, thank you. Everything I could think of still works.

Awesome, glad i could help out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants