From d65f57aaff24bf1d6cadb0f09226637ce572c25d Mon Sep 17 00:00:00 2001 From: zacharyburnett Date: Mon, 4 Mar 2024 09:13:10 -0500 Subject: [PATCH 1/9] ignore `version.py` --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index cb3a762..ae59e40 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ docs/build dist __pycache__ pip-wheel-metadata +**/version.py From efe35c739789b3fe436ac063a25c8c04f381e062 Mon Sep 17 00:00:00 2001 From: zacharyburnett Date: Mon, 4 Mar 2024 09:14:57 -0500 Subject: [PATCH 2/9] add Dependabot configuration to keep GitHub Actions up to date --- .github/dependabot.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..375b7c7 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + + # Maintain dependencies for GitHub Actions (main) + - package-ecosystem: "github-actions" + directory: "/" + target-branch: "main" + schedule: + interval: "weekly" + From 6a7a2990d8c0c3fe04832a3fe855fad66002a9a4 Mon Sep 17 00:00:00 2001 From: zacharyburnett Date: Mon, 4 Mar 2024 09:17:26 -0500 Subject: [PATCH 3/9] force Numpy 2.0 --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 842ffc5..7410229 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -3,6 +3,6 @@ # Use Bi-weekly numpy/scipy dev builds --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple -numpy>=0.0.dev0 +numpy>=2.0.0.dev0 scipy>=0.0.dev0 From c7b0899d656d3e74c08d1866d26b38a937e09b81 Mon Sep 17 00:00:00 2001 From: zacharyburnett Date: Mon, 4 Mar 2024 09:22:58 -0500 Subject: [PATCH 4/9] change label --- .github/workflows/tests_scheduled.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_scheduled.yml b/.github/workflows/tests_scheduled.yml index 6cb81b0..b395bd7 100644 --- a/.github/workflows/tests_scheduled.yml +++ b/.github/workflows/tests_scheduled.yml @@ -20,7 +20,7 @@ concurrency: jobs: test: - if: (github.repository == 'spacetelescope/costools' && (github.event_name == 'schedule' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'Weekly CI'))) + if: (github.repository == 'spacetelescope/costools' && (github.event_name == 'schedule' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'run devdeps tests'))) uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1 with: envs: | From 6fc5a8f558600e26aedc567a9a6d7fb022b06159 Mon Sep 17 00:00:00 2001 From: zacharyburnett Date: Tue, 12 Mar 2024 11:46:24 -0400 Subject: [PATCH 5/9] use Numpy 2.0 build --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 7410229..7adb03f 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -3,6 +3,6 @@ # Use Bi-weekly numpy/scipy dev builds --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple -numpy>=2.0.0.dev0 +numpy>=2.0.0b1 scipy>=0.0.dev0 From abd5f0391b131ac4a7e5470128fedb2c20c6d1ff Mon Sep 17 00:00:00 2001 From: zacharyburnett Date: Tue, 12 Mar 2024 11:54:53 -0400 Subject: [PATCH 6/9] replace pkg_resources with importlib --- costools/__init__.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/costools/__init__.py b/costools/__init__.py index d837073..174df7d 100644 --- a/costools/__init__.py +++ b/costools/__init__.py @@ -1,12 +1,8 @@ from __future__ import absolute_import, division # confidence high -from pkg_resources import get_distribution, DistributionNotFound -try: - __version__ = get_distribution(__name__).version -except DistributionNotFound: - # package is not installed - __version__ = 'UNKNOWN' +from importlib.metadata import version +__version__ = version(__name__) from . import timefilter from . import splittag @@ -16,4 +12,5 @@ # upon importing this package. import os from stsci.tools import teal + teal.print_tasknames(__name__, os.path.dirname(__file__)) From 96b9ac7872fb766b2286a6d01fce3cee04cdbfc6 Mon Sep 17 00:00:00 2001 From: zacharyburnett Date: Tue, 12 Mar 2024 12:11:53 -0400 Subject: [PATCH 7/9] build with Numpy 2.0 --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 113da5d..94d8c1c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,4 +3,5 @@ requires = [ "setuptools>=38.2.5", "setuptools_scm", "wheel", + "numpy>=2.0.0b1" ] From 6348a21583a91e1a8d9ac630849c80d0100c2add Mon Sep 17 00:00:00 2001 From: zacharyburnett Date: Tue, 12 Mar 2024 12:19:19 -0400 Subject: [PATCH 8/9] apply PEP621 --- pyproject.toml | 66 +++++++++++++++++++++++++++++++++++++++++++++++++- setup.py | 59 -------------------------------------------- 2 files changed, 65 insertions(+), 60 deletions(-) delete mode 100755 setup.py diff --git a/pyproject.toml b/pyproject.toml index 94d8c1c..6e39e59 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,71 @@ +[project] +name = "costools" +description = "Tools for COS (Cosmic Origins Spectrograph)" +authors = [ + { name = "Warren Hack" }, + { name = "Nadezhda Dencheva" }, + { name = "Phil Hodge" }, +] +classifiers = [ + "Intended Audience :: Science/Research", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Topic :: Scientific/Engineering :: Astronomy", + "Topic :: Software Development :: Libraries :: Python Modules", +] +dependencies = [ + "astropy", + "calcos", + "numpy", + "stsci.tools", +] +dynamic = [ + "version", +] + +[project.readme] +file = "README.md" +content-type = "text/markdown" + +[project.license] +file = "LICENSE.txt" +content-type = "text/plain" + +[project.scripts] +timefilter = "costools.timefilter:main" +add_cos_s_region = "costools.add_cos_s_region:call_main" + +[project.optional-dependencies] +docs = [ + "sphinx", + "numpydoc", +] +test = [ + "pytest", + "pytest-cov", +] + [build-system] requires = [ "setuptools>=38.2.5", "setuptools_scm", "wheel", - "numpy>=2.0.0b1" + "numpy>=2.0.0b1", +] +build-backend = "setuptools.build_meta" + +[tool.setuptools] +include-package-data = false + +[tool.setuptools.packages.find] +namespaces = false + +[tool.setuptools.package-data] +costools = [ + "pars/*", + "*.help", ] + +[tool.setuptools_scm] +version_file = "costools/version.py" diff --git a/setup.py b/setup.py deleted file mode 100755 index 0da78a8..0000000 --- a/setup.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python -from setuptools import find_packages -from setuptools import setup - - -PACKAGENAME = 'costools' - -setup( - name=PACKAGENAME, - use_scm_version={'write_to': 'costools/version.py'}, - setup_requires=['setuptools_scm'], - install_requires=[ - 'astropy', - 'calcos', - 'numpy', - 'stsci.tools', - ], - extras_require={ - 'docs': [ - 'sphinx', - 'numpydoc', - ], - 'test': [ - 'pytest', - 'pytest-cov', - ], - }, - packages=find_packages(), - package_data={ - PACKAGENAME: [ - 'pars/*', - '*.help', - ], - }, - entry_points={ - 'console_scripts': [ - 'timefilter = {0}.timefilter:main'.format(PACKAGENAME), - 'add_cos_s_region = {}.add_cos_s_region:call_main'.format(PACKAGENAME), - ], - }, - scripts=[ - 'costools/add_cos_s_region.py', - ], - author='Warren Hack, Nadezhda Dencheva, Phil Hodge', - author_email='help@stsci.edu', - description='Tools for COS (Cosmic Origins Spectrograph)', - long_description='README.md', - long_description_content_type='text/x-rst', - url='https://github.com/spacetelescope/costools', - license='BSD', - classifiers=[ - 'Intended Audience :: Science/Research', - 'License :: OSI Approved :: BSD License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Topic :: Scientific/Engineering :: Astronomy', - 'Topic :: Software Development :: Libraries :: Python Modules', - ], -) From 0f12da849a8bea7d4434a763b78118b89439c115 Mon Sep 17 00:00:00 2001 From: zacharyburnett Date: Fri, 5 Apr 2024 13:28:32 -0400 Subject: [PATCH 9/9] use release candidate --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6e39e59..d674227 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ classifiers = [ dependencies = [ "astropy", "calcos", - "numpy", + "numpy>=2.0.0rc1", "stsci.tools", ] dynamic = [ @@ -51,7 +51,7 @@ requires = [ "setuptools>=38.2.5", "setuptools_scm", "wheel", - "numpy>=2.0.0b1", + "numpy>=2.0.0rc1", ] build-backend = "setuptools.build_meta"