-
Notifications
You must be signed in to change notification settings - Fork 19
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
API docs updates #493
Merged
Merged
API docs updates #493
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
e307633
Add custom stylesheet for API reference
Yoshanuikabundi c4b8220
Improve code readability in dark mode
Yoshanuikabundi fddec84
Typos
Yoshanuikabundi ffebeee
Correct misleading time estimate
Yoshanuikabundi 42eea9c
Add function autoproperty to CSS
Yoshanuikabundi c883a05
Set up intersphinx
Yoshanuikabundi f79e535
Autosummary for API reference
Yoshanuikabundi 4ff5ba2
Fix openmm_rfe settings docs
Yoshanuikabundi eb2c67a
Check in SASS rather than compiled CSS
Yoshanuikabundi 474fb35
Merge branch 'main' into docs-updates
Yoshanuikabundi a60f9b6
Apply suggestions from code review
Yoshanuikabundi cb00685
More consistent and contrasting colors
Yoshanuikabundi 6c49437
Hide misleading field list from settings docs
Yoshanuikabundi c0d747f
Limit reference TOC depth
Yoshanuikabundi 096b6e2
Fix links in settings docs
Yoshanuikabundi 17e7502
Merge branch 'main' into docs-updates
Yoshanuikabundi 5517a27
Update openfe/protocols/openmm_rfe/equil_rfe_settings.py
Yoshanuikabundi c0e76ff
PEP8
Yoshanuikabundi 3d5e4a0
Fix field ordering
Yoshanuikabundi 5267ab8
Fix docstrings for protocol settings
Yoshanuikabundi 8ffdccf
Merge branch 'main' into docs-updates
Yoshanuikabundi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,6 +76,7 @@ instance/ | |
|
||
# Sphinx documentation | ||
docs/_build/ | ||
docs/reference/api/generated | ||
|
||
# PyBuilder | ||
.pybuilder/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
""" | ||
sphinxcontrib-sass | ||
https://github.com/attakei-lab/sphinxcontrib-sass | ||
Kayuza Takei | ||
Apache 2.0 | ||
|
||
Modified to: | ||
- Write directly to Sphinx output directory | ||
- Infer targets if not given | ||
- Ensure ``target: Path`` in ``configure_path()`` | ||
- Return version number and thread safety from ``setup()`` | ||
- Use compressed style by default | ||
- More complete type checking | ||
""" | ||
|
||
from os import PathLike | ||
from pathlib import Path | ||
from typing import Optional, Union | ||
|
||
|
||
import sass | ||
from sphinx.application import Sphinx | ||
from sphinx.environment import BuildEnvironment | ||
from sphinx.util import logging | ||
|
||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def configure_path(conf_dir: str, src: Optional[Union[PathLike, Path]]) -> Path: | ||
if src is None: | ||
target = Path(conf_dir) | ||
else: | ||
target = Path(src) | ||
if not target.is_absolute(): | ||
target = Path(conf_dir) / target | ||
return target | ||
|
||
|
||
def get_targets(app: Sphinx) -> dict[Path, Path]: | ||
src_dir = configure_path(app.confdir, app.config.sass_src_dir) | ||
dst_dir = configure_path(app.outdir, app.config.sass_out_dir) | ||
|
||
if isinstance(app.config.sass_targets, dict): | ||
targets = app.config.sass_targets | ||
else: | ||
targets = { | ||
path: path.relative_to(src_dir).with_suffix(".css") | ||
for path in src_dir.glob("**/[!_]*.s[ca]ss") | ||
} | ||
|
||
return {src_dir / src: dst_dir / dst for src, dst in targets.items()} | ||
|
||
|
||
def build_sass_sources(app: Sphinx, env: BuildEnvironment): | ||
logger.debug("Building stylesheet files") | ||
include_paths = [str(p) for p in app.config.sass_include_paths] | ||
targets = get_targets(app) | ||
output_style = app.config.sass_output_style | ||
# Build css files | ||
for src, dst in targets.items(): | ||
content = src.read_text() | ||
css = sass.compile( | ||
string=content, | ||
output_style=output_style, | ||
include_paths=[str(src.parent)] + include_paths, | ||
) | ||
dst.parent.mkdir(exist_ok=True, parents=True) | ||
dst.write_text(css) | ||
|
||
|
||
def setup(app: Sphinx): | ||
""" | ||
Setup function for this extension. | ||
""" | ||
logger.debug(f"Using {__name__}") | ||
app.add_config_value("sass_include_paths", [], "html") | ||
app.add_config_value("sass_src_dir", None, "html") | ||
app.add_config_value("sass_out_dir", None, "html") | ||
app.add_config_value("sass_targets", None, "html") | ||
app.add_config_value("sass_output_style", "compressed", "html") | ||
app.connect("env-updated", build_sass_sources) | ||
|
||
return { | ||
"version": "0.3.4ofe", | ||
"parallel_read_safe": True, | ||
"parallel_write_safe": True, | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason not to open a PR upstream for these changes? I'm fine with vendoring for now, but if upstream will take the changes, I'd rather be able to remove this from our maintenance burden.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The crucial change is that it now writes to the build directory rather than the source directory, which is helpful for minimising the mess that Sphinx re-builds can get into. Once I vendored it to fix that, it seemed worthwhile to make more changes to make it a more natural fit. I'll open a PR upstream and see what happens :)