From afc54351a80224f933870f81f79169dfbea15e35 Mon Sep 17 00:00:00 2001 From: Zach Burnett Date: Fri, 20 Jan 2023 15:32:58 -0500 Subject: [PATCH 1/7] move build configuration into `pyproject.toml` --- MANIFEST.in | 1 - pyproject.toml | 63 ++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 11 -------- setup.py | 74 -------------------------------------------------- 4 files changed, 63 insertions(+), 86 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100755 setup.py diff --git a/MANIFEST.in b/MANIFEST.in index 93362df..2f49b56 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,3 @@ -include RELIC-INFO exclude stistools/version.py recursive-include stistools/pars *.cfg* diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..d5148de --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,63 @@ +[project] +name = "stistools" +description = "Tools for STIS (Space Telescope Imaging Spectrograph)" +authors = [ + { name = "Paul Barrett" }, + { 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>=4.1", + "numpy", + "scipy", + "stsci.tools", + "pysiaf", + "astroquery", +] +dynamic = [ + "version", +] + +[project.scripts] +add_stis_s_region = "stistools.add_stis_s_region:call_main" + +[build-system] +requires = [ + "setuptools>=61.2", + "setuptools_scm[toml]>=3.4", +] +build-backend = "setuptools.build_meta" + +[tool.setuptools] +include-package-data = false + +[tool.setuptools.packages.find] +namespaces = false + +[tool.setuptools.package-data] +stistools = [ + "pars/*", + "LICENSE.txt", +] + +[tool.distutils.bdist_wheel] +universal = 1 + +[tool.pytest.ini_options] +minversion = "3" +norecursedirs = [ + ".eggs", + "build", + "docs/_build", + "relic", +] +junit_family = "xunit2" + +[tool.setuptools_scm] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 5464bd4..0000000 --- a/setup.cfg +++ /dev/null @@ -1,11 +0,0 @@ -[bdist_wheel] -# This flag says that the code is written to work on both Python 2 and Python -# 3. If at all possible, it is good practice to do this. If you cannot, you -# will need to generate wheels for each Python version that you support. -universal=1 - - -[tool:pytest] -minversion = 3 -norecursedirs = .eggs build docs/_build relic -junit_family = xunit2 diff --git a/setup.py b/setup.py deleted file mode 100755 index a8c4c46..0000000 --- a/setup.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env python -import os -import pkgutil -import sys -from glob import glob -from setuptools import setup, find_packages, Extension -from subprocess import check_call, CalledProcessError - - -if not pkgutil.find_loader('relic'): - relic_local = os.path.exists('relic') - relic_submodule = (relic_local and - os.path.exists('.gitmodules') and - not os.listdir('relic')) - try: - if relic_submodule: - check_call(['git', 'submodule', 'update', '--init', '--recursive']) - elif not relic_local: - check_call(['git', 'clone', 'https://github.com/spacetelescope/relic.git']) - - sys.path.insert(1, 'relic') - except CalledProcessError as e: - print(e) - exit(1) - -import relic.release - -version = relic.release.get_info() -relic.release.write_template(version, 'stistools') - -setup( - name = 'stistools', - version = version.pep386, - author = 'Paul Barrett, Phil Hodge', - author_email = 'help@stsci.edu', - description = 'Tools for STIS (Space Telescope Imaging Spectrograph)', - long_description='Tools for analyzing STIS data from the Hubble Space Telescope', - long_description_content_type='text/plain', - url = 'https://github.com/spacetelescope/stistools', - 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', - ], - install_requires = [ - 'astropy>=4.1', - 'numpy', - 'scipy', - 'stsci.tools', - 'pysiaf', - 'astroquery', - ], - tests_require = [ - 'pytest', - 'six', - #'requests', - #'crds', - ], - packages = find_packages(), - package_data = { - 'stistools': [ - 'pars/*', - 'LICENSE.txt', - ] - }, - entry_points = { - 'console_scripts': [ - 'add_stis_s_region = stistools.add_stis_s_region:call_main', - ], - }, -) From 7685a46f6472aee47609f097a6c037a5b549f034 Mon Sep 17 00:00:00 2001 From: Zach Burnett Date: Fri, 20 Jan 2023 16:00:16 -0500 Subject: [PATCH 2/7] add analogous `long_description` field --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index d5148de..440ccea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,6 +25,10 @@ dynamic = [ "version", ] +[project.readme] +text = 'Tools for analyzing STIS data from the Hubble Space Telescope' +content-type = 'text/plain' + [project.scripts] add_stis_s_region = "stistools.add_stis_s_region:call_main" From 5d6f2b91fdabc453d4d3fd8f581f79937557b3f4 Mon Sep 17 00:00:00 2001 From: Zach Burnett Date: Tue, 24 Jan 2023 13:16:19 -0500 Subject: [PATCH 3/7] link to readme --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 440ccea..291bc15 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,8 +26,8 @@ dynamic = [ ] [project.readme] -text = 'Tools for analyzing STIS data from the Hubble Space Telescope' -content-type = 'text/plain' +file = "README.md" +content-type = "text/markdown" [project.scripts] add_stis_s_region = "stistools.add_stis_s_region:call_main" From 8377e6b0b7843ea2c045c6bce99cbee92c0864dc Mon Sep 17 00:00:00 2001 From: Zach Burnett Date: Wed, 15 Feb 2023 08:39:29 -0500 Subject: [PATCH 4/7] add license file to metadata --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 291bc15..0206506 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,6 +29,10 @@ dynamic = [ file = "README.md" content-type = "text/markdown" +[project.license] +file = "LICENSE.txt" +content-type = "text/plain" + [project.scripts] add_stis_s_region = "stistools.add_stis_s_region:call_main" From f7a0ffb324ec8ea7d140d5adea5272b5a12c8697 Mon Sep 17 00:00:00 2001 From: Zach Burnett Date: Fri, 17 Feb 2023 08:24:05 -0500 Subject: [PATCH 5/7] pin `astropy>=5.1` Co-authored-by: Nadia Dencheva --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 0206506..41b2f1a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ classifiers = [ "Topic :: Software Development :: Libraries :: Python Modules", ] dependencies = [ - "astropy>=4.1", + "astropy>=5.1", "numpy", "scipy", "stsci.tools", From 3530477466fe3500af5ceb3c87020762bbe17aac Mon Sep 17 00:00:00 2001 From: Zach Burnett Date: Fri, 17 Feb 2023 08:25:16 -0500 Subject: [PATCH 6/7] remove leftover references to `relic` --- .gitignore | 2 -- pyproject.toml | 1 - 2 files changed, 3 deletions(-) diff --git a/.gitignore b/.gitignore index ae70d9f..6b7930f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ -RELIC-INFO -relic/ */version.py build/ dist/ diff --git a/pyproject.toml b/pyproject.toml index 41b2f1a..14d6dcd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,7 +64,6 @@ norecursedirs = [ ".eggs", "build", "docs/_build", - "relic", ] junit_family = "xunit2" From 19df53df6f92475d1973aa26f4e9c8950e908a44 Mon Sep 17 00:00:00 2001 From: Zach Burnett Date: Fri, 17 Feb 2023 09:01:05 -0500 Subject: [PATCH 7/7] move docs environment into `optional-dependencies` --- doc/environment.yml | 18 ------------------ pyproject.toml | 12 ++++++++++++ readthedocs.yaml | 12 ++++++++++++ readthedocs.yml | 6 ------ 4 files changed, 24 insertions(+), 24 deletions(-) delete mode 100644 doc/environment.yml create mode 100644 readthedocs.yaml delete mode 100644 readthedocs.yml diff --git a/doc/environment.yml b/doc/environment.yml deleted file mode 100644 index 61b6d3b..0000000 --- a/doc/environment.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: stistools -channels: - - http://ssb.stsci.edu/astroconda - - conda-forge -dependencies: - - numpy>=1.5.1 - - numpydoc - - astropy>=3.1.1 - - scipy>=0.14 - - sphinx=1.8 - - stsci.tools - - ipython - - d2to1 - - stsci.distutils - - stsci.tools - - pip: - - stsci_rtd_theme - - sphinx_automodapi diff --git a/pyproject.toml b/pyproject.toml index 14d6dcd..ba8f970 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,6 +33,18 @@ content-type = "text/markdown" file = "LICENSE.txt" content-type = "text/plain" +[project.optional-dependencies] +test = [ + "pytest", +] +docs = [ + "ipython", + "sphinx", + "stsci_rtd_theme", + "sphinx_automodapi", + 'tomli; python_version <"3.11"', +] + [project.scripts] add_stis_s_region = "stistools.add_stis_s_region:call_main" diff --git a/readthedocs.yaml b/readthedocs.yaml new file mode 100644 index 0000000..6bb3b21 --- /dev/null +++ b/readthedocs.yaml @@ -0,0 +1,12 @@ +version: 2 + +sphinx: + configuration: doc/source/conf.py + +python: + version: "3.8" + install: + - method: pip + path: . + extra_requirements: + - docs diff --git a/readthedocs.yml b/readthedocs.yml deleted file mode 100644 index db0ad94..0000000 --- a/readthedocs.yml +++ /dev/null @@ -1,6 +0,0 @@ -type: sphinx -python: - version: 3 - setup_py_install: true -conda: - file: doc/environment.yml \ No newline at end of file