Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,18 @@ confv2 = [
"pydata-sphinx-theme",
"sphinx-copybutton",
]
confv3 = [
"sunpy-sphinx-theme@git+https://github.com/sunpy/sunpy-sphinx-theme",
"sphinx-copybutton",
]
all = ["astropy"]
tests = ["pytest"]

[tool.setuptools.package-data]
"sphinx_astropy" = ["local/*"]

[tool.setuptools_scm]
version_file = "sphinx_astropy/version.py"
version_file = "sphinx_astropy/version.py"

[project.entry-points."sphinx.html_themes"]
astropy = "sphinx_astropy.conf.v3.theme"
12 changes: 12 additions & 0 deletions sphinx_astropy/conf/v3/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
#
# Astropy shared Sphinx settings. These settings are shared between
# astropy itself and affiliated packages.
#
# v3 extends v2 to use the shared sunpy-sphinx-theme settings

from sphinx_astropy.conf.v2 import * # noqa: F403

html_theme = "astropy"
html_logo = "https://raw.githubusercontent.com/astropy/astropy-logo/refs/heads/main/astropy_logo_notext.svg"
15 changes: 15 additions & 0 deletions sphinx_astropy/conf/v3/theme/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from pathlib import Path

from sphinx.application import Sphinx


def setup(app: Sphinx):
# Register theme
theme_dir = Path(__file__).parent.resolve()
app.add_html_theme("astropy", theme_dir)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we be a bit more specific on the theme name? Otherwise, if we want to switch again in the future, it might get confusing.

html_theme = 'bootstrap-astropy'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got any suggestions? Calling it sunpy-astropy sounds terrible 😜

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should have moved it to OpenAstronomy! :p

Is astropy-v3-theme also confusing? Naming is hard.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

calling it openastronomy makes the most sense; even if the package itself if not being moved.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling what openastronomy?

Copy link
Member

@astrofrog astrofrog Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The best thing to do might be to move the astropy theme to it's own package as then we can version it properly. Then if we want to rewrite it in a decade we can have v2.0.0 of the theme package?

FWIW we did have a theme package before the current one: https://github.com/astropy/astropy-sphinx-theme

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, before I go much further here I would like to get a 👍 from you all for the following plan:

I propose to move this micro-theme from this PR into astropy-sphinx-theme, under the name "astropy", and then release v2 of that package (optionally deprecating the old theme). This would mean that package would provide two themes, i.e. if you install it you can set html_theme = "astropy" or html_theme = "bootstrap-astropy". If we want to make major changes to the "astropy" theme, we can control that with major versions of that package, or make a "astropy-v2" in the future if needed.

As a prerequisite to that, I will have to do some cleanup of the now very crufty astropy-sphinx-theme repo, and I'll add a doc build to preview the themes etc.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be cleaner as a new theme package? I still think just "astropy" is too vague as theme name.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making a whole new repo with a new theme which is ~100 lines of code and config seems extreme when we already have a repo named "astropy-sphinx-theme"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you have my 👍

app.add_css_file("css/astropy.css", priority=650)

return {
"parallel_read_safe": True,
"parallel_write_safe": True,
}
12 changes: 12 additions & 0 deletions sphinx_astropy/conf/v3/theme/static/css/astropy.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
:root {
/* SunPy Theme Colors */
/* If you add or change the names of these please update the docs */
--sst-accent-color-bright: #ff5000;
--sst-accent-color-muted: #FC9468;
--sst-dark-color: #404040;
--sst-darker-color: #333333;
--sst-darkest-color: #222222;
--sst-light-color: rgb(206, 206, 206);
--sst-lighter-color: rgb(231, 231, 231);
--sst-lightest-color: rgb(251, 251, 251);
}
35 changes: 35 additions & 0 deletions sphinx_astropy/conf/v3/theme/theme.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[theme]
inherit = "sunpy"

[options]
sst_project_name = "Astropy"
sst_site_root = "https://astropy.org"
navbar_links = [
["About",
[
["About Astropy", "about.html", 2],
["Code of Conduct", "code_of_conduct.html", 2],
["Acknowledging & Citing", "acknowledging.html", 2],
["History", "history.html", 2],
]
],
["Documentation",
[
["astropy", "https://docs.astropy.org", 3],
["asdf-astropy", "https://asdf-astropy.readthedocs.io", 3],
["astropy-healpix", "https://astropy-healpix.readthedocs.io", 3],
["astroquery", "https://astroquery.readthedocs.io", 3],
["ccdproc", "https://ccdproc.readthedocs.io", 3],
["photutils", "https://photutils.readthedocs.io", 3],
["regions", "https://astropy-regions.readthedocs.io", 3],
["reproject", "https://reproject.readthedocs.io", 3],
["specreduce", "https://specreduce.readthedocs.io", 3],
["specutils", "https://specutils.readthedocs.io", 3],
]
],
["Get Help", "help.html", 2],
["Contribute", "contribute.html", 2],
["Affiliated Packages", "affiliated/index.html", 2],
["Team", "team.html", 2],
]
rtd_extra_search_projects = [["astropy-org-test", "https://astropy-org-test.readthedocs.io"]]