From fef4a300768111e2bb073641f753737a2210b1cf Mon Sep 17 00:00:00 2001 From: zacharyburnett Date: Wed, 12 Jun 2024 09:10:15 -0400 Subject: [PATCH 1/4] apply PEP621 with peppyproject --- pyproject.toml | 148 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 146 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3f479c3..228393f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,4 +1,148 @@ +[project] +name = "acstools" +description = "Python Tools for HST ACS" +requires-python = ">=3.8" +authors = [ + { name = "Matt Davis", email = "help@stsci.edu" }, + { name = "Warren Hack" }, + { name = "Norman Grogin" }, + { name = "Pey Lian Lim" }, + { name = "Sara Ogaz" }, + { name = "Leonardo Ubeda" }, + { name = "Mihai Cara" }, + { name = "David Borncamp" }, + { name = "Nathan Miles" }, + { name = "Tyler Desjardins" }, + { name = "Jenna Ryon" }, + { name = "David Stark" }, + { name = "Gagandeep Anand" }, + { name = "Yotam Cohen" }, +] +keywords = [ + "astronomy", + "astrophysics", + "calibration", +] +classifiers = [ + "Intended Audience :: Science/Research", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: Implementation :: CPython", + "Topic :: Scientific/Engineering :: Astronomy", + "Topic :: Scientific/Engineering :: Physics", + "Topic :: Software Development :: Libraries :: Python Modules", +] +dependencies = [ + "numpy", + "astropy>=3.1", + "requests", + "PyYAML", +] +dynamic = [ + "version", +] +edit-on-github = "False" +github-project = "spacetelescope/acstools" + +[project.readme] +file = "README.rst" +content-type = "text/x-rst" + +[project.license] +file = "LICENSE.md" +content-type = "text/plain" + +[project.urls] +Homepage = "https://github.com/spacetelescope/acstools" +"Bug Reports" = "https://github.com/spacetelescope/acstools/issues/" +Source = "https://github.com/spacetelescope/acstools/" +Help = "https://hsthelp.stsci.edu" + +[project.scripts] +acs_destripe = "acstools.acs_destripe:main" +acs_destripe_plus = "acstools.acs_destripe_plus:main" + +[project.optional-dependencies] +all = [ + "matplotlib", + "scipy", + "scikit-image", + "stsci.tools", + "stsci.imagestats", + "photutils", + "dask", +] +test = [ + "pytest", + "pytest-astropy-header", + "pytest-remotedata", + "ci-watson", +] +docs = [ + "sphinx", + "sphinx-automodapi", + "sphinx-rtd-theme", +] + [build-system] -requires = ["setuptools>=30.3.0", - "setuptools_scm"] +requires = [ + "setuptools>=30.3.0", + "setuptools_scm", +] build-backend = "setuptools.build_meta" + +[tool.setuptools] +zip-safe = false +include-package-data = false +license-files = [ + "LICENSE.md", +] + +[tool.setuptools.packages.find] +namespaces = false + +[tool.setuptools.package-data] +acstools = [ + "data/*", +] +"acstools.tests" = [ + "data/input/*.fits", + "data/truth/*.fits", +] + +[tool.pytest.ini_options] +minversion = "5" +testpaths = [ + "\"acstools\"", + "\"doc\"", +] +norecursedirs = [ + "build", + "doc/build", +] +astropy_header = true +xfail_strict = true +filterwarnings = [ + "error", + "ignore:numpy\\.ndarray size changed:RuntimeWarning", + "ignore:unclosed file:ResourceWarning", + "ignore:distutils Version classes are deprecated:DeprecationWarning", + "ignore:Deprecation Warning.*timeout.*parameter no longer needed:UserWarning", + "ignore:Deprecated call to.*pkg_resources\\.declare_namespace.*:DeprecationWarning", + "ignore:pkg_resources is deprecated as an API:DeprecationWarning", + "ignore:.*utcfromtimestamp:DeprecationWarning", + "ignore:.*numpy\\.core.*:DeprecationWarning", + "ignore:skimage not installed", +] + +[tool.flake8] +ignore = [ + "E221", + "E226", + "E262", + "E265", + "E501", + "E704", + "W504", +] From 20116abb6c62ae511448ebe19e45b7a9dba1b939 Mon Sep 17 00:00:00 2001 From: zacharyburnett Date: Wed, 12 Jun 2024 09:11:05 -0400 Subject: [PATCH 2/4] remove invalid entries --- pyproject.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 228393f..4b8b7b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,8 +42,6 @@ dependencies = [ dynamic = [ "version", ] -edit-on-github = "False" -github-project = "spacetelescope/acstools" [project.readme] file = "README.rst" From 664e22d39cc640750a810ff93179ccad9f67ee47 Mon Sep 17 00:00:00 2001 From: zacharyburnett Date: Wed, 12 Jun 2024 09:11:58 -0400 Subject: [PATCH 3/4] replace flake8 with ruff --- pyproject.toml | 2 +- tox.ini | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4b8b7b9..db533e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -134,7 +134,7 @@ filterwarnings = [ "ignore:skimage not installed", ] -[tool.flake8] +[tool.ruff.lint] ignore = [ "E221", "E226", diff --git a/tox.ini b/tox.ini index a4ba3b4..3785851 100644 --- a/tox.ini +++ b/tox.ini @@ -63,9 +63,9 @@ pip_pre = [testenv:codestyle] skip_install = true changedir = {toxinidir} -description = check code style with flake8 -deps = flake8 -commands = flake8 acstools --count +description = check code style with ruff +deps = ruff +commands = ruff check . [testenv:twine] skip_install = true From 8f22e7f4d52bfe266e576a1a159756a9c146ed9d Mon Sep 17 00:00:00 2001 From: zacharyburnett Date: Wed, 12 Jun 2024 09:13:18 -0400 Subject: [PATCH 4/4] remove setup.cfg and setup.py --- MANIFEST.in | 1 - pyproject.toml | 3 ++ setup.cfg | 102 ------------------------------------------------- setup.py | 39 ------------------- 4 files changed, 3 insertions(+), 142 deletions(-) delete mode 100644 setup.cfg delete mode 100755 setup.py diff --git a/MANIFEST.in b/MANIFEST.in index 69366c5..46f53f8 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,7 +1,6 @@ include README.rst include LICENSE.txt include CHANGES.rst -include setup.cfg include pyproject.toml recursive-include doc * diff --git a/pyproject.toml b/pyproject.toml index db533e9..e59de3a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -109,6 +109,9 @@ acstools = [ "data/truth/*.fits", ] +[tool.setuptools_scm] +version_file = "acstools/version.py" + [tool.pytest.ini_options] minversion = "5" testpaths = [ diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 25dd769..0000000 --- a/setup.cfg +++ /dev/null @@ -1,102 +0,0 @@ -[metadata] -name = acstools -description = Python Tools for HST ACS -long_description = Python Tools for HST ACS (Advanced Camera for Surveys) Data -long_description_content_type = text/plain -keywords = astronomy, astrophysics, calibration -author = Matt Davis, Warren Hack, Norman Grogin, Pey Lian Lim, Sara Ogaz, Leonardo Ubeda, Mihai Cara, David Borncamp, Nathan Miles, Tyler Desjardins, Jenna Ryon, David Stark, Gagandeep Anand, Yotam Cohen -author_email = help@stsci.edu -license = BSD -license_files = LICENSE.md -url = https://github.com/spacetelescope/acstools -edit_on_github = False -github_project = spacetelescope/acstools -classifier = - Intended Audience :: Science/Research - License :: OSI Approved :: BSD License - Operating System :: OS Independent - Programming Language :: Python :: 3 - Programming Language :: Python :: Implementation :: CPython - Topic :: Scientific/Engineering :: Astronomy - Topic :: Scientific/Engineering :: Physics - Topic :: Software Development :: Libraries :: Python Modules -project_urls = - Bug Reports = https://github.com/spacetelescope/acstools/issues/ - Source = https://github.com/spacetelescope/acstools/ - Help = https://hsthelp.stsci.edu - -[options] -packages = find: -zip_safe = False -setup_requires= - setuptools_scm -install_requires = - numpy - astropy>=3.1 - requests - PyYAML -python_requires = >=3.8 - -[options.extras_require] -all = - matplotlib - scipy - scikit-image - stsci.tools - stsci.imagestats - photutils - dask -test = - pytest - pytest-astropy-header - pytest-remotedata - ci-watson -docs = - sphinx - sphinx-automodapi - sphinx-rtd-theme - -[options.package_data] -acstools = data/* -acstools.tests = - data/input/*.fits - data/truth/*.fits - -[options.entry_points] -console_scripts = - acs_destripe = acstools.acs_destripe:main - acs_destripe_plus = acstools.acs_destripe_plus:main - -[tool:pytest] -minversion = 5 -testpaths = "acstools" "doc" -norecursedirs = build doc/build -astropy_header = true -xfail_strict = true -filterwarnings = - error - ignore:numpy\.ndarray size changed:RuntimeWarning - ignore:unclosed file:ResourceWarning - ignore:distutils Version classes are deprecated:DeprecationWarning - ignore:Deprecation Warning.*timeout.*parameter no longer needed:UserWarning - # https://github.com/spacetelescope/crds/issues/922 - ignore:Deprecated call to.*pkg_resources\.declare_namespace.*:DeprecationWarning - ignore:pkg_resources is deprecated as an API:DeprecationWarning - # Python 3.12 warning from dateutil imported by matplotlib - ignore:.*utcfromtimestamp:DeprecationWarning - # Ignore numpy 2.0 warning, see https://github.com/astropy/astropy/pull/15495 - # and https://github.com/scipy/scipy/pull/19275 - ignore:.*numpy\.core.*:DeprecationWarning - # Do not let broken scikit-image block the rest of test suite - ignore:skimage not installed - -[flake8] -# Ignoring these for now: -# E221: multiple spaces before operator -# E226: missing whitespace around arithmetic operator -# E262: inline comment should start with '# ' -# E265: block comment should start with '#' -# E501: line too long -# E704: multiple statements on one line (def) -# W504: line break after binary operator -ignore = E221,E226,E262,E265,E501,E704,W504 diff --git a/setup.py b/setup.py deleted file mode 100755 index 9f6f1d3..0000000 --- a/setup.py +++ /dev/null @@ -1,39 +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': 'acstools/version.py'}, -)