Skip to content

Commit 5f10a02

Browse files
committed
Move to pyproject.toml, build wheels in CI
1 parent 7051c1e commit 5f10a02

File tree

5 files changed

+69
-77
lines changed

5 files changed

+69
-77
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ jobs:
1313
- name: Translate Repo Name For Build Tools filename_prefix
1414
id: repo-name
1515
run: |
16-
echo ::set-output name=repo-name::$(
16+
echo repo-name=$(
1717
echo ${{ github.repository }} |
1818
awk -F '\/' '{ print tolower($2) }' |
1919
tr '_' '-'
20-
)
20+
) >> $GITHUB_OUTPUT
2121
- name: Set up Python 3.x
2222
uses: actions/setup-python@v4
2323
with:
@@ -49,14 +49,14 @@ jobs:
4949
- name: Build docs
5050
working-directory: docs
5151
run: sphinx-build -E -W -b html . _build/html
52-
- name: Check For setup.py
52+
- name: Check For pyproject.toml
5353
id: need-pypi
5454
run: |
55-
echo ::set-output name=setup-py::$( find . -wholename './setup.py' )
55+
echo pyproject-toml=$( find . -wholename './pyproject.toml' ) >> $GITHUB_OUTPUT
5656
- name: Build Python package
57-
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
57+
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
5858
run: |
59-
pip install --upgrade setuptools wheel twine readme_renderer testresources
60-
python setup.py sdist
61-
python setup.py bdist_wheel --universal
59+
pip install --upgrade build twine
60+
find -type f -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) -exec sed -i -e "s/0.0.0+auto.0/1.2.3/" {} +
61+
python -m build
6262
twine check dist/*

.github/workflows/release.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,26 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v3
16-
- name: Check For setup.py
16+
- name: Check For pyproject.toml
1717
id: need-pypi
1818
run: |
19-
echo ::set-output name=setup-py::$( find . -wholename './setup.py' )
19+
echo pyproject-toml=$( find . -wholename './pyproject.toml' ) >> $GITHUB_OUTPUT
2020
- name: Set up Python
21-
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
21+
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
2222
uses: actions/setup-python@v4
2323
with:
2424
python-version: '3.x'
2525
- name: Install dependencies
26-
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
26+
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
2727
run: |
2828
python -m pip install --upgrade pip
29-
pip install setuptools wheel twine
29+
pip install --upgrade build twine
3030
- name: Build and publish
31-
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
31+
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
3232
env:
3333
TWINE_USERNAME: ${{ secrets.pypi_username }}
3434
TWINE_PASSWORD: ${{ secrets.pypi_password }}
3535
run: |
36-
python setup.py sdist
36+
find -type f -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) -exec sed -i -e "s/0.0.0+auto.0/${{github.event.release.tag_name}}/" {} +
37+
python -m build
3738
twine upload dist/*

optional_dependencies.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-FileCopyrightText: 2023 Alec Delaney, written for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT

pyproject.toml

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,54 @@
11
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
2+
# SPDX-FileCopyrightText: 2023 Alec Delaney for Adafruit Industries
23
#
34
# SPDX-License-Identifier: Unlicense
45

5-
[tool.black]
6-
target-version = ['py35']
6+
[build-system]
7+
requires = [
8+
"setuptools",
9+
"wheel",
10+
"setuptools-scm",
11+
]
12+
13+
[project]
14+
name = "adafruit-python-shell"
15+
description = "Python helper for running Shell scripts in Python"
16+
version = "0.0.0+auto.0"
17+
readme = "README.rst"
18+
authors = [
19+
{name = "Adafruit Industries", email = "[email protected]"}
20+
]
21+
urls = {Homepage = "https://github.com/adafruit/Adafruit_Python_Shell"}
22+
keywords = [
23+
"adafruit",
24+
"blinka",
25+
"circuitpython",
26+
"micropython",
27+
"python",
28+
"shell",
29+
"installation",
30+
"raspberry",
31+
"pi",
32+
"console",
33+
"terminal",
34+
"installer",
35+
]
36+
license = {text = "MIT"}
37+
classifiers = [
38+
"Development Status :: 3 - Alpha",
39+
"Intended Audience :: Developers",
40+
"Topic :: Software Development :: Libraries",
41+
"Topic :: System :: Hardware",
42+
"License :: OSI Approved :: MIT License",
43+
"Programming Language :: Python :: 3",
44+
"Programming Language :: Python :: 3.4",
45+
"Programming Language :: Python :: 3.5",
46+
]
47+
dynamic = ["dependencies", "optional-dependencies"]
48+
49+
[tool.setuptools]
50+
py-modules = ["adafruit_shell"]
51+
52+
[tool.setuptools.dynamic]
53+
dependencies = {file = ["requirements.txt"]}
54+
optional-dependencies = {optional = {file = ["optional_requirements.txt"]}}

setup.py

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

0 commit comments

Comments
 (0)