diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 9f97e761d..d1d7f23d4 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -102,7 +102,7 @@ jobs: - name: Build source and wheel distributions run: | - python setup.py sdist bdist_wheel + make build echo "" echo "Generated files:" ls -lh dist/ diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index cdf59f1a7..8d8618544 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -23,8 +23,12 @@ defaults: jobs: + ############################################################################# + # Build the wheel and source archives and check them with Twine build: runs-on: ubuntu-latest + # Only publish from the origin repository, not forks + if: github.repository_owner == 'fatiando' steps: # Checks-out your repository under $GITHUB_WORKSPACE @@ -65,7 +69,7 @@ jobs: - name: Build source and wheel distributions run: | - python setup.py sdist bdist_wheel + make build echo "" echo "Generated files:" ls -lh dist/ @@ -82,6 +86,8 @@ jobs: name: pypi-${{ github.sha }} path: dist + ############################################################################# + # Publish built wheels and source archives to PyPI and test PyPI publish: runs-on: ubuntu-latest needs: build diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f0b371b86..e790d7f92 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -125,7 +125,7 @@ jobs: - name: Build source and wheel distributions run: | - python setup.py sdist bdist_wheel + make build echo "" echo "Generated files:" ls -lh dist/ diff --git a/Makefile b/Makefile index f0850917a..f01b97de1 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ PROJECT=verde TESTDIR=tmp-test-dir-with-unique-name PYTEST_ARGS=--cov-config=../.coveragerc --cov-report=term-missing --cov=$(PROJECT) --doctest-modules -v --pyargs -CHECK_STYLE=setup.py $(PROJECT) doc tools +CHECK_STYLE=$(PROJECT) doc tools help: @echo "Commands:" @@ -11,11 +11,15 @@ help: @echo " test run the test suite (including doctests) and report coverage" @echo " format automatically format the code" @echo " check run code style and quality checks" + @echo " build build source and wheel distributions" @echo " clean clean up build and generated files" @echo "" +build: + python -m build . + install: - pip install --no-deps -e . + python -m pip install --no-deps -e . test: # Run a tmp folder to make sure the tests are run on the installed version @@ -49,7 +53,6 @@ isort-check: flake8: flake8 $(CHECK_STYLE) - clean: find . -name "*.pyc" -exec rm -v {} \; find . -name ".coverage.*" -exec rm -v {} \; diff --git a/env/requirements-build.txt b/env/requirements-build.txt index e6bcf4331..ad255ba33 100644 --- a/env/requirements-build.txt +++ b/env/requirements-build.txt @@ -1,6 +1,3 @@ -setuptools_scm>=6.2 -setuptools>=45 -wheel +# Requirements to build and check distributions +build twine -# TOML parser dropped 3.6 and is causing problems. Remove once we drop 3.6 -tomli<2.0.0 diff --git a/environment.yml b/environment.yml index 0cf48cdaa..e95f45298 100644 --- a/environment.yml +++ b/environment.yml @@ -6,10 +6,8 @@ dependencies: - python==3.10 - pip # Build - - setuptools_scm>=6.2 - - setuptools>=45 - - wheel - twine + - build # Run - numpy - scipy diff --git a/setup.py b/setup.py deleted file mode 100644 index 6c1a54a7b..000000000 --- a/setup.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2017 The Verde Developers. -# Distributed under the terms of the BSD 3-Clause License. -# SPDX-License-Identifier: BSD-3-Clause -# -# This code is part of the Fatiando a Terra project (https://www.fatiando.org) -# -""" -Setup script for the Python package. -Metadata and build configuration are defined in setup.cfg -Uses setuptools-scm to manage version numbers using git tags. -""" -from setuptools import setup - -if __name__ == "__main__": - setup()