diff --git a/docs/conf.py b/docs/conf.py index a1f2640a849..c6b6173d341 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -30,6 +30,8 @@ import datetime import tardis # FIXME: this import is required by astropy.constants from importlib import import_module +import toml +from pathlib import Path try: from sphinx_astropy.conf.v1 import * # noqa @@ -39,13 +41,15 @@ ) sys.exit(1) -# Get configuration information from setup.cfg -from configparser import ConfigParser +#Get configuration information from pyproject.toml +toml_conf_path = Path(__file__).parent.parent / "pyproject.toml" -conf = ConfigParser() - -conf.read([os.path.join(os.path.dirname(__file__), "..", "setup.cfg")]) -setup_cfg = dict(conf.items("metadata")) +with open(toml_conf_path, 'r') as f_toml: + toml_config = toml.load(f_toml) +toml_config_project_dict = toml_config["project"] +toml_config_tool_dict = toml_config['tool'] +for k,v in toml_config_project_dict.items(): + print(k,v) # -- General configuration ---------------------------------------------------- @@ -182,16 +186,16 @@ # -- Project information ------------------------------------------------------ # This does not *have* to match the package name, but typically does -project = setup_cfg["name"] -author = setup_cfg["author"] +project = toml_config_project_dict["name"] +author = toml_config_project_dict["authors"][0]["name"] copyright = "2013-{0}, {1}".format(datetime.datetime.now().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_module(setup_cfg["name"]) -package = sys.modules[setup_cfg["name"]] +import_module(toml_config_project_dict["name"]) +package = sys.modules[toml_config_project_dict["name"]] # The short X.Y version. version = "latest" # package.__version__.split("-", 1)[0] @@ -277,21 +281,18 @@ # -- Options for the edit_on_github extension --------------------------------- -if setup_cfg.get("edit_on_github").lower() == "true": +if toml_config_tool_dict["tardis"]['edit_on_github'] == True: extensions += ["sphinx_astropy.ext.edit_on_github"] - edit_on_github_project = setup_cfg["github_project"] + edit_on_github_project = toml_config_project_dict["github_project"] edit_on_github_branch = "main" edit_on_github_source_root = "" edit_on_github_doc_root = "docs" # -- Resolving issue number to links in changelog ----------------------------- -github_issues_url = "https://github.com/{0}/issues/".format( - setup_cfg["github_project"] -) - +github_issues_url = toml_config_project_dict['urls']['Issues'] # -- Options for linkcheck output ------------------------------------------- linkcheck_retry = 5 diff --git a/pyproject.toml b/pyproject.toml index 5324634e81f..e54125cde14 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,37 @@ +[project] +name = "tardis" +authors = [{ name = "TARDIS Collaboration", email = "wkerzendorf@gmail.com" }] +license = { text = "BSD-3-Clause" } +classifiers = ["License :: OSI Approved :: BSD License"] +description = "TARDIS - Temperature And Radiative Diffusion In Supernovae" +readme = { file = "README.rst", content-type = "text/x-rst" } +requires-python = ">=3.7" +dependencies = ["astropy"] +dynamic = ["version"] + +[project.optional-dependencies] +test = ["pytest-astropy"] +docs = ["sphinx-astropy"] + +[project.scripts] +cmfgen2tardis = "tardis.scripts.cmfgen2tardis:main" + +[project.urls] +Homepage = "https://tardis-sn.github.io/" +Documentation = "https://tardis-sn.github.io/tardis/" +Repository = "https://github.com/tardis-sn/tardis" +Issues = "https://github.com/tardis-sn/tardis/issues/" +Changelog = "https://tardis-sn.github.io/tardis/contributing/CHANGELOG.html" + [build-system] requires = ["setuptools", "setuptools_scm", "wheel"] -build-backend = 'setuptools.build_meta' +build-backend = "setuptools.build_meta" [tool.black] line-length = 80 -target-version = ['py36'] +target-version = ["py36"] exclude = ''' ( /( @@ -137,3 +162,30 @@ known-first-party = ["tardis", "carsus", "stardis"] [tool.ruff.lint.pydocstyle] convention = "numpy" + +[tool.setuptools] +packages = ["tardis"] +license-files = ["LICENSE.rst", "licenses/*.rst"] + +[tool.setuptools.package-data] +tardis = ["data/*"] +tardis_grid = ["tests/data/*", "./"] +tardis_io = [ + "configuration/schemas/*", + "configuration/tests/data/*", + "model/readers/tests/data/*" +] +tardis_model_tests = ["data/*"] +tardis_montecarlo_tests = ["data/*"] +tardis_plasma_tests = ["data/*"] +tardis_scripts = ["debug/*"] +tardis_tests_integration_tests = ["**/*"] +tardis_visualization = ["tools/tests/data/*"] + +[tool.pytest.ini_options] +testpaths = ["tardis"] +astropy_header = true +text_file_format = "rst" + +[tool.tardis] +edit_on_github = false \ No newline at end of file diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index b22542f996b..00000000000 --- a/setup.cfg +++ /dev/null @@ -1,91 +0,0 @@ -[metadata] -name = tardis -author = TARDIS Collaboration -author_email = wkerzendorf@gmail.com -license = BSD 3-Clause -license_file = licenses/LICENSE.rst -url = https://tardis-sn.github.io/tardis -description = TARDIS - Temperature And Radiative Diffusion In Supernovae -long_description = file: README.rst -long_description_content_type = text/x-rst -edit_on_github = False -github_project = tardis-sn/tardis - -[options] -zip_safe = False -packages = find: -python_requires = >=3.7 -setup_requires = setuptools_scm -install_requires = - astropy - -[options.extras_require] -test = - pytest-astropy -docs = - sphinx-astropy - -[options.package_data] -tardis = - data/* -tardis.grid = - tests/data/* - ./* -tardis.io = - configuration/schemas/* - configuration/tests/data/* - model/readers/tests/data/* -tardis.model.tests = data/* -tardis.montecarlo.tests = data/* -tardis.plasma.tests = data/* -tardis.scripts = debug/* -tardis.tests.integration_tests = **/* -tardis.visualization = - tools/tests/data/* - -[tool:pytest] -testpaths = "tardis" # "docs" -astropy_header = true -# doctest_plus = disabled -text_file_format = rst -# addopts = --doctest - -# The following coverage configuration works only with `tox`. We keep our -# coverage configuration in `.coveragerc`. -[coverage:run] -omit = - tardis/_astropy_init* - tardis/conftest.py - tardis/*setup_package* - tardis/tests/* - tardis/*/tests/* - tardis/extern/* - tardis/version* - */tardis/_astropy_init* - */tardis/conftest.py - */tardis/*setup_package* - */tardis/tests/* - */tardis/*/tests/* - */tardis/extern/* - */tardis/version* - -[coverage:report] -exclude_lines = - # Have to re-enable the standard pragma - pragma: no cover - # Don't complain about packages we have installed - except ImportError - # Don't complain if tests don't hit assertions - raise AssertionError - raise NotImplementedError - # Don't complain about script hooks - def main\(.*\): - # Ignore branches that don't pertain to this version of Python - pragma: py{ignore_python_version} - # Don't complain about IPython completion helper - def _ipython_key_completions_ - -[options.entry_points] -console_scripts = - cmfgen2tardis = tardis.scripts.cmfgen2tardis:main - tardis_test_runner = tardis.tests.integration_tests.runner:run_tests