From bf94e6772b2662ad5320a8de2e544e09fc71581b Mon Sep 17 00:00:00 2001 From: Joanne Bogart Date: Mon, 13 Feb 2023 11:42:00 -0800 Subject: [PATCH 1/5] use pyproject.toml --- pyproject.toml | 27 +++++++++++++ python/desc/skycatalogs/__init__.py | 10 ++++- python/desc/skycatalogs/_version.py | 18 --------- setup.py | 61 ----------------------------- 4 files changed, 36 insertions(+), 80 deletions(-) create mode 100644 pyproject.toml delete mode 100644 python/desc/skycatalogs/_version.py delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..fa27d62b --- /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.0rc1" +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"] \ No newline at end of file diff --git a/python/desc/skycatalogs/__init__.py b/python/desc/skycatalogs/__init__.py index e82ba1ba..e900f3de 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("mydescpackage") 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'] - ) From 404223b82ce1e0d95c420dfd85e566d31b95ab85 Mon Sep 17 00:00:00 2001 From: Joanne Bogart Date: Mon, 13 Feb 2023 12:27:43 -0800 Subject: [PATCH 2/5] bump version to 1.3.0rc2 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index fa27d62b..6b60f2a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "skyCatalogs" -version = "1.3.0rc1" +version = "1.3.0rc2" description = "Writes, reads catalogs input to LSST DESC simulations" readme = "README.md" authors = [{ name = "Joanne Bogart", email = "jrb@slac.stanford.edu" }] From 0f5bcd8c437467413d4f823089b6d45e0db1231d Mon Sep 17 00:00:00 2001 From: Joanne Bogart Date: Mon, 13 Feb 2023 13:17:38 -0800 Subject: [PATCH 3/5] fix copy-paste bug; bump rc version --- pyproject.toml | 2 +- python/desc/skycatalogs/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6b60f2a6..d4c116dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "skyCatalogs" -version = "1.3.0rc2" +version = "1.3.0rc3" description = "Writes, reads catalogs input to LSST DESC simulations" readme = "README.md" authors = [{ name = "Joanne Bogart", email = "jrb@slac.stanford.edu" }] diff --git a/python/desc/skycatalogs/__init__.py b/python/desc/skycatalogs/__init__.py index e900f3de..3661962a 100644 --- a/python/desc/skycatalogs/__init__.py +++ b/python/desc/skycatalogs/__init__.py @@ -6,6 +6,6 @@ # For Python < 3.8 import importlib_metadata as metadata -__version__ = metadata.version("mydescpackage") +__version__ = metadata.version("skyCatalogs") from .skyCatalogs import * from .catalog_creator import * From fc18a88c99c1adf9937f528087d4fd040816ea68 Mon Sep 17 00:00:00 2001 From: Joanne Bogart Date: Mon, 13 Feb 2023 14:33:50 -0800 Subject: [PATCH 4/5] Get ready for release 1.3.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d4c116dd..70baf5c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "skyCatalogs" -version = "1.3.0rc3" +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" }] From 37923d7fe48c20da812ab86cb2ff54f5c577a876 Mon Sep 17 00:00:00 2001 From: Joanne Bogart Date: Mon, 13 Feb 2023 15:19:50 -0800 Subject: [PATCH 5/5] Add final newline which was missing --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 70baf5c0..8f53517d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,4 +24,4 @@ dependencies = [ requires-python = ">=3.7" # For setuptools >= 61.0 support [tool.setuptools.packages.find] -where = ["python"] \ No newline at end of file +where = ["python"]