Skip to content

Commit

Permalink
add pyproject.toml (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
2bndy5 committed Oct 5, 2024
1 parent 2bf2412 commit 38037af
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 25 deletions.
25 changes: 25 additions & 0 deletions RPi/pyRF24Network/README.md
Original file line number Diff line number Diff line change
@@ -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.
15 changes: 15 additions & 0 deletions RPi/pyRF24Network/pyproject.toml
Original file line number Diff line number Diff line change
@@ -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
29 changes: 4 additions & 25 deletions RPi/pyRF24Network/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"]
)
],
)

0 comments on commit 38037af

Please sign in to comment.