Skip to content

Commit 9313d01

Browse files
authored
Merge pull request #491 from bitcraze/rik/python_build
Modernize Python Packaging: Transition to pyproject.toml and PyPI Trusted Publishing
2 parents fe7beba + 6d8d974 commit 9313d01

File tree

6 files changed

+69
-64
lines changed

6 files changed

+69
-64
lines changed

.github/workflows/python-publish.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ jobs:
1818
deploy:
1919

2020
runs-on: ubuntu-latest
21+
environment:
22+
name: pypi
23+
url: https://pypi.org/p/cflib
24+
permissions:
25+
id-token: write
2126

2227
steps:
2328
- uses: actions/checkout@v4
@@ -34,5 +39,4 @@ jobs:
3439
- name: Publish package
3540
uses: pypa/gh-action-pypi-publish@release/v1
3641
with:
37-
username: __token__
38-
password: ${{ secrets.PYPI_TOKEN }}
42+
verbose: true

.github/workflows/test-python-publish.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ jobs:
1818
deploy:
1919

2020
runs-on: ubuntu-latest
21+
environment:
22+
name: pypi-test
23+
url: https://pypi.org/p/cflib
24+
permissions:
25+
id-token: write
2126

2227
steps:
2328
- uses: actions/checkout@v4
@@ -34,6 +39,5 @@ jobs:
3439
- name: Publish package to TestPyPI
3540
uses: pypa/gh-action-pypi-publish@release/v1
3641
with:
37-
username: __token__
38-
password: ${{ secrets.PYPI_TEST_TOKEN }}
39-
repository_url: https://test.pypi.org/legacy/
42+
repository-url: https://test.pypi.org/legacy/
43+
verbose: true

pyproject.toml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "cflib"
7+
version = "0.1.27.1.dev0"
8+
description = "Crazyflie Python driver"
9+
authors = [
10+
{ name = "Bitcraze and contributors", email = "contact@bitcraze.io" },
11+
]
12+
13+
readme = {file = "README.md", content-type = "text/markdown"}
14+
license = { text = "GPLv3" }
15+
keywords = ["driver", "crazyflie", "quadcopter"]
16+
17+
classifiers = [
18+
"Development Status :: 4 - Beta",
19+
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
20+
"Topic :: System :: Hardware :: Hardware Drivers",
21+
22+
# Supported Python versions
23+
"Programming Language :: Python :: 3.10",
24+
"Programming Language :: Python :: 3.11",
25+
"Programming Language :: Python :: 3.12",
26+
"Programming Language :: Python :: 3.13",
27+
]
28+
requires-python = ">= 3.10"
29+
30+
dependencies = [
31+
"pyusb>=1.0.0b2",
32+
"libusb-package~=1.0",
33+
"scipy~=1.7",
34+
"numpy~=1.20",
35+
"packaging~=24.0",
36+
]
37+
38+
39+
[project.urls]
40+
Homepage = "https://www.bitcraze.io"
41+
Documentation = "https://www.bitcraze.io/documentation/repository/crazyflie-lib-python/master/"
42+
Repository = "https://github.com/bitcraze/crazyflie-lib-python"
43+
Issues = "https://github.com/bitcraze/crazyflie-lib-python/issues"
44+
45+
[project.optional-dependencies]
46+
dev = ["pre-commit"]
47+
48+
[tool.setuptools]
49+
include-package-data = true
50+
51+
[tool.setuptools.packages]
52+
find = { exclude = ["examples", "test"] }
53+
54+
[tool.setuptools.package-data]
55+
"cflib.resources.binaries" = ["cflib/resources/binaries/*.bin"]

setup.cfg

Lines changed: 0 additions & 2 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 56 deletions
This file was deleted.

tools/build/bdist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ try:
99
script_dir = os.path.dirname(os.path.realpath(__file__))
1010
root = _path.normpath(_path.join(script_dir, '../..'))
1111

12-
subprocess.check_call(['python3', 'setup.py', 'bdist_wheel'], cwd=root)
12+
subprocess.check_call(['python3', '-m', 'build', '--wheel'], cwd=root)
1313

1414
print('Wheel built')
1515
except subprocess.CalledProcessError as e:

0 commit comments

Comments
 (0)