diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml new file mode 100644 index 000000000..b4a769d33 --- /dev/null +++ b/.github/workflows/build-wheels.yml @@ -0,0 +1,79 @@ +name: Build wheels + +# By default this action does not push to test or production PyPI. The wheels +# are available as an artifact that can be downloaded and tested locally. + +on: + workflow_dispatch: + inputs: + ufl_ref: + description: "UFL git ref to checkout" + default: "main" + type: string + test_pypi_publish: + description: "Publish to Test PyPi (true | false)" + default: false + type: boolean + pypi_publish: + description: "Publish to PyPi (true | false)" + default: false + type: boolean + + workflow_call: + inputs: + ufl_ref: + description: "UFL git ref to checkout" + default: "main" + type: string + test_pypi_publish: + description: "Publish to Test PyPi (true | false)" + default: false + type: boolean + pypi_publish: + description: "Publish to PyPi (true | false))" + default: false + type: boolean + +jobs: + build: + name: Build wheels and source distributions + runs-on: ubuntu-latest + steps: + - name: Checkout UFL + uses: actions/checkout@v2 + with: + ref: ${{ inputs.ufl_ref }} + + - name: Upgrade pip and setuptools + run: python -m pip install setuptools pip build --upgrade + + - name: Build sdist and wheel + run: python -m build . + + - uses: actions/upload-artifact@v2 + with: + path: dist/* + + upload_pypi: + name: Upload to PyPI (optional) + needs: [build] + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v2 + with: + name: artifact + path: dist + + - uses: pypa/gh-action-pypi-publish@v1.4.2 + if: ${{ inputs.test_pypi_publish }} + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} + repository_url: https://pypi.org/legacy/ + + - uses: pypa/gh-action-pypi-publish@v1.4.2 + if: ${{ inputs.pypi_publish }} + with: + user: __token__ + password: ${{ secrets.PYPI_TEST_TOKEN }} + repository_url: https://test.pypi.org/legacy/ diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index cd8ef9cfc..8957fc083 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -22,18 +22,17 @@ jobs: python-version: ${{ matrix.python-version }} - name: Lint with flake8 run: | - pip install flake8 + python -m pip install flake8 flake8 --statistics . - name: Check documentation style run: | - pip install pydocstyle + python -m pip install pydocstyle python -m pydocstyle . - name: Install UFL - run: pip install . + run: python -m pip install .[ci] - name: Run unit tests run: | - pip install coveralls coverage pytest pytest-cov pytest-xdist - pytest -n auto --cov=ufl/ --junitxml=junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}.xml test/ + python -m pytest -n auto --cov=ufl/ --junitxml=junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}.xml test/ - name: Upload to Coveralls if: ${{ github.repository == 'FEniCS/ufl' && github.head_ref == '' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8' }} env: diff --git a/MANIFEST.in b/MANIFEST.in index 5069eb534..32f7b9f50 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,7 +1,7 @@ include AUTHORS include COPYING include COPYING.LESSER -include ChangeLog +include ChangeLog.rst recursive-include demo * recursive-include doc * recursive-include test * diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..9bf811c37 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,4 @@ +[build-system] +requires = ["setuptools>=58", "wheel"] + +build-backend = "setuptools.build_meta" diff --git a/release.conf b/release.conf deleted file mode 100644 index cfe8c7c2a..000000000 --- a/release.conf +++ /dev/null @@ -1,8 +0,0 @@ -# Configuration file for fenics-release - -PACKAGE="ufl" -BRANCH="master" -FILES="ChangeLog.rst \ - setup.py \ - doc/sphinx/source/releases/next.rst \ - doc/sphinx/source/releases.rst" diff --git a/setup.cfg b/setup.cfg index ea36a24fd..2eb8687d5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,61 @@ +# Setuptools does not yet support modern pyproject.toml but will do so in the +# future +[metadata] +name = fenics-ufl +version = 2021.2.0.dev0 +author = FEniCS Project Contributors +email = fenics-dev@googlegroups.com +maintainer = FEniCS Project Steering Council +description = Unified Form Language +url = https://github.com/FEniCS/ufl +project_urls = + Homepage = https://fenicsproject.org + Documentation = https://fenics.readthedocs.io/projects/ufl + Issues = https://github.com/FEniCS/ufl/issues + Funding = https://numfocus.org/donate +long_description = file: README.rst +long_description_content_type = text/rst +license=LGPL-3.0-or-later +classifiers = + Development Status :: 5 - Production/Stable + Intended Audience :: Developers + Intended Audience :: Science/Research + License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+) + Operating System :: POSIX + Operating System :: POSIX :: Linux + Operating System :: MacOS :: MacOS X + Programming Language :: Python + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Topic :: Scientific/Engineering :: Mathematics + Topic :: Software Development :: Libraries :: Python Modules + +[options] +packages = find: +include_package_data = True +zip_safe = False +python_requires = >= 3.7 +setup_requires = + setuptools >= 58 + wheel +install_requires = + numpy + +[options.extras_require] +docs = sphinx; sphinx_rtd_theme +lint = flake8; pydocstyle[toml] +test = pytest +ci = + coverage + coveralls + pytest-cov + pytest-xdist + fenics-ufl[docs] + fenics-ufl[lint] + fenics-ufl[test] + [flake8] ignore = E501, W504, E741 # ambiguous variable name @@ -10,6 +68,6 @@ ignore = D100,D101,D102,D103,D104,D105,D107, D200,D202, D203, # this error should be disabled D204,D205,D208,D209,D210,D212,D213, - D300,D301, + D300,D301, D400,D401,D402,D404,D415,D416 -# convention = numpy + E741 # Variable names l, O, I, ... diff --git a/setup.py b/setup.py index 51e848bbe..96c29333e 100755 --- a/setup.py +++ b/setup.py @@ -1,51 +1,9 @@ -# -*- coding: utf-8 -*- +import setuptools -from setuptools import setup +# Can be removed when pip editable user installs are fixed +# https://github.com/pypa/pip/issues/7953 +import site import sys +site.ENABLE_USER_SITE = "--user" in sys.argv[1:] -if sys.version_info < (3, 6): - print("Python 3.6 or higher required, please upgrade.") - sys.exit(1) - -version = "2021.1.0" - -url = "https://github.com/FEniCS/ufl" - -CLASSIFIERS = """\ -Development Status :: 5 - Production/Stable -Intended Audience :: Developers -Intended Audience :: Science/Research -License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+) -Operating System :: POSIX -Operating System :: POSIX :: Linux -Operating System :: MacOS :: MacOS X -Operating System :: Microsoft :: Windows -Programming Language :: Python -Programming Language :: Python :: 3 -Programming Language :: Python :: 3.6 -Programming Language :: Python :: 3.7 -Programming Language :: Python :: 3.8 -Programming Language :: Python :: 3.9 -Topic :: Scientific/Engineering :: Mathematics -Topic :: Software Development :: Libraries :: Python Modules -""" - -setup( - name="fenics-ufl", - version=version, - description="Unified Form Language", - author="FEniCS Project Team", - author_email="fenics-dev@googlegroups.com", - url=url, - classifiers=[_f for _f in CLASSIFIERS.split('\n') if _f], - packages=[ - "ufl", - "ufl.utils", - "ufl.finiteelement", - "ufl.core", - "ufl.corealg", - "ufl.algorithms", - "ufl.formatting", - ], - package_dir={"ufl": "ufl"}, - install_requires=["numpy"]) +setuptools.setup()