From 0fd2e3870684fec9f8e46bf8161f43a757da81d4 Mon Sep 17 00:00:00 2001 From: zacharyburnett Date: Mon, 20 May 2024 09:20:05 -0400 Subject: [PATCH 1/3] move build configuration into pyproject.toml --- pyproject.toml | 114 +++++++++++++++++++++++++++++++++++++++++++++++-- setup.cfg | 76 --------------------------------- setup.py | 32 -------------- 3 files changed, 111 insertions(+), 111 deletions(-) delete mode 100644 setup.cfg delete mode 100755 setup.py diff --git a/pyproject.toml b/pyproject.toml index 46a745e..a4b8283 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,113 @@ +[project] +name = "stsci.tools" +description = "Collection of STScI utility functions" +requires-python = ">=3.8" +authors = [ + { name = "STScI", email = "help@stsci.edu" }, +] +keywords = [ + "astronomy", + "astrophysics", + "utility", +] +classifiers = [ + "Intended Audience :: Science/Research", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: Implementation :: CPython", + "Topic :: Scientific/Engineering :: Astronomy", + "Topic :: Software Development :: Libraries :: Python Modules", +] +dependencies = [ + "packaging", + "numpy", + "astropy>=5.0.4", +] +dynamic = [ + "version", +] + +[project.readme] +file = "README.md" +content-type = "text/markdown" + +[project.license] +file = "LICENSE.md" +content-type = "text/plain" + +[project.urls] +Homepage = "https://www.github.com/spacetelescope/stsci.tools" + +[project.scripts] +convertwaiveredfits = "stsci.tools.convertwaiveredfits:main" +convertlog = "stsci.tools.convertlog:main" + +[project.optional-dependencies] +test = [ + "pytest", + "pytest-astropy-header", + "pytest-doctestplus", +] +docs = [ + "sphinx", + "numpydoc", + "sphinx_rtd_theme", +] + [build-system] -requires = ["setuptools>=30.3.0", - "setuptools_scm", - "wheel"] +requires = [ + "setuptools>=30.3.0", + "setuptools_scm", + "wheel", +] build-backend = "setuptools.build_meta" + +[tool.setuptools] +zip-safe = false +include-package-data = false +license-files = [ + "LICENSE.md", +] + +[tool.setuptools.packages.find] +where = [ + "lib", +] +namespaces = false + +[tool.setuptools.package-dir] +"" = "lib" + +[tool.setuptools.package-data] +"stsci.tools.tests" = [ + "data/*.*", +] + +[tool.setuptools_scm] +version_file = "lib/stsci/tools/version.py" + +[tool.pytest.ini_options] +minversion = "6" +testpaths = [ + "lib/stsci/tools", +] +addopts = "--doctest-modules" +astropy_header = true +xfail_strict = true +filterwarnings = [ + "error", + "ignore:.*Column disp option", + "ignore:NMPFIT is deprecated", + "ignore:GFIT is deprecated", + "ignore:unclosed file:ResourceWarning", +] + +[tool.flake8] +ignore = [ + "E501", + "W504", +] + +[tool.distutils.bdist_wheel] +universal = 1 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index c590588..0000000 --- a/setup.cfg +++ /dev/null @@ -1,76 +0,0 @@ -[metadata] -name = stsci.tools -description = Collection of STScI utility functions -long_description = Collection of STScI utility functions -long_description_content_type = text/plain -keywords = astronomy, astrophysics, utility -author = STScI -author_email = help@stsci.edu -license = BSD -license_file = LICENSE.md -url = https://www.github.com/spacetelescope/stsci.tools -classifiers = - Intended Audience :: Science/Research - License :: OSI Approved :: BSD License - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: Implementation :: CPython - Topic :: Scientific/Engineering :: Astronomy - Topic :: Software Development :: Libraries :: Python Modules - -[options] -packages = find: -package_dir = - = lib -zip_safe = False -setup_requires = - setuptools_scm -install_requires = - packaging - numpy - astropy>=5.0.4 -python_requires = >=3.8 - -[options.packages.find] -where = lib - -[options.extras_require] -test = - pytest - pytest-astropy-header - pytest-doctestplus -docs = - sphinx - numpydoc - sphinx_rtd_theme - -[options.package_data] -stsci.tools.tests = data/*.* - -[options.entry_points] -console_scripts = - convertwaiveredfits = stsci.tools.convertwaiveredfits:main - convertlog = stsci.tools.convertlog:main - -[tool:pytest] -minversion = 6 -testpaths = lib/stsci/tools -addopts = --doctest-modules -astropy_header = true -xfail_strict = true -filterwarnings = - error - ignore:.*Column disp option - ignore:NMPFIT is deprecated - ignore:GFIT is deprecated - ignore:unclosed file:ResourceWarning - -[flake8] -# E501: line too long -# W504: line break after binary operator -ignore = E501,W504 - -[bdist_wheel] -# 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 diff --git a/setup.py b/setup.py deleted file mode 100755 index 3313702..0000000 --- a/setup.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python - -import sys -from setuptools import setup - -TEST_HELP = """ -Note: running tests is no longer done using 'python setup.py test'. Instead -you will need to run: - pip install -e . - pytest -For more information, see: - https://docs.astropy.org/en/latest/development/testguide.html#running-tests -""" - -if 'test' in sys.argv: - print(TEST_HELP) - sys.exit(1) - -DOCS_HELP = """ -Note: building the documentation is no longer done using -'python setup.py build_docs'. Instead you will need to run: - cd docs - make html -For more information, see: - https://docs.astropy.org/en/latest/install.html#builddocs -""" - -if 'build_docs' in sys.argv or 'build_sphinx' in sys.argv: - print(DOCS_HELP) - sys.exit(1) - -setup(use_scm_version={'write_to': 'lib/stsci/tools/version.py'}) From de3a7c52ee657b77c727923930597306341d9077 Mon Sep 17 00:00:00 2001 From: zacharyburnett Date: Mon, 20 May 2024 09:22:06 -0400 Subject: [PATCH 2/3] replace flake8 config with ruff --- pyproject.toml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a4b8283..fb10b9f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -103,11 +103,9 @@ filterwarnings = [ "ignore:unclosed file:ResourceWarning", ] -[tool.flake8] -ignore = [ +[tool.ruff.lint] +extend-ignore = [ "E501", "W504", ] -[tool.distutils.bdist_wheel] -universal = 1 From d24bb9d0eabeaf4f073b556785492de0271eb5c2 Mon Sep 17 00:00:00 2001 From: zacharyburnett Date: Mon, 20 May 2024 13:53:18 -0400 Subject: [PATCH 3/3] fix namespace package discovery --- pyproject.toml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index fb10b9f..68ab7b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,12 +72,8 @@ license-files = [ [tool.setuptools.packages.find] where = [ - "lib", + "lib/", ] -namespaces = false - -[tool.setuptools.package-dir] -"" = "lib" [tool.setuptools.package-data] "stsci.tools.tests" = [