From 38037af4e5afd8915cedf7a3c0e23d448a2f2ec9 Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Fri, 13 Sep 2024 02:39:10 -0700 Subject: [PATCH] add pyproject.toml (#234) ref nRF24/RF24#1000 --- RPi/pyRF24Network/README.md | 25 +++++++++++++++++++++++++ RPi/pyRF24Network/pyproject.toml | 15 +++++++++++++++ RPi/pyRF24Network/setup.py | 29 ++++------------------------- 3 files changed, 44 insertions(+), 25 deletions(-) create mode 100644 RPi/pyRF24Network/README.md create mode 100644 RPi/pyRF24Network/pyproject.toml diff --git a/RPi/pyRF24Network/README.md b/RPi/pyRF24Network/README.md new file mode 100644 index 00000000..03794813 --- /dev/null +++ b/RPi/pyRF24Network/README.md @@ -0,0 +1,25 @@ +# Individual python wrapper + +> [!warning] +> This python wrapper for the RF24Network C++ library was not intended +> for distribution on pypi.org. Any such attempts to publish this package +> is unauthorized and unofficial. + +## Use pyRF24 instead + +We recommend using the newer [pyRF24](https://github.com/nRF24/pyRF24) package +[available from pypi](https://pypi.org/project/pyrf24/) because + +1. it is [practically drop-in compatible](https://nrf24.github.io/pyRF24/#migrating-to-pyrf24) +2. easier to install or get updates with popular package managers like pip +3. does not require the C++ libraries to be installed -- it uses its own isolated binaries +4. includes wrappers for RF24, RF24Network, RF24Mesh libraries +5. includes a new [fake BLE implementation](https://nrf24.github.io/pyRF24/ble_api.html) +6. has its own [dedicated documentation](https://nRF24.github.io/pyRF24) +7. is compatible with python's builtin `help()` +8. includes typing stub files for type checking tools like mypy + +The only reason that you should need to keep using these older individual python +wrappers is if you must use python v3.6 or older. + +You **cannot** use these individual wrappers in combination with the pyRF24 package. diff --git a/RPi/pyRF24Network/pyproject.toml b/RPi/pyRF24Network/pyproject.toml new file mode 100644 index 00000000..fd9a807d --- /dev/null +++ b/RPi/pyRF24Network/pyproject.toml @@ -0,0 +1,15 @@ +[build-system] +requires = ["setuptools>=61"] +build-backend = "setuptools.build_meta" + +[project] +name = "RF24Network" +classifiers = [ + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 3", + "Programming Language :: C++", + "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", +] +license = {text = "GNU General Public License v2 (GPLv2)"} +readme = {file = "README.md", content-type = "text/markdown"} +dynamic = ["version"] # version is set in setup.py diff --git a/RPi/pyRF24Network/setup.py b/RPi/pyRF24Network/setup.py index 11a83126..afb1cf8f 100755 --- a/RPi/pyRF24Network/setup.py +++ b/RPi/pyRF24Network/setup.py @@ -3,12 +3,11 @@ from setuptools import setup, Extension from sys import version_info -if version_info >= (3,): - BOOST_LIB = "boost_python3" -else: - BOOST_LIB = "boost_python" +BOOST_LIB = "boost_python" + ( + "" if version_info < (3,) else "%d%d" % (version_info.major, version_info.minor) +) -# NOTE can't access "../../LICENSE.inc" from working dir because +# NOTE can't access "../../library.properties" from working dir because # it's relative. Brute force absolute path dynamically. git_dir = os.path.split(os.path.abspath(os.getcwd()))[0] git_dir = os.path.split(git_dir)[0] # remove the "RPi" dir from working path @@ -20,33 +19,13 @@ if line.startswith("version"): version = line.split("=")[1] - -long_description = """ -.. warning:: This python wrapper for the RF24Network C++ library was not intended - for distribution on pypi.org. If you're reading this, then this package - is likely unauthorized or unofficial. -""" - - setup( - name="RF24Network", version=version, - license="GPLv2", - license_files=(os.path.join(git_dir, "LICENSE"),), - long_description=long_description, - long_description_content_type="text/x-rst", - classifiers=[ - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 3", - "Programming Language :: C++", - "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", - ], ext_modules=[ Extension( "RF24Network", sources=["pyRF24Network.cpp"], libraries=["rf24network", "rf24", BOOST_LIB], - extra_compile_args=["-DRF24_NO_INTERRUPT"] ) ], )