diff --git a/docs/conf.py b/docs/conf.py index 4a8edda6c..930321ed4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -2,9 +2,10 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst # -import datetime import os import sys +from datetime import datetime, timezone +from importlib import metadata try: import sphinx_astropy @@ -16,53 +17,30 @@ sys.path.insert(1, a_h_path) # Load all of the global Astropy configuration -from sphinx_astropy.conf import * - -# Get configuration information from setup.cfg -try: - from ConfigParser import ConfigParser -except ImportError: - from configparser import ConfigParser -conf = ConfigParser() -conf.read([os.path.join(os.path.dirname(__file__), "..", "setup.cfg")]) -setup_cfg = dict(conf.items("metadata")) +from sphinx_astropy.conf.v2 import exclude_patterns # -- General configuration ---------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. -# needs_sphinx = '1.2' - -# To perform a Sphinx version check that needs to be more specific than -# major.minor, call `check_sphinx_version("x.y.z")` here. -check_sphinx_version("1.3.1") +needs_sphinx = "3.0" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns.append("_templates") -# This is added to the end of RST files - a good place to put substitutions to -# be used globally. -rst_epilog += """ -""" # -- Project information ------------------------------------------------------ -# This does not *have* to match the package name, but typically does -project = setup_cfg["name"] -author = setup_cfg["author"] -copyright = "{0}, {1}".format(datetime.datetime.now().year, setup_cfg["author"]) +project = "halotools" +author = "Andrew Hearin" +copyright = f"2017–{datetime.now(tz=timezone.utc).year}, " + author # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. -__import__(setup_cfg["name"]) -package = sys.modules[setup_cfg["name"]] - -# The short X.Y version. -version = package.__version__.split("-", 1)[0] -# The full version, including alpha/beta/rc tags. -release = package.__version__ +release = metadata.version(project) +version = ".".join(release.split(".")[:2]) # -- Options for HTML output -------------------------------------------------- @@ -103,7 +81,7 @@ # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -html_title = "{0} v{1}".format(project, release) +html_title = f"{project} v{release}" # Output file base name for HTML help builder. htmlhelp_basename = project + "doc" @@ -128,16 +106,3 @@ man_pages = [("index", project.lower(), project + " Documentation", [author], 1)] # -- Options for the edit_on_github extension --------------------------------- - -if eval(setup_cfg.get("edit_on_github")): - extensions += ["sphinx_astropy.ext.edit_on_github"] - - versionmod = __import__(setup_cfg["name"] + ".version") - edit_on_github_project = setup_cfg["github_project"] - if versionmod.version.release: - edit_on_github_branch = "v" + versionmod.version.version - else: - edit_on_github_branch = "master" - - edit_on_github_source_root = "" - edit_on_github_doc_root = "docs" diff --git a/pyproject.toml b/pyproject.toml index 3caafc299..cbb2cd4bf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,55 @@ -[build-system] +[project] +name = "halotools" +dynamic = ["version", "dependencies"] +description = "Package designed to analyze N-body simulations and constrain models of cosmology and galaxy evolution" +readme = "README.rst" +authors = [ + { name = "Andrew Hearin", email = "ahearin@anl.gov" } +] +license = { text = "BSD-3-Clause" } +requires-python = ">=3.10" + +[tool.setuptools.dynamic] +dependencies = {file = ["requirements.txt"]} + +[project.optional-dependencies] +test = [ + "coverage[toml]", + "pytest>=7.0", + "pytest-astropy>=0.10", + "pytest-xdist", +] +docs = [ + "sphinx-astropy", + "pytest>=7.0", + "matplotlib", +] + +[tool.setuptools] +include-package-data = true +package-dir = {halotools = "halotools"} +package-data = {halotools = ["data/*", "*/data/*", "*/*/data/*", "*/*/*/data/*", "*/*/*/*/data/*", "*/*/*/*/*/data/*", "*/*/*/*/*/*/data/*"]} +license-files = ["licenses/*.rst"] + +[tool.pytest.ini_options] +minversion = "7.0" +testpaths = ["halotools", "docs"] +astropy_header = true +doctest_plus = "enabled" +text_file_format = "rst" +addopts = [ + "--doctest-rst", +] +markers = ["slow", "installation_test"] + +[build-system] requires = ["setuptools>=42.0.0", "setuptools_scm", "wheel", "oldest-supported-numpy", "cython==3.0.2", "extension-helpers==1.*"] - build-backend = 'setuptools.build_meta' diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 91407e1b9..000000000 --- a/setup.cfg +++ /dev/null @@ -1,54 +0,0 @@ -[metadata] -name = halotools -author = Andrew Hearin -author_email = ahearin@anl.gov -license = BSD 3-Clause -license_files = licenses/LICENSE.rst -url = http://astropy.org -description = Package designed to analyze N-body simulations and constrain models of cosmology and galaxy evolution. -long_description = file: README.rst -long_description_content_type = text/x-rst -edit_on_github = False -github_project = astropy/halotools - -[options] -zip_safe = False -packages = find: -python_requires = >=3.10 -setup_requires = setuptools_scm -install_requires = - astropy - numpy<2 - scipy - requests - beautifulsoup4 - cython - h5py - -[options.extras_require] -all = - h5py -test = - pytest-astropy - h5py -docs = - sphinx-astropy - -[options.package_data] -halotools = - data/* - utils/tests/data/* - sim_manager/tests/data/* - empirical_models/phase_space_models/analytic_models/satellites/nfw/kernels/tests/data/* - - -[tool:pytest] -testpaths = "halotools" "docs" -astropy_header = true -doctest_plus = enabled -text_file_format = rst -addopts = --doctest-rst -markers = - slow - installation_test - diff --git a/tox.ini b/tox.ini index fda193757..72073faf3 100644 --- a/tox.ini +++ b/tox.ini @@ -57,7 +57,7 @@ extras = commands = pip freeze !cov: pytest --pyargs halotools {toxinidir}/docs {posargs} - cov: pytest --pyargs halotools {toxinidir}/docs --cov halotools --cov-config={toxinidir}/setup.cfg {posargs} + cov: pytest --pyargs halotools {toxinidir}/docs --cov halotools --cov-config={toxinidir}/pyproject.toml {posargs} cov: coverage xml -o {toxinidir}/coverage.xml [testenv:build_docs]