From 163ea934ba908b150eb4b96051dbec675c171071 Mon Sep 17 00:00:00 2001 From: Joost van Zwieten Date: Wed, 30 Nov 2022 09:56:44 +0100 Subject: [PATCH] use Flit as build system This patch switches the build system from setuptools (using `setup.py`) to Flit (using `pyproject.toml`). --- .github/workflows/release.yml | 4 +-- .github/workflows/test.yaml | 6 ++--- pyproject.toml | 27 +++++++++++++++++++ setup.py | 50 ----------------------------------- 4 files changed, 32 insertions(+), 55 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f7e80d0e5..34e00545f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,9 +11,9 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Install dependencies - run: python3 -m pip install setuptools wheel + run: python3 -m pip install flit - name: Build package - run: python3 setup.py sdist bdist_wheel + run: python3 -m flit build - name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@v1.1.0 with: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 1ebc08d3e..b7e43493f 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,14 +20,14 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Install build dependencies - run: python3 -m pip install setuptools wheel + run: python3 -m pip install flit - name: Build package id: build run: | # To make the wheels reproducible, set the timestamp of the (files in # the) generated wheels to the date of the commit. export SOURCE_DATE_EPOCH=`git show -s --format=%ct` - python3 setup.py sdist bdist_wheel + python3 -m flit build printf "::set-output name=wheel::%s" dist/*.whl - name: Upload package artifacts uses: actions/upload-artifact@v2 @@ -156,7 +156,7 @@ jobs: python3 -um pip install setuptools wheel python3 -um pip install --upgrade --upgrade-strategy eager .[docs] - name: Build docs - run: python3 setup.py build_sphinx --nitpicky --warning-is-error --keep-going + run: python3 -m sphinx -n -W --keep-going docs build/sphinx/html build-and-test-container-image: name: Build container image needs: build-python-package diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..8e9ac3ffe --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,27 @@ +[project] +name = "nutils" +readme = "README.md" +authors = [ + { name = "Evalf", email = "info@evalf.com" }, +] +requires-python = '~=3.7' +dependencies = [ + "appdirs~=1.0", + "bottombar~=2.0.2", + "numpy>=1.17", + "psutil~=5.0", + "stringly", + "treelog>=1.0b5", +] +dynamic = ["description", "version"] + +[project.optional-dependencies] +docs = ["Sphinx>=1.8"] +export_mpl = ["matplotlib>=1.3", "pillow>2.6"] +matrix_mkl = ["mkl"] +matrix_scipy = ["scipy>=0.13"] +import_gmsh = ["meshio"] + +[build-system] +requires = ["flit_core >=3.2,<4"] +build-backend = "flit_core.buildapi" diff --git a/setup.py b/setup.py deleted file mode 100644 index d9b7926dc..000000000 --- a/setup.py +++ /dev/null @@ -1,50 +0,0 @@ -import re -import os -from setuptools import setup - -long_description = """ -Nutils is a Free and Open Source Python programming library for Finite Element -Method computations, developed by `Evalf Computing `_ and -distributed under the permissive MIT license. Key features are a readable, math -centric syntax, an object oriented design, strict separation of topology and -geometry, and high level function manipulations with support for automatic -differentiation. - -Nutils provides the tools required to construct a typical simulation workflow -in just a few lines of Python code, while at the same time leaving full -flexibility to build novel workflows or interact with third party tools. With -native support for Isogeometric Analysis (IGA), the Finite Cell method (FCM), -multi-physics, mixed methods, and hierarchical refinement, Nutils is at the -forefront of numerical discretization science. Efficient under-the-hood -vectorization and built-in parallellisation provide for an effortless -transition from academic research projects to full scale, real world -applications. -""" - -with open(os.path.join('nutils', '__init__.py')) as f: - version = next(filter(None, map(re.compile("^version = '([a-zA-Z0-9.]+)'$").match, f))).group(1) - -setup( - name='nutils', - version=version, - description='Numerical Utilities for Finite Element Analysis', - author='Evalf', - author_email='info@nutils.org', - url='http://nutils.org', - download_url='https://github.com/nutils/nutils/releases', - packages=['nutils', 'nutils.matrix'], - long_description=long_description, - license='MIT', - python_requires='>=3.7', - install_requires=['numpy>=1.17', 'treelog>=1.0b5', 'stringly', 'appdirs~=1.0', 'bottombar~=2.0.2', 'psutil~=5.0'], - extras_require=dict( - docs=['Sphinx>=1.8'], - matrix_scipy=['scipy>=0.13'], - matrix_mkl=['mkl'], - export_mpl=['matplotlib>=1.3', 'pillow>2.6'], - import_gmsh=['meshio'], - ), - command_options=dict( - test=dict(test_loader=('setup.py', 'unittest:TestLoader')), - ), -)