diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..8f53517d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,27 @@ +[build-system] +requires = ["setuptools >= 61.0"] # PEP 621 compliant +build-backend = "setuptools.build_meta" + +[project] +name = "skyCatalogs" +version = "1.3.0" +description = "Writes, reads catalogs input to LSST DESC simulations" +readme = "README.md" +authors = [{ name = "Joanne Bogart", email = "jrb@slac.stanford.edu" }] +license = { file = "LICENCE" } +classifiers = [ + "Programming Language :: Python :: 3", +] +keywords = ["desc", "python", "catalog", "simulation"] +dependencies = [ + 'numpy', + 'healpy', + 'astropy', + 'pyarrow', + 'pandas', + 'importlib-metadata;python_version<"3.8"' +] +requires-python = ">=3.7" # For setuptools >= 61.0 support + +[tool.setuptools.packages.find] +where = ["python"] diff --git a/python/desc/skycatalogs/__init__.py b/python/desc/skycatalogs/__init__.py index e82ba1ba..3661962a 100644 --- a/python/desc/skycatalogs/__init__.py +++ b/python/desc/skycatalogs/__init__.py @@ -1,3 +1,11 @@ -from ._version import * +##from ._version import * +try: + # For Python >= 3.8 + from importlib import metadata +except ImportError: + # For Python < 3.8 + import importlib_metadata as metadata + +__version__ = metadata.version("skyCatalogs") from .skyCatalogs import * from .catalog_creator import * diff --git a/python/desc/skycatalogs/_version.py b/python/desc/skycatalogs/_version.py deleted file mode 100644 index d194b882..00000000 --- a/python/desc/skycatalogs/_version.py +++ /dev/null @@ -1,18 +0,0 @@ -# Copied from imSim repo -# -# Conventions: -# M.m means a development version not ready for prime time yet. Not stable -# M.m.r is a regular release: -# Intended to be API stable with previous M.x.y releases. -# New features may be added with the major (M) series, but the intent is to not -# break public API-based code from previous versions in the series. -# Updates that change the revision number (r) should only have bug fixes. -# M.m.r-* is some kind of prerelease or release candidate for alpha or beta testing. -# -# cf. https://semver.org/ for more info - -# This should be updated before a release. -__version__ = '1.1.0' - -# This will work if the version has end tags like 2.0.0-rc.1 -__version_info__ = tuple(map(lambda x:int(x.split('-')[0]), __version__.split('.')))[:3] diff --git a/setup.py b/setup.py deleted file mode 100644 index c505b0df..00000000 --- a/setup.py +++ /dev/null @@ -1,61 +0,0 @@ -import os -import re - -from setuptools import setup, find_packages - -with open('README.md') as file: - long_description = file.read() - -packages = find_packages(where="python") -print('packages = ', packages) - -def all_files_from(dir, ext=''): - """Quick function to get all files from directory and all subdirectories - """ - files = [] - for root, dirnames, filenames in os.walk(dir): - for filename in filenames: - if filename.endswith(ext) and not filename.startswith('.'): - files.append(os.path.join(root, filename)) - return files - -# Need to clarify if this belongs in the distribution or not -## shared_data = all_files_from('data') -## print('shared_data = ', shared_data) - -## configs = [os.path.join('cfg', 'latest.yaml')] - -# Read in the version from python/desc/_version.py -# cf. http://stackoverflow.com/questions/458550/standard-way-to-embed-version-into-python-package - -version_file = os.path.join('python', 'desc', 'skycatalogs', '_version.py') -verstrline = open(version_file, "rt").read() -VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]" -mo = re.search(VSRE, verstrline, re.M) -if mo: - skycatalogs_version = mo.group(1) -else: - raise RuntimeError("Unable to find version string in %s." % (version_file,)) -print('skyCatalogs version is %s'%(skycatalogs_version)) - -dist = setup(name="skyCatalogs", - version=skycatalogs_version, - maintainer="Joanne Bogart", # also author line? - maintainer_email="jrb@slac.stanford.edu", - license="BSD", - description="Writes, reads catalogs input to LSST DESC simulations", - long_description=long_description, - package_dir={"": "python"}, - packages=find_packages(where="python"), - ##package_data={"skycatalogs": shared_data + configs}, - url="https://github.com/LSSTDESC/skyCatalogs", - classifiers=[ - "License :: OSI Approved :: BSD License", - "Intended Audience :: Developers", - "Intended Audience :: Science/Research", - "Programming Language :: Python", - "Development Status :: 3 - Alpha", - ], - install_requires=['numpy', 'healpy', 'astropy', - 'pyarrow', 'pandas'] - )