From 95de79e8014262d0ea9909bbb831f627d344d486 Mon Sep 17 00:00:00 2001 From: Zach Burnett Date: Thu, 15 Sep 2022 14:04:47 -0400 Subject: [PATCH] move build configuration into `pyproject.toml` --- .readthedocs.yaml | 11 ++++++ MANIFEST.in | 1 - doc/source/conf.py | 96 +++++++++++++++++++++++++--------------------- pyproject.toml | 71 ++++++++++++++++++++++++++++++++++ readthedocs.yml | 6 --- setup.cfg | 11 ------ setup.py | 44 --------------------- 7 files changed, 134 insertions(+), 106 deletions(-) create mode 100644 .readthedocs.yaml create mode 100644 pyproject.toml delete mode 100644 readthedocs.yml delete mode 100644 setup.cfg mode change 100755 => 100644 setup.py diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..fd7dd25 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,11 @@ +type: sphinx +python: + version: 3 + install: + - method: pip + path: + extra_requirements: + - docs + +conda: + file: doc/environment.yml \ No newline at end of file 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/doc/source/conf.py b/doc/source/conf.py index 39f106d..d50b395 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -11,39 +11,47 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os +import os +import sys +from pathlib import Path + +import tomli + sys.path.insert(0, os.path.abspath('../../stistools')) -#from stsci.sphinxext.conf import * +# from stsci.sphinxext.conf import * import stsci_rtd_theme # Check Sphinx version -#import sphinx +# import sphinx # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0,os.path.abspath('.')) +# sys.path.insert(0,os.path.abspath('.')) # -- General configuration ----------------------------------------------------- +with open(Path(__file__).parent.parent / "pyproject.toml", "rb") as configuration_file: + conf = tomli.load(configuration_file) +setup_cfg = conf['project'] # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc', 'sphinx.ext.imgmath','numpydoc', - 'sphinx.ext.intersphinx', 'sphinx.ext.coverage', - 'sphinx.ext.autosummary', - 'sphinx.ext.doctest'] -#extensions += ['parameter_anchor'] +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.imgmath', 'numpydoc', + 'sphinx.ext.intersphinx', 'sphinx.ext.coverage', + 'sphinx.ext.autosummary', + 'sphinx.ext.doctest'] +# extensions += ['parameter_anchor'] # Add any paths that contain templates here, relative to this directory. -#templates_path = ['_templates'] +# templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. -#source_encoding = 'utf-8' +# source_encoding = 'utf-8' # The master toctree document. master_doc = 'index' @@ -63,16 +71,16 @@ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +# language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# today_fmt = '%B %d, %Y' # List of documents that shouldn't be included in the build. -#unused_docs = [] +# unused_docs = [] # List of directories, relative to source directory, that shouldn't be searched # for source files. @@ -86,17 +94,17 @@ # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] +# modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- @@ -108,7 +116,7 @@ # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -#html_theme_options = {} +# html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. html_theme_path = [stsci_rtd_theme.get_html_theme_path()] @@ -118,95 +126,95 @@ # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -#html_title = None +# html_title = None # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +# html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = None +# html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = None +# html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -#html_static_path = ['_static'] +# html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' +# html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -#html_use_smartypants = True +# html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. -#html_use_modindex = True +# html_use_modindex = True # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +# html_show_sourcelink = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = '' +# html_file_suffix = '' # Output file base name for HTML help builder. htmlhelp_basename = 'stistoolsdoc' - # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). -#latex_paper_size = 'letter' +# latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). -#latex_font_size = '10pt' +# latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('index', 'stistools.tex', u'stistools Documentation', - u'Warren Hack, Nadia Dencheva, Chris Sontag, Megan Sosey, Michael Droettboom', 'manual'), + ('index', 'stistools.tex', u'stistools Documentation', + u'Warren Hack, Nadia Dencheva, Chris Sontag, Megan Sosey, Michael Droettboom', 'manual'), ] + # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = None +# latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +# latex_use_parts = False # Additional stuff for the LaTeX preamble. -#latex_preamble = '' +# latex_preamble = '' # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. -#latex_use_modindex = True +# latex_use_modindex = True def setup(app): app.add_css_file("stsci.css") diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..cfca0f4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,71 @@ +[project] +name = 'stistools' +description = 'Tools for STIS (Space Telescope Imaging Spectrograph)' +readme = 'README.md' +requires-python = '>=3.8' +license = { file = 'LICENSE.txt' } +authors = [ + { name = 'Paul Barrett', email = 'help@stsci.edu' }, + { name = 'Phil Hodge' }, + { name = 'Warren Hack' }, + { name = 'Nadia Dencheva' }, + { name = 'Chris Sontag' }, + { name = 'Megan Sosey' }, + { name = 'Michael Droettboom' }, +] +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.optional-dependencies] +tests = [ + 'pytest', + 'six', + #'requests', + #'crds', +] +docs = [ + 'tomli; python_version <"3.11"', +] + +[project.urls] +'repository' = 'https://github.com/spacetelescope/stistools' + +[project.scripts] +add_stis_s_region = 'stistools.add_stis_s_region:call_main' + +[build-system] +requires = [ + 'setuptools >=61', + 'setuptools_scm[toml] >=3.4', + 'wheel', +] +build-backend = 'setuptools.build_meta' + +[tool.setuptools_scm] +write_to = 'stistools/version.py' + +[tool.setuptools.packages.find] +where = ['stistools'] + +[tool.setuptools.package-data] +stistools = ['pars/*', 'LICENSE.txt'] + +[tool.pytest.ini_options] +minversion = 3 +norecursedirs = ['.eggs', 'build', 'docs/_build'] +junit_family = 'xunit2' 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 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 old mode 100755 new mode 100644 index 6956af7..9c27a89 --- a/setup.py +++ b/setup.py @@ -6,7 +6,6 @@ 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 @@ -27,46 +26,3 @@ 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)', - 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', - ], - }, -)