Skip to content

Commit

Permalink
Build changes for 2.16
Browse files Browse the repository at this point in the history
1. setup.py -> pyproject.toml new standard, PEP 621.
2. all source code now under `src`.

This is a start for the new standard. Main issue is build isolation
forces CMake caching to break, so I have disabled the caching for now.
  • Loading branch information
julesghub committed Nov 14, 2024
1 parent 354ba88 commit e0d9960
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 28 deletions.
55 changes: 54 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,56 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = ["setuptools","numpy>=1.20.3","swig>=4.0.0","cmake>=0.29.24", "ninja"]
requires = [
"setuptools",
"numpy<2.0", # as per petsc
"swig>=4.0.0",
"cmake>=0.29.24",
"ninja"
]

[project]
name = "underworld"
version = "2.16.0"
authors = [
{name = "Louis Moresi", email="[email protected]"},
{name = "Julian Giordani", email="[email protected]"},
{name = "John Mansour", email="[email protected]"},
{name = "Romain Beaucher", email="[email protected]"},
]
maintainers = [
{name = "Underworld Team", email="[email protected]"},
]
dependencies = [
"numpy>=1.20.3",
"mpi4py>=1.2.2",
"h5py",
"pint",
"scipy",
]
description = "Underworld2 is a python-friendly, parallel, scalable, easy-to-use toolkit for solving problems in solid and fluid mechanics."
readme = "README.md"
license = {file = "./LICENSE.md"}
keywords = ["Underworld", "MPI", "Geodynamics"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Operating System :: POSIX",
"Programming Language :: C",
"Programming Language :: C++",
"Programming Language :: Python",
"Topic :: Scientific/Engineering",
"Topic :: Software Development :: Libraries",
]
[project.optional-dependencies]
full = [
"badlands",
"lavavu",
"matplotlib",
"nbmake",
]

[project.urls]
homepage = "https://www.underworldcode.org"
repository = "https://github.com/underworldcode/underworld2"
documentation = "https://underworld2.readthedocs.io/en/latest/"
38 changes: 11 additions & 27 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

from typing import List
from pathlib import Path
from setuptools import setup, Extension, find_packages
from setuptools import setup, Extension, find_namespace_packages
from setuptools.command.build_ext import build_ext


Expand Down Expand Up @@ -259,23 +259,12 @@ def extend_cmake_prefix_path(path: str) -> None:
metadata = {
'provides': ['underworld'],
'zip_safe': False,
'install_requires': ['numpy>=1.20.3', 'mpi4py>=1.2.2', 'h5py', 'pint', 'scipy'],
'extras_require': {
'full': ["badlands","lavavu","matplotlib","nbmake"], # for all 3rd party packages
},
# 'install_requires': ['numpy>=1.20.3', 'mpi4py>=1.2.2', 'h5py', 'pint', 'scipy'],
# 'extras_require': {
# 'full': ["badlands","lavavu","matplotlib","nbmake"], # for all 3rd party packages
# },
}

classifiers = """
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
Intended Audience :: Science/Research
Operating System :: POSIX
Programming Language :: C
Programming Language :: C++
Programming Language :: Python
Topic :: Scientific/Engineering
Topic :: Software Development :: Libraries
"""

version = {}
with open("src/underworld/_version.py") as fp:
Expand All @@ -298,31 +287,26 @@ def extend_cmake_prefix_path(path: str) -> None:
functionality of the code running in a parallel HPC environment.",
long_description=long_description,
long_description_content_type="text/markdown",
classifiers=classifiers.split('\n')[1:-1],
keywords=['Underworld', 'MPI', 'Geodynamics'],
platforms=['POSIX'],
license='LGPL-3',

url='https://github.com/underworldcode/underworld2',
download_url="",

author='Underworld Team',
author_email='[email protected]',
maintainer='Underworld Team',
maintainer_email='[email protected]',
include_package_data=True, # use the file './MANIFEST.in' for package data files
package_dir={"":"src"}, # directory containing underworld package
packages=find_packages(
packages=find_namespace_packages(
where='src',
include = ['underworld', 'UWGeodynamics'],),
include = ['underworld*', 'UWGeodynamics*'],),
ext_modules=[
CMakeExtension(name='libUnderworld',
install_prefix="underworld",
source_dir=str(Path("src/underworld/libUnderworld").absolute()),
cmake_configure_options=[
f"-DPython3_ROOT_DIR={Path(sys.prefix)}",
"-DCALL_FROM_SETUP_PY:BOOL=ON"]
#, cmake_build_type="Debug" ## Uncomment for debug
"-DCALL_FROM_SETUP_PY:BOOL=ON",
"--fresh", # force no cache, important for python isolation builds as build tools will change location
#"cmake_build_type="Debug" ## Uncomment for debug
],
),
],
cmdclass=dict(build_ext=BuildExtension),
Expand Down

0 comments on commit e0d9960

Please sign in to comment.