From 6d83e26ab35fffffc6f35180f8dc8c35ba217b05 Mon Sep 17 00:00:00 2001 From: Alexandru Fikl Date: Mon, 2 Dec 2024 15:39:37 +0100 Subject: [PATCH 1/2] switch from setup.py to pyproject.toml --- .gitignore | 1 + pyproject.toml | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 35 ------------------------------- 3 files changed, 57 insertions(+), 35 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.gitignore b/.gitignore index a4d3737..205aa1f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ docs/_build/ **/*.so **/__pycache__ jitcode/version.py +*.egg-info/ diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..2b9a3d4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,56 @@ +[build-system] +build-backend = "setuptools.build_meta" +requires = [ + "setuptools>=64", + "setuptools-scm>=7", +] + +[project] +name = "jitcode" +dynamic = ["version"] +description = "Just-in-Time Compilation for Ordinary Differential Equations" +readme = "README.rst" +license = { text = "BSD-3-Clause" } +authors = [ + { name = "Gerrit Ansmann", email = "gansmann@uni-bonn.de" }, +] +requires-python = ">=3.6" +classifiers = [ + "Development Status :: 4 - Beta", + "License :: OSI Approved :: BSD License", + "Operating System :: POSIX", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows", + "Programming Language :: Python", + "Topic :: Scientific/Engineering :: Mathematics", +] +dependencies = [ + "jitcxde_common>=1.5.4", + "numpy", + "scipy", + "symengine>=0.3.1.dev0", +] + +[project.optional-dependencies] +test = [ + # NOTE: required for expr.simplify (symengine calls sympy for that) + # https://github.com/symengine/symengine.py/issues/405 + "sympy" +] + +[project.urls] +Documentation = "https://jitcode.readthedocs.io" +Homepage = "http://github.com/neurophysik/jitcode" + +[tool.setuptools.packages.find] +include = [ + "jitcode*", +] + +[tool.setuptools.package-data] +jitcode = [ + "jitced_template.c", +] + +[tool.setuptools_scm] +write_to = "jitcode/version.py" diff --git a/setup.py b/setup.py deleted file mode 100644 index 78684b0..0000000 --- a/setup.py +++ /dev/null @@ -1,35 +0,0 @@ -from setuptools import setup -from io import open - -requirements = [ - 'jitcxde_common>=1.5.4', - 'symengine>=0.3.1.dev0', - 'scipy', - 'numpy' -] - -setup( - name = 'jitcode', - description = 'Just-in-Time Compilation for Ordinary Differential Equations', - long_description = open('README.rst', encoding='utf8').read(), - author = 'Gerrit Ansmann', - author_email = 'gansmann@uni-bonn.de', - url = 'http://github.com/neurophysik/jitcode', - python_requires=">=3.3", - packages = ['jitcode'], - package_data = {'jitcode': ['jitced_template.c']}, - include_package_data = True, - install_requires = requirements, - setup_requires = ['setuptools_scm'], - use_scm_version = {'write_to': 'jitcode/version.py'}, - classifiers = [ - 'Development Status :: 4 - Beta', - 'License :: OSI Approved :: BSD License', - 'Operating System :: POSIX', - 'Operating System :: MacOS :: MacOS X', - 'Operating System :: Microsoft :: Windows', - 'Programming Language :: Python', - 'Topic :: Scientific/Engineering :: Mathematics', - ], -) - From 75db6bb22cdcc18b5d60453639724b21bd390631 Mon Sep 17 00:00:00 2001 From: Alexandru Fikl Date: Mon, 2 Dec 2024 16:37:29 +0100 Subject: [PATCH 2/2] add unittesting on Github Actions --- .github/workflows/ci.yml | 55 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1df0059 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,55 @@ +name: CI + +on: + push: + branches: [ 'master' ] + pull_request: + branches: [ 'master' ] + schedule: + # at 12:00 (UTC) on the first day of the month + - cron: '0 12 1 * *' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test: + name: Unittest (${{ matrix.os }}-${{ matrix.compiler }}-py${{ matrix.python-version }}) + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + compiler: [gcc, clang] + python-version: ['3.10', '3.x'] + include: + - os: ubuntu-20.04 + python-version: '3.6' + compiler: gcc + - os: ubuntu-20.04 + python-version: '3.6' + compiler: clang + fail-fast: false + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install System Dependencies + if: matrix.os == 'ubuntu-latest' && matrix.compiler == 'clang' + run: | + sudo apt-get install libomp5 libomp-dev + + - name: Install Python Dependencies + run: | + python -m pip install --upgrade pip setuptools setuptools-scm wheel + python -m pip install --upgrade numpy scipy jitcxde_common sympy + + - name: Run Tests + env: + CC: ${{ matrix.compiler }} + run: | + python -m pip install --verbose --no-build-isolation --editable . + python -m unittest discover -b -f -v tests