Skip to content

Commit

Permalink
Add edit_on_github as custom config under tools section
Browse files Browse the repository at this point in the history
  • Loading branch information
KasukabeDefenceForce committed Jul 10, 2024
1 parent 656d498 commit bd9068f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
21 changes: 10 additions & 11 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@

with open(toml_conf_path, 'r') as f_toml:
toml_config = toml.load(f_toml)
toml_config_dict = toml_config["project"]
for k,v in toml_config_dict.items():
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 ----------------------------------------------------
Expand Down Expand Up @@ -193,16 +194,16 @@
# -- Project information ------------------------------------------------------

# This does not *have* to match the package name, but typically does
project = toml_config_dict["name"]
author = toml_config_dict["authors"][0]["name"]
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(toml_config_dict["name"])
package = sys.modules[toml_config_dict["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]
Expand Down Expand Up @@ -288,20 +289,18 @@

# -- Options for the edit_on_github extension ---------------------------------

if toml_config_dict.get("edit_on_github") == "true":
if toml_config_tool_dict["tardis"]['edit_on_github'] == True:

extensions += ["sphinx_astropy.ext.edit_on_github"]

edit_on_github_project = toml_config_dict["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 = toml_config_dict['urls']['Issues']
print("HERE:", github_issues_url)

github_issues_url = toml_config_project_dict['urls']['Issues']

# -- Options for linkcheck output -------------------------------------------
linkcheck_retry = 5
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ readme = { file = "README.rst", content-type = "text/x-rst" }
requires-python = ">=3.7"
dependencies = ["astropy"]
dynamic = ["version"]
edit_on_github = false

[project.optional-dependencies]
test = ['pytest-astropy']
Expand Down Expand Up @@ -182,4 +181,7 @@ tardis_visualization = ["tools/tests/data/*"]
testpaths = ["tardis"]
addopts = "--astropy-header"
# doctest_plus = "disabled"
text_file_format = "rst"
text_file_format = "rst"

[tool.tardis]
edit_on_github = false

0 comments on commit bd9068f

Please sign in to comment.