Skip to content

Commit 5bee577

Browse files
authored
Merge pull request #21 from tekktrik/dev/build-wheels
Move to pyproject.toml, build wheels
2 parents 478b164 + c818ade commit 5bee577

File tree

6 files changed

+78
-93
lines changed

6 files changed

+78
-93
lines changed

.github/workflows/build.yml

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,27 @@ jobs:
1010
test:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- name: Dump GitHub context
14-
env:
15-
GITHUB_CONTEXT: ${{ toJson(github) }}
16-
run: echo "$GITHUB_CONTEXT"
1713
- name: Translate Repo Name For Build Tools filename_prefix
1814
id: repo-name
1915
run: |
20-
echo ::set-output name=repo-name::$(
16+
echo repo-name=$(
2117
echo ${{ github.repository }} |
2218
awk -F '\/' '{ print tolower($2) }' |
2319
tr '_' '-'
24-
)
25-
- name: Set up Python 3.7
26-
uses: actions/setup-python@v1
20+
) >> $GITHUB_OUTPUT
21+
- name: Set up Python 3.x
22+
uses: actions/setup-python@v4
2723
with:
28-
python-version: 3.7
24+
python-version: '3.x'
2925
- name: Versions
3026
run: |
3127
python3 --version
3228
- name: Checkout Current Repo
33-
uses: actions/checkout@v1
29+
uses: actions/checkout@v3
3430
with:
3531
submodules: true
3632
- name: Checkout tools repo
37-
uses: actions/checkout@v2
33+
uses: actions/checkout@v3
3834
with:
3935
repository: adafruit/actions-ci-circuitpython-libs
4036
path: actions-ci
@@ -44,26 +40,23 @@ jobs:
4440
source actions-ci/install.sh
4541
- name: Pip install pylint, Sphinx, pre-commit
4642
run: |
47-
pip install --force-reinstall pylint Sphinx sphinx-rtd-theme pre-commit
43+
pip install --force-reinstall Sphinx sphinx-rtd-theme pre-commit
4844
- name: Library version
4945
run: git describe --dirty --always --tags
5046
- name: Pre-commit hooks
5147
run: |
5248
pre-commit run --all-files
53-
- name: PyLint
54-
run: |
55-
pylint $( find . -path './adafruit*.py' )
5649
- name: Build docs
5750
working-directory: docs
5851
run: sphinx-build -E -W -b html . _build/html
59-
- name: Check For setup.py
52+
- name: Check For pyproject.toml
6053
id: need-pypi
6154
run: |
62-
echo ::set-output name=setup-py::$( find . -wholename './setup.py' )
55+
echo pyproject-toml=$( find . -wholename './pyproject.toml' ) >> $GITHUB_OUTPUT
6356
- name: Build Python package
64-
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
57+
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
6558
run: |
66-
pip install --upgrade setuptools wheel twine readme_renderer testresources
67-
python setup.py sdist
68-
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
6962
twine check dist/*

.github/workflows/release.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,27 @@ jobs:
1212
upload-pypi:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v1
16-
- name: Check For setup.py
15+
- uses: actions/checkout@v3
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')
22-
uses: actions/setup-python@v1
21+
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
22+
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/*

adafruit_shell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
from clint.textui import colored, prompt
3434
import adafruit_platformdetect
3535

36-
__version__ = "0.0.0-auto.0"
36+
__version__ = "0.0.0+auto.0"
3737
__repo__ = "https://github.com/adafruit/Adafruit_Python_Shell.git"
3838

3939

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)