diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 0dc3d068c..d5f2232b1 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -18,6 +18,11 @@ jobs: deploy: runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/cflib + permissions: + id-token: write steps: - uses: actions/checkout@v4 @@ -34,5 +39,4 @@ jobs: - name: Publish package uses: pypa/gh-action-pypi-publish@release/v1 with: - username: __token__ - password: ${{ secrets.PYPI_TOKEN }} + verbose: true diff --git a/.github/workflows/test-python-publish.yml b/.github/workflows/test-python-publish.yml index 444e635f2..947a42101 100644 --- a/.github/workflows/test-python-publish.yml +++ b/.github/workflows/test-python-publish.yml @@ -18,6 +18,11 @@ jobs: deploy: runs-on: ubuntu-latest + environment: + name: pypi-test + url: https://pypi.org/p/cflib + permissions: + id-token: write steps: - uses: actions/checkout@v4 @@ -34,6 +39,5 @@ jobs: - name: Publish package to TestPyPI uses: pypa/gh-action-pypi-publish@release/v1 with: - username: __token__ - password: ${{ secrets.PYPI_TEST_TOKEN }} - repository_url: https://test.pypi.org/legacy/ + repository-url: https://test.pypi.org/legacy/ + verbose: true diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..c6c3c4d37 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,55 @@ +[build-system] +requires = ["setuptools>=61.0", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "cflib" +version = "0.1.27.1.dev0" +description = "Crazyflie Python driver" +authors = [ + { name = "Bitcraze and contributors", email = "contact@bitcraze.io" }, +] + +readme = {file = "README.md", content-type = "text/markdown"} +license = { text = "GPLv3" } +keywords = ["driver", "crazyflie", "quadcopter"] + +classifiers = [ + "Development Status :: 4 - Beta", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Topic :: System :: Hardware :: Hardware Drivers", + + # Supported Python versions + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", +] +requires-python = ">= 3.10" + +dependencies = [ + "pyusb>=1.0.0b2", + "libusb-package~=1.0", + "scipy~=1.7", + "numpy~=1.20", + "packaging~=24.0", +] + + +[project.urls] +Homepage = "https://www.bitcraze.io" +Documentation = "https://www.bitcraze.io/documentation/repository/crazyflie-lib-python/master/" +Repository = "https://github.com/bitcraze/crazyflie-lib-python" +Issues = "https://github.com/bitcraze/crazyflie-lib-python/issues" + +[project.optional-dependencies] +dev = ["pre-commit"] + +[tool.setuptools] +include-package-data = true + +[tool.setuptools.packages] +find = { exclude = ["examples", "test"] } + +[tool.setuptools.package-data] +"cflib.resources.binaries" = ["cflib/resources/binaries/*.bin"] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 3c6e79cf3..000000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[bdist_wheel] -universal=1 diff --git a/setup.py b/setup.py deleted file mode 100644 index fdcd5e5a5..000000000 --- a/setup.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env python3 -from pathlib import Path - -from setuptools import find_packages -from setuptools import setup -# read the contents of README.md file fo use in pypi description -directory = Path(__file__).parent -long_description = (directory / 'README.md').read_text() - -package_data = { - 'cflib.resources.binaries': ['cflib/resources/binaries/*.bin'], -} - -setup( - name='cflib', - version='0.1.27', - packages=find_packages(exclude=['examples', 'test']), - - description='Crazyflie python driver', - url='https://github.com/bitcraze/crazyflie-lib-python', - - long_description=long_description, - long_description_content_type='text/markdown', - - author='Bitcraze and contributors', - author_email='contact@bitcraze.io', - license='GPLv3', - - classifiers=[ - 'Development Status :: 4 - Beta', - 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', - 'Topic :: System :: Hardware :: Hardware Drivers', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 3' - ], - - keywords='driver crazyflie quadcopter', - - install_requires=[ - 'pyusb>=1.0.0b2', - 'libusb-package~=1.0', - 'scipy~=1.7', - 'numpy~=1.20', - 'packaging~=24.0', - ], - - # $ pip install -e .[dev] - extras_require={ - 'dev': [ - 'pre-commit' - ], - }, - - include_package_data=True, - package_data=package_data -) diff --git a/tools/build/bdist b/tools/build/bdist index c0bc8dc31..40a9acd04 100755 --- a/tools/build/bdist +++ b/tools/build/bdist @@ -9,7 +9,7 @@ try: script_dir = os.path.dirname(os.path.realpath(__file__)) root = _path.normpath(_path.join(script_dir, '../..')) - subprocess.check_call(['python3', 'setup.py', 'bdist_wheel'], cwd=root) + subprocess.check_call(['python3', '-m', 'build', '--wheel'], cwd=root) print('Wheel built') except subprocess.CalledProcessError as e: