Skip to content

Use hatch on RTD - #402

Merged
grst merged 5 commits into
mainfrom
grst/hatch-docs
May 8, 2025
Merged

grst merged 5 commits into
mainfrom
grst/hatch-docs

Conversation

@grst

@grst grst commented May 8, 2025 •

Copy link
Copy Markdown
Collaborator

Trying to get RTD to build the docs with hatch.
If this works, it would be an alternative to #400

@github-actions

github-actions Bot commented May 8, 2025

Copy link
Copy Markdown

A PR has been generated to the instance repo:
scverse/cookiecutter-scverse-instance#204

You can check out the PR to preview your changes
in an instance of the cookiecutter template. The PR will be kept in sync with
this PR automatically.

@grst
grst marked this pull request as ready for review May 8, 2025 12:41
@grst
grst requested review from Zethson and flying-sheep May 8, 2025 12:41
@grst

grst commented May 8, 2025

Copy link
Copy Markdown
Collaborator Author

Down from 44s to 26s.

@Zethson Zethson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great!

However, I wonder whether we lose the fail on warning here.

scripts.build = "sphinx-build -M html docs docs/_build {args}"
does not have a -W and we're deleting the sphinx section.

@grst

grst commented May 8, 2025

Copy link
Copy Markdown
Collaborator Author

it should probably be added to pyproject.toml then.

@Zethson Zethson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Now I think it should be good.

@grst

grst commented May 8, 2025

Copy link
Copy Markdown
Collaborator Author

Not sure why we didn't have this in pyproject.toml until now? if we think it's desirable to only have this enabled on RTD by default, the -W flag could also be appended to the hatch run command.

@Zethson Zethson linked an issue May 8, 2025 that may be closed by this pull request
@Zethson

Zethson commented May 8, 2025

Copy link
Copy Markdown
Member

@flying-sheep

Copy link
Copy Markdown
Member

Read the last sentence of your link:

If you are using the build.commands feature, you don't need to make any changes, as the sphinx and mkdocs options are not required when using build.commands.

@flying-sheep flying-sheep left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

About the -W flag: since Sphinx 8.1 it no longer cancels the build, so we get a -1 exit code and also fully built docs, which I think is perfect for the CLI. “Something is wrong” but you can inspect the complete docs.

I wish it was possible to have RTD’s PR status check fail while also having it upload the docs, that would be perfection.

I updated the dependency to sphinx >=8.1 so users can rely on that behavior.

@grst

grst commented May 8, 2025

Copy link
Copy Markdown
Collaborator Author

I think if you provide a custom build command, the entire sphinx: context is ignored

This was referenced Sep 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use UV for RTD build

3 participants