diff --git a/pyproject.toml b/pyproject.toml index df920602af..60b4432478 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,25 @@ +[project] +name = "GalSim" +description = "The modular galaxy image simulation toolkit" +readme = "README.rst" +requires-python = ">=3.9" +license-files = ["LICENSE"] +authors = [{ name = "GalSim Developers" }, { name = "Mike Jarvis", email = "michael@jarvis.net" }] +dependencies = ["LSSTDESC.Coord", "astropy"] +dynamic = ["version"] + +[project.urls] +repository = "https://github.com/GalSim-developers/GalSim" + +[project.scripts] +galsim = "galsim.__main__:run_main" +galsim_download_cosmos = "galsim.download_cosmos:run_main" + +[project.optional-dependencies] +test = ["pytest", "pytest-xdist", "pytest-timeout", "scipy", "pyyaml"] + [build-system] -requires = ["setuptools>=38", "wheel", "pybind11>=2.2"] +requires = ["numpy>=1.17", "pybind11>=2.2", "setuptools>=38"] [tool.cibuildwheel] # share cache directory between runs by using host mount @@ -18,5 +38,16 @@ MACOSX_DEPLOYMENT_TARGET = "14.0" [tool.pytest.ini_options] testpaths = [ - "tests", + "tests", ] + +[tool.setuptools] +zip-safe = false + +[tool.setuptools.packages.find] + +[tool.setuptools.package-data] +"galsim" = ["share/**", "include/**"] + +[tool.setuptools_scm] +version_file = "galsim/_version.py" diff --git a/setup.py b/setup.py index 8d5c9431e8..929ffce9ea 100644 --- a/setup.py +++ b/setup.py @@ -15,35 +15,28 @@ # this list of conditions, and the disclaimer given in the documentation # and/or other materials provided with the distribution. # -import sys,os,glob,re import ctypes import ctypes.util -import types -import subprocess +import glob +import os import re +import shutil +import subprocess +import sys +import tarfile import tempfile +import types import urllib.request as urllib2 -import tarfile -import shutil -try: - from setuptools import setup, Extension, find_packages - from setuptools.command.build_ext import build_ext - from setuptools.command.build_clib import build_clib - from setuptools.command.install import install - from setuptools.command.install_scripts import install_scripts - from setuptools.command.easy_install import easy_install - from setuptools.command.test import test - import setuptools - print("Using setuptools version",setuptools.__version__) -except ImportError: - print() - print("****") - print(" Installation requires setuptools version >= 38.") - print(" Please upgrade or install with pip install -U setuptools") - print("****") - print() - raise +import setuptools +from setuptools import Extension, setup +from setuptools.command.build_clib import build_clib +from setuptools.command.build_ext import build_ext +from setuptools.command.easy_install import easy_install +from setuptools.command.install import install +from setuptools.command.install_scripts import install_scripts + +print("Using setuptools version",setuptools.__version__) # Turn this on for more verbose debugging output about compile attempts. debug = False @@ -1008,8 +1001,8 @@ def do_build_libraries(self, libraries): class my_build_shared_clib(my_build_clib): def do_build_libraries(self, libraries): - from distutils.errors import DistutilsSetupError from distutils import log + from distutils.errors import DistutilsSetupError try: from setuptools.modified import newer_pairwise_group except ImportError: @@ -1319,16 +1312,10 @@ def run(self): undef_macros = undef_macros, extra_link_args = ["-lfftw3"]) -build_dep = ['setuptools>=38', 'pybind11>=2.2', 'numpy>=1.17'] -run_dep = ['astropy', 'LSSTDESC.Coord'] -test_dep = ['pytest', 'pytest-xdist', 'pytest-timeout', 'scipy', 'pyyaml'] # If Eigen doesn't exist in the normal places, download it. find_eigen_dir(output=True) -with open('README.rst') as file: - long_description = file.read() - # Read in the galsim version from galsim/_version.py # cf. http://stackoverflow.com/questions/458550/standard-way-to-embed-version-into-python-package version_file=os.path.join('galsim','_version.py') @@ -1386,23 +1373,11 @@ def run(self): headers.append(version_h_file) -dist = setup(name="GalSim", - python_requires=">=3.9", +dist = setup( version=galsim_version, - author="GalSim Developers (point of contact: Mike Jarvis)", - author_email="michael@jarvis.net", - description="The modular galaxy image simulation toolkit", - long_description=long_description, - license = "BSD License", - url="https://github.com/GalSim-developers/GalSim", download_url="https://github.com/GalSim-developers/GalSim/releases/tag/v%s.zip"%galsim_version, - packages=find_packages(), - package_data={'galsim' : shared_data + headers}, libraries=[lib], ext_modules=[ext], - setup_requires=build_dep, - install_requires=build_dep + run_dep, - tests_require=test_dep, cmdclass = {'build_ext': my_build_ext, 'build_clib': my_build_clib, 'build_shared_clib': my_build_shared_clib, @@ -1411,11 +1386,6 @@ def run(self): 'easy_install': my_easy_install, 'run_cpp_test': my_run_cpp_test, }, - entry_points = {'console_scripts' : [ - 'galsim = galsim.__main__:run_main', - 'galsim_download_cosmos = galsim.download_cosmos:run_main' - ]}, - zip_safe=False, ) # Check that the path includes the directory where the scripts are installed.