From 64d6e55b846c7e96f288c15eb361023d4a38c566 Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Mon, 27 Jun 2022 23:29:34 -0400 Subject: [PATCH 1/3] Change to pyproject.toml --- .github/workflows/build.yml | 11 ++++--- .github/workflows/release.yml | 14 ++++----- pyproject.toml | 44 ++++++++++++++++++++++++++++ setup.py | 55 ----------------------------------- 4 files changed, 56 insertions(+), 68 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 474520d..2957d4e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,16 +60,15 @@ jobs: - 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 ::set-output name=pyproject-toml::$( find . -wholename './pyproject.toml' ) - 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 + python -m build twine check dist/* - name: Setup problem matchers uses: adafruit/circuitpython-action-library-ci-problem-matchers@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a65e5de..8d8218f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -61,25 +61,25 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - - 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 ::set-output name=pyproject-toml::$( find . -wholename './pyproject.toml' ) - name: Set up Python - if: contains(steps.need-pypi.outputs.setup-py, 'setup.py') + if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml') uses: actions/setup-python@v2 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 + python -m build twine upload dist/* diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..00dd4c7 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,44 @@ +# SPDX-FileCopyrightText: 2022 Alec Delaney for Adafruit Industries +# +# SPDX-License-Identifier: MIT + +[build-system] +requires = [ + "setuptools", + "wheel", + "setuptools-scm", +] + +[project] +name = "adafruit-circuitpython-sht31d" +description = "CircuitPython library for SHT31-D temperature and humidity sensor." +readme = "README.rst" +keywords = [ + "adafruit", + "sht31d", + "sht31-d", + "temperature", + "humidity", + "sensor", + "hardware", + "micropython", + "circuitpython", +] +license = {text = "MIT"} +classifiers = [ + "Intended Audience :: Developers", + "Topic :: Software Development :: Libraries", + "Topic :: Software Development :: Embedded Systems", + "Topic :: System :: Hardware", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", +] +dynamic = ["version", "dependencies"] + +[tool.setuptools] +py-modules = ["adafruit_sht31d"] + +[tool.setuptools.dynamic] +dependencies = {file = ["requirements.txt"]} + +[tool.setuptools_scm] diff --git a/setup.py b/setup.py deleted file mode 100644 index 9c3f97d..0000000 --- a/setup.py +++ /dev/null @@ -1,55 +0,0 @@ -# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries -# -# SPDX-License-Identifier: MIT - -"""A setuptools based setup module. - -See: -https://packaging.python.org/en/latest/distributing.html -https://github.com/pypa/sampleproject -""" - -# Always prefer setuptools over distutils -from setuptools import setup, find_packages - -# To use a consistent encoding -from codecs import open -from os import path - -here = path.abspath(path.dirname(__file__)) - -# Get the long description from the README file -with open(path.join(here, "README.rst"), encoding="utf-8") as f: - long_description = f.read() - -setup( - name="adafruit-circuitpython-sht31d", - use_scm_version=True, - setup_requires=["setuptools_scm"], - description="CircuitPython library for SHT31-D temperature and humidity sensor.", - long_description=long_description, - long_description_content_type="text/x-rst", - # The project's main homepage. - url="https://github.com/adafruit/Adafruit_CircuitPython_SHT31-D", - # Author details - author="Adafruit Industries", - author_email="circuitpython@adafruit.com", - install_requires=["Adafruit-Blinka", "adafruit-circuitpython-busdevice"], - # Choose your license - license="MIT", - # See https://pypi.python.org/pypi?%3Aaction=list_classifiers - classifiers=[ - "Development Status :: 3 - Alpha", - "Intended Audience :: Developers", - "Topic :: Software Development :: Libraries", - "Topic :: System :: Hardware", - "License :: OSI Approved :: MIT License", - "Programming Language :: Python :: 3", - ], - # What does your project relate to? - keywords="adafruit sht31d sht31-d temperature humidity sensor" - "hardware micropython circuitpython", - # You can just specify the packages manually here if your project is - # simple. Or you can use find_packages(). - py_modules=["adafruit_sht31d"], -) From e9ab6b20ebb7f863f8da358c0a099f7cefbccbf7 Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Mon, 4 Jul 2022 15:33:02 -0400 Subject: [PATCH 2/3] Add authors and urls to pyproject.toml --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 00dd4c7..0dfdc6c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,10 @@ requires = [ name = "adafruit-circuitpython-sht31d" description = "CircuitPython library for SHT31-D temperature and humidity sensor." readme = "README.rst" +authors = [ + {name = "Adafruit Industries", email = "circuitpython@adafruit.com"} +] +urls = {Homepage = "https://github.com/adafruit/Adafruit_CircuitPython_SHT31D"} keywords = [ "adafruit", "sht31d", From ef163d856c5835413f74dac00691a2f07c525f49 Mon Sep 17 00:00:00 2001 From: Alec Delaney <89490472+tekktrik@users.noreply.github.com> Date: Mon, 4 Jul 2022 15:37:54 -0400 Subject: [PATCH 3/3] Trim trailing whitespace --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 0dfdc6c..b1991a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ readme = "README.rst" authors = [ {name = "Adafruit Industries", email = "circuitpython@adafruit.com"} ] -urls = {Homepage = "https://github.com/adafruit/Adafruit_CircuitPython_SHT31D"} +urls = {Homepage = "https://github.com/adafruit/Adafruit_CircuitPython_SHT31D"} keywords = [ "adafruit", "sht31d",