Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pydata 0.15 #228

Merged
merged 27 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
14be8c3
Make some updates for 0.14
Cadair Sep 15, 2023
2a97f69
Add more packages to list
Cadair Sep 15, 2023
0cf8206
Add some more style
Cadair Sep 18, 2023
92cba39
Add more colours and testing element to test_package
Cadair Sep 18, 2023
769e742
More work towards a sunpy colour scheme
Cadair Sep 18, 2023
38c646a
Precommit
nabobalis Dec 30, 2023
f506500
rando
nabobalis Dec 30, 2023
1947d5e
More tweaks to colors
nabobalis Dec 30, 2023
baac863
Merge branch 'main' of github.com:sunpy/sunpy-sphinx-theme into pr/228
nabobalis Dec 31, 2023
5b3df1e
More upstream colors, ULTRA KILL
nabobalis Jan 1, 2024
fab641a
Revert in future maybe
nabobalis Jan 1, 2024
1cbe91d
Colors
nabobalis Jan 1, 2024
496a93c
Update pyproject.toml
nabobalis Jan 8, 2024
c64f39c
Merge branch 'main' into pydata_0.14
Cadair Feb 14, 2024
4ecdffa
pre-commit
nabobalis Mar 7, 2024
f94be4d
override light pygments theme
nabobalis Mar 7, 2024
b4cd4f9
Fix navbar color
nabobalis Mar 7, 2024
2bf56db
Footer is now same as header in light theme
nabobalis Mar 7, 2024
37521d9
fix mouse over for theme change
nabobalis Mar 7, 2024
8ad3845
Merge pull request #1 from nabobalis/pydata_0.14
Cadair Mar 7, 2024
51bed15
Remove duplicate variables which are defined in light/dark
Cadair Mar 20, 2024
37468de
Some cleanup
Cadair Mar 20, 2024
da9dac9
Change dark theme background color back to old one
Cadair Mar 20, 2024
c2ddbf9
Simplify footer text color
Cadair Mar 20, 2024
18fb887
Change footer background colours to be closer to old
Cadair Mar 20, 2024
8908957
Remove double underline for xhoverref
Cadair Mar 20, 2024
5cd7b94
Fix misalignment of sidebar toggles
Cadair Mar 20, 2024
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
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ ci:
autoupdate_schedule: "quarterly"
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.1.9"
rev: "v0.3.1"
hooks:
- id: ruff
args: ["--fix"]
- repo: https://github.com/PyCQA/autoflake
rev: v2.2.1
rev: v2.3.0
hooks:
- id: autoflake
args:
Expand All @@ -27,7 +27,7 @@ repos:
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.2.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-prettier
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ conda:
sphinx:
builder: html
configuration: docs/conf.py
fail_on_warning: false
fail_on_warning: True

formats:
- htmlzip
Expand Down
17 changes: 17 additions & 0 deletions docs/colors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,23 @@ The following image should help you understand these overlays:
</div>
</div>

Admonitions
-----------

.. admonition:: Generic Admonition

Generic admonition needs content apparently

.. attention:: attention
.. caution:: caution
.. danger:: danger
.. error:: error
.. hint:: hint
.. important:: important
.. note:: note
.. tip:: tip
.. warning:: warning

Snippets
--------

Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Configuration file for the Sphinx documentation builder.
"""

import os
import sys
import datetime
Expand Down
1 change: 1 addition & 0 deletions docs/test_package/animals.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This module provides a collection of functions.
"""

from sunpy.util.decorators import deprecated

__all__ = [
Expand Down
1 change: 1 addition & 0 deletions docs/test_package/timerange.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This module provides a object that can handle a time range.
"""

from datetime import timedelta

import astropy.units as u
Expand Down
1 change: 1 addition & 0 deletions examples/example_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
thing>. Include links to referenced packages like this: `sunpy.io.fits` to
show the sunpy.io.fits or like this `~sunpy.io.fits` to show just 'fits'
"""

###########################################################################
# If you have multiple plots in your example, Sphinx will use the first
# plot for the thumbnail by default. You can set which plot is used as the
Expand Down
1 change: 1 addition & 0 deletions examples/section/example_template_subsection.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
thing>. Include links to referenced packages like this: `sunpy.io.fits` to
show the sunpy.io.fits or like this `~sunpy.io.fits` to show just 'fits'
"""

###########################################################################
# If you have multiple plots in your example, Sphinx will use the first
# plot for the thumbnail by default. You can set which plot is used as the
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ classifiers = [
]
requires-python = ">=3.9"
dependencies = [
"pydata-sphinx-theme<0.14",
"pydata-sphinx-theme~=0.15.0",
"sphinx"
]

Expand Down
34 changes: 5 additions & 29 deletions src/sunpy_sphinx_theme/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
SunPy Sphinx Theme.
"""

import os
from pathlib import Path
from functools import partial
Expand All @@ -17,8 +18,7 @@ def get_html_theme_path():
Return list of HTML theme paths.
"""
parent = Path(__file__).parent.resolve()
theme_path = parent / "theme" / "sunpy"
return theme_path
return parent / "theme" / "sunpy"


def default_navbar():
Expand Down Expand Up @@ -69,10 +69,9 @@ def update_config(app):
# To do this, you must manually modify `app.builder.theme_options`.
theme_options = utils.get_theme_options_dict(app)

if theme_options.get("sst_logo"):
if not isinstance(theme_options["sst_logo"], dict):
sst_logo = str(theme_options["sst_logo"])
theme_options["sst_logo"] = {"light": sst_logo, "dark": sst_logo}
if theme_options.get("sst_logo") and not isinstance(theme_options["sst_logo"], dict):
sst_logo = str(theme_options["sst_logo"])
theme_options["sst_logo"] = {"light": sst_logo, "dark": sst_logo}

theme_options["sst_is_root"] = bool(theme_options.get("sst_is_root", False))

Expand Down Expand Up @@ -132,28 +131,6 @@ def update_html_context(app: Sphinx, pagename: str, templatename: str, context,
context["sst_pathto"] = partial(sst_pathto, context)


# See https://github.com/pydata/pydata-sphinx-theme/blob/f6e1943c5f9fab4442f7e7d6f5ce5474833b66f6/src/pydata_sphinx_theme/__init__.py#L178
# Copied here to make footer_center behave like footer start and end
def update_and_remove_templates(app: Sphinx, pagename: str, templatename: str, context, doctree) -> None:
"""
Update template names and assets for page build.
"""
# Allow for more flexibility in template names
template_sections = [
"theme_footer_center",
]
for section in template_sections:
if context.get(section):
# Break apart `,` separated strings so we can use , in the defaults
if isinstance(context.get(section), str):
context[section] = [ii.strip() for ii in context.get(section).split(",")]

# Add `.html` to templates with no suffix
for ii, template in enumerate(context.get(section)):
if not os.path.splitext(template)[1]:
context[section][ii] = template + ".html"


def setup(app: Sphinx):
# Register theme
theme_dir = get_html_theme_path()
Expand All @@ -162,7 +139,6 @@ def setup(app: Sphinx):

app.connect("builder-inited", update_config)
app.connect("html-page-context", update_html_context)
app.connect("html-page-context", update_and_remove_templates)

return {
"parallel_read_safe": True,
Expand Down
10 changes: 9 additions & 1 deletion src/sunpy_sphinx_theme/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@
now been moved into the theme itself or can be imported from the main namespace
of the theme.
"""

from sunpy_sphinx_theme import ON_RTD as on_rtd # noqa
from sunpy_sphinx_theme import PNG_ICON as png_icon # noqa
from sunpy_sphinx_theme import SVG_ICON as svg_icon # noqa
from sunpy_sphinx_theme import get_html_theme_path

__all__ = ["html_static_path", "html_theme_path", "html_theme", "on_rtd", "png_icon", "svg_icon"]
__all__ = [
"html_static_path",
"html_theme_path",
"html_theme",
"on_rtd",
"png_icon",
"svg_icon",
]

html_theme = "sunpy"
html_theme_options = {}
Expand Down
Loading