Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 98 additions & 24 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"

- name: Set up Python 3.11
uses: actions/setup-python@v5
Expand All @@ -28,8 +30,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --editable .[check,test]
pip install "coveralls>=3.0.0"
pip install -v --editable '.[check]'

- name: black check
run: |
Expand All @@ -43,64 +44,137 @@ jobs:
run: |
python -m isort --check --diff --color .

- name: pylint check
- name: ruff check
run: |
python -m pylint src/anaflow/
python -m ruff check src/

- name: coveralls check
- name: cython-lint check
run: |
python -m pytest --cov anaflow --cov-report term-missing -v tests/
python -m coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
cython-lint src/anaflow/

build_sdist:
name: sdist on ${{ matrix.os }} with py ${{ matrix.python-version }}
build_wheels:
name: wheels for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-15-intel, macos-latest] # windows-11-arm (no scipy)

steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
fetch-depth: "0"

- name: Build wheels
uses: pypa/cibuildwheel@v3.2.1
with:
output-dir: dist-wheel-${{ matrix.os }}

- uses: actions/upload-artifact@v4
with:
name: dist-wheel-${{ matrix.os }}
path: ./dist-wheel-${{ matrix.os }}/*.whl

- name: Set up Python ${{ matrix.python-version }}
build_sdist:
name: sdist on ${{ matrix.os }} with py ${{ matrix.ver.py }} numpy${{ matrix.ver.np }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
[ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-14]
ver:
- { py: "3.9", np: "==1.20.0", sp: "==1.5.4" }
- { py: "3.10", np: "==1.21.6", sp: "==1.7.2" }
- { py: "3.11", np: "==1.23.2", sp: "==1.9.2" }
- { py: "3.12", np: "==1.26.2", sp: "==1.11.2" }
- { py: "3.13", np: "==2.1.0", sp: "==1.14.1" }
- { py: "3.14", np: "==2.3.2", sp: "==1.16.1" }
- { py: "3.14", np: ">=2.3.2", sp: ">=1.16.1" }
exclude:
- os: ubuntu-24.04-arm
ver: { py: "3.8", np: "==1.20.0", sp: "==1.5.4" }
- os: macos-14
ver: { py: "3.8", np: "==1.20.0", sp: "==1.5.4" }
- os: macos-14
ver: { py: "3.9", np: "==1.20.0", sp: "==1.5.4" }
- os: macos-14
ver: { py: "3.10", np: "==1.21.6", sp: "==1.7.2" }
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"

- name: Set up Python ${{ matrix.ver.py }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: ${{ matrix.ver.py }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
pip install --editable .[test]

- name: Install anaflow
run: |
pip install -v --editable .[test]

- name: Run tests
run: |
python -m pytest --cov anaflow --cov-report term-missing -v tests/
pip install "numpy${{ matrix.ver.np }}" "scipy${{ matrix.ver.sp }}"
python -m pytest -v tests/

- name: Build sdist
run: |
python -m build
# PEP 517 package builder from pypa
python -m build --sdist --outdir dist-sdist .

- uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
if: matrix.os == 'ubuntu-latest' && matrix.ver.py == '3.11'
with:
name: dist
path: dist/*
name: dist-sdist
path: dist-sdist/*.tar.gz

coverage:
name: coverage
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'

- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install "coveralls>=3.0.0"

- name: Install anaflow
run: |
pip install -v --editable .[test]

- name: Run tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pip install "numpy${{ matrix.ver.np }}"
python -m pytest --cov anaflow --cov-report term-missing -v tests/
python -m coveralls --service=github

upload_to_pypi:
needs: [build_sdist]
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v4
with:
name: dist
pattern: dist-*
merge-multiple: true
path: dist

- name: Publish to Test PyPI
Expand Down
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
prune **
recursive-include tests *.py
recursive-include src/anaflow *.py *.pyx
include LICENSE README.md pyproject.toml setup.py
93 changes: 42 additions & 51 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
[build-system]
requires = [
"hatchling>=1.8.0",
"hatch-vcs",
"setuptools>=77",
"wheel",
"Cython>=3",
"numpy>=2",
"scipy>=1.5.4",
"pentapy>=1.1.0,<2",
"setuptools_scm[toml]>=7",
]
build-backend = "hatchling.build"
build-backend = "setuptools.build_meta"

[project]
requires-python = ">=3.8"
requires-python = ">=3.9"
name = "anaflow"
authors = [{name = "Sebastian Mueller", email = "sebastian.mueller@ufz.de"}]
readme = "README.md"
license = "MIT"
license-files = ["LICENSE"]
dynamic = ["version"]
description = "AnaFlow - analytical solutions for the groundwater-flow equation."
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: End Users/Desktop",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: MacOS",
"Operating System :: MacOS :: MacOS X",
Expand All @@ -29,20 +34,20 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Scientific/Engineering",
"Topic :: Software Development",
"Topic :: Utilities",
]
dependencies = [
"numpy>=1.14.5",
"numpy>=1.20.0",
"pentapy>=1.1.0,<2",
"scipy>=1.1.0",
"scipy>=1.5.4",
]

[project.optional-dependencies]
Expand All @@ -58,7 +63,8 @@ test = ["pytest-cov>=3"]
check = [
"black>=25",
"isort[colors]",
"pylint",
"ruff>=0.5.0",
"cython-lint",
]

[project.urls]
Expand All @@ -69,33 +75,18 @@ Tracker = "https://github.com/GeoStat-Framework/anaflow/issues"
Changelog = "https://github.com/GeoStat-Framework/anaflow/blob/main/CHANGELOG.md"
Conda-Forge = "https://anaconda.org/conda-forge/anaflow"

[tool.hatch.version]
source = "vcs"
fallback_version = "0.0.0.dev0"

[tool.hatch.version.raw-options]
[tool.setuptools_scm]
write_to = "src/anaflow/_version.py"
write_to_template = "__version__ = '{version}'"
local_scheme = "no-local-version"

[tool.hatch.build.hooks.vcs]
version-file = "src/anaflow/_version.py"
template = "__version__ = '{version}'"

[tool.hatch.build.targets.sdist]
include = [
"/src",
"/tests",
]

[tool.hatch.build.targets.wheel]
packages = ["src/anaflow"]
fallback_version = "0.0.0.dev0"

[tool.isort]
profile = "black"
multi_line_output = 3

[tool.black]
target-version = [
"py38",
"py39",
"py310",
"py311",
Expand All @@ -120,27 +111,27 @@ target-version = [
"def __str__",
]

[tool.pylint]
[tool.pylint.master]
extension-pkg-whitelist = [
"numpy",
"scipy",
]
ignore = "_version.py"

[tool.pylint.message_control]
disable = [
"R0801",
]

[tool.pylint.reports]
output-format = "colorized"
[tool.ruff]
line-length = 88
target-version = "py39"
exclude = ["_version.py"]

[tool.ruff.lint]
select = [
"E",
"F",
"W",
"I",
]

[tool.pylint.design]
max-args = 25
max-locals = 50
max-branches = 30
max-statements = 80
max-attributes = 25
max-public-methods = 75
max-positional-arguments=25
[tool.cibuildwheel]
# Switch to using build
build-frontend = "build"
# Disable building py3.6/7/8, pp3.8, 32bit linux
skip = ["*-win32", "*_i686", "*-musllinux_*", "cp31?t-*"]
# Run the package tests using `pytest`
test-extras = "test"
test-command = "pytest -v {package}/tests"

environment.PIP_ONLY_BINARY = "numpy,scipy"
environment.PIP_PREFER_BINARY = "1"
31 changes: 31 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from __future__ import annotations

from pathlib import Path

import numpy as np
from Cython.Build import cythonize
from setuptools import Extension, setup

SRC_DIR = Path("src")
MODULE_PATH = SRC_DIR / "anaflow" / "flow"
MODULE_NAME = "anaflow.flow._laplace_accel"

extensions = [
Extension(
MODULE_NAME,
[str(MODULE_PATH / "_laplace_accel.pyx")],
include_dirs=[np.get_include()],
)
]

extensions = cythonize(
extensions,
language_level=3,
compiler_directives={
"boundscheck": False,
"wraparound": False,
"initializedcheck": False,
},
)

setup(ext_modules=extensions, package_dir={"": "src"})
Loading