Skip to content

Commit

Permalink
Merge pull request #66 from swryan/setuptools
Browse files Browse the repository at this point in the history
Removed setuptools as a dependency
  • Loading branch information
swryan authored May 29, 2024
2 parents 1c02e4a + d1cfdd4 commit 14a5b85
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 76 deletions.
30 changes: 19 additions & 11 deletions .github/workflows/test_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
PY: '3.12'
NUMPY: '1.26'
SCIPY: '1.13'
MPI4PY: true
MPICC: 4
PYOPTSPARSE: 'default'
PAROPT: true
SNOPT: 7.7
Expand All @@ -76,10 +76,10 @@ jobs:
# test baseline versions on MacOS
- NAME: MacOS Baseline
OS: macos-13
PY: '3.12'
PY: '3.11'
NUMPY: '1.26'
SCIPY: '1.13'
MPI4PY: true
MPICC: 4
PYOPTSPARSE: 'default'
PAROPT: true
SNOPT: 7.7
Expand All @@ -90,7 +90,7 @@ jobs:
PY: 3
NUMPY: 1
SCIPY: 1
MPI4PY: true
MPICC: 4
PYOPTSPARSE: 'latest'
PAROPT: true
SNOPT: 7.7
Expand Down Expand Up @@ -118,10 +118,9 @@ jobs:
# test baseline versions on MacOS without MPI with forced build
- NAME: MacOS Baseline, no MPI, forced build
OS: macos-12
PY: '3.12'
PY: '3.11'
NUMPY: '1.26'
SCIPY: '1.13'
MPI4PY: true
PYOPTSPARSE: 'default'
SNOPT: 7.7
FORCE_BUILD: true
Expand All @@ -132,7 +131,6 @@ jobs:
PY: 3
NUMPY: 1
SCIPY: 1
MPI4PY: true
PYOPTSPARSE: 'latest'
SNOPT: 7.7
FORCE_BUILD: true
Expand Down Expand Up @@ -197,23 +195,23 @@ jobs:

- name: Install
run: |
conda install numpy=${{ matrix.NUMPY }} scipy=${{ matrix.SCIPY }} -q -y
conda install numpy=${{ matrix.NUMPY }} scipy=${{ matrix.SCIPY }} compilers cython swig -q -y
python -m pip install --upgrade pip
python -m ensurepip --upgrade
echo "============================================================="
echo "Install build_pyoptsparse"
echo "============================================================="
python -m pip install .
- name: Install MPI
if: matrix.MPI4PY
if: matrix.MPICC
run: |
echo "============================================================="
echo "Install MPI"
echo "============================================================="
conda install cython swig compilers openmpi-mpicc mpi4py -q -y
conda install openmpi-mpicc=${{ matrix.MPICC }} mpi4py -q -y
echo "OMPI_MCA_rmaps_base_oversubscribe=1" >> $GITHUB_ENV
Expand Down Expand Up @@ -297,6 +295,16 @@ jobs:
echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
- name: Display build log
if: failure()
run: |
for f in $(find /tmp/ -name 'meson-log.txt'); do
echo "============================================================="
echo $f
echo "============================================================="
cat $f
done
# Enable tmate debugging of manually-triggered workflows if the input option was provided
#
# To access the terminal through the web-interface:
Expand Down
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.0.10'
__version__ = '2.0.11'
22 changes: 2 additions & 20 deletions build_pyoptsparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from colors import *
from shutil import which
from packaging.version import Version, parse
import setuptools


# Default options that the user can change with command line switches
opts = {
Expand Down Expand Up @@ -935,25 +935,7 @@ def install_pyoptsparse_from_src():

if opts['build_pyoptsparse'] is True:
patch_pyoptsparse_src()

python_ver = Version(platform.python_version())
stools_ver = Version(setuptools.__version__)
if python_ver < Version('3.12.0') and stools_ver >= Version('66.0'):
# `numpy.distutils` is deprecated since NumPy 1.23.0, as a result
# of the deprecation of `distutils` itself. It will be removed for
# Python >= 3.12. For older Python versions it will remain present.
# It is recommended to use `setuptools < 60.0` for those Python versions.
# For more details, see:
# https://numpy.org/devdocs/reference/distutils_status_migration.html
pip_install(pip_install_args=['setuptools<66.0'], pkg_desc='setuptools<66.0')
pip_install(pip_install_args=['--no-cache-dir', './'], pkg_desc='pyoptsparse')
try:
pip_install(pip_install_args=[f'setuptools=={stools_ver}'],
pkg_desc='previous version of setuptools')
except Exception:
print(f'Unable to restore previous version of setuptools ({stools_ver})')
else:
pip_install(pip_install_args=['--no-cache-dir', './'], pkg_desc='pyoptsparse')
pip_install(pip_install_args=['--no-cache-dir', './'], pkg_desc='pyoptsparse')
else:
announce('Not building pyOptSparse by request')
if opts['include_ipopt'] is True:
Expand Down
41 changes: 41 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "build-pyoptsparse"
dynamic = ["version"]
description = "Automated installer for pyOptSparse"
readme = "README.md"
license = "Apache-2.0"
requires-python = ">=3.7"
authors = [
{ name = "OpenMDAO Team", email = "[email protected]" },
]
dependencies = [
"ansicolors",
"numpy",
"packaging",
"sqlitedict",
]

[project.optional-dependencies]
paropt = [
"cython",
"mpi4py",
]

[project.scripts]
build-pyoptsparse = "build_pyoptsparse:perform_install"
build_pyoptsparse = "build_pyoptsparse:perform_install"

[project.urls]
Homepage = "http://openmdao.org"

[tool.hatch.version]
path = "__init__.py"

[tool.hatch.build.targets.sdist]
include = [
"/",
]
44 changes: 0 additions & 44 deletions setup.py

This file was deleted.

0 comments on commit 14a5b85

Please sign in to comment.