Skip to content

Commit

Permalink
Merge pull request #21 from tekktrik/dev/build-wheels
Browse files Browse the repository at this point in the history
Move to pyproject.toml, build wheels
  • Loading branch information
makermelissa committed May 26, 2023
2 parents 478b164 + c818ade commit 5bee577
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 93 deletions.
35 changes: 14 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,27 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Translate Repo Name For Build Tools filename_prefix
id: repo-name
run: |
echo ::set-output name=repo-name::$(
echo repo-name=$(
echo ${{ github.repository }} |
awk -F '\/' '{ print tolower($2) }' |
tr '_' '-'
)
- name: Set up Python 3.7
uses: actions/setup-python@v1
) >> $GITHUB_OUTPUT
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: '3.x'
- name: Versions
run: |
python3 --version
- name: Checkout Current Repo
uses: actions/checkout@v1
uses: actions/checkout@v3
with:
submodules: true
- name: Checkout tools repo
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: adafruit/actions-ci-circuitpython-libs
path: actions-ci
Expand All @@ -44,26 +40,23 @@ jobs:
source actions-ci/install.sh
- name: Pip install pylint, Sphinx, pre-commit
run: |
pip install --force-reinstall pylint Sphinx sphinx-rtd-theme pre-commit
pip install --force-reinstall Sphinx sphinx-rtd-theme pre-commit
- name: Library version
run: git describe --dirty --always --tags
- name: Pre-commit hooks
run: |
pre-commit run --all-files
- name: PyLint
run: |
pylint $( find . -path './adafruit*.py' )
- name: Build docs
working-directory: docs
run: sphinx-build -E -W -b html . _build/html
- name: Check For setup.py
- name: Check For pyproject.toml
id: need-pypi
run: |
echo ::set-output name=setup-py::$( find . -wholename './setup.py' )
echo pyproject-toml=$( find . -wholename './pyproject.toml' ) >> $GITHUB_OUTPUT
- name: Build Python package
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
run: |
pip install --upgrade setuptools wheel twine readme_renderer testresources
python setup.py sdist
python setup.py bdist_wheel --universal
pip install --upgrade build twine
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/" {} +
python -m build
twine check dist/*
19 changes: 10 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,27 @@ jobs:
upload-pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Check For setup.py
- uses: actions/checkout@v3
- name: Check For pyproject.toml
id: need-pypi
run: |
echo ::set-output name=setup-py::$( find . -wholename './setup.py' )
echo pyproject-toml=$( find . -wholename './pyproject.toml' ) >> $GITHUB_OUTPUT
- name: Set up Python
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
uses: actions/setup-python@v1
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install --upgrade build twine
- name: Build and publish
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
env:
TWINE_USERNAME: ${{ secrets.pypi_username }}
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
python setup.py sdist
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}}/" {} +
python -m build
twine upload dist/*
2 changes: 1 addition & 1 deletion adafruit_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from clint.textui import colored, prompt
import adafruit_platformdetect

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


Expand Down
3 changes: 3 additions & 0 deletions optional_dependencies.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-FileCopyrightText: 2023 Alec Delaney, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
52 changes: 50 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,54 @@
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
# SPDX-FileCopyrightText: 2023 Alec Delaney for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense

[tool.black]
target-version = ['py35']
[build-system]
requires = [
"setuptools",
"wheel",
"setuptools-scm",
]

[project]
name = "adafruit-python-shell"
description = "Python helper for running Shell scripts in Python"
version = "0.0.0+auto.0"
readme = "README.rst"
authors = [
{name = "Adafruit Industries", email = "circuitpython@adafruit.com"}
]
urls = {Homepage = "https://github.com/adafruit/Adafruit_Python_Shell"}
keywords = [
"adafruit",
"blinka",
"circuitpython",
"micropython",
"python",
"shell",
"installation",
"raspberry",
"pi",
"console",
"terminal",
"installer",
]
license = {text = "MIT"}
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries",
"Topic :: System :: Hardware",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
]
dynamic = ["dependencies", "optional-dependencies"]

[tool.setuptools]
py-modules = ["adafruit_shell"]

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
optional-dependencies = {optional = {file = ["optional_requirements.txt"]}}
60 changes: 0 additions & 60 deletions setup.py

This file was deleted.

0 comments on commit 5bee577

Please sign in to comment.