Skip to content

Use hatch on RTD#402

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

Use hatch on RTD#402
grst merged 5 commits into
mainfrom
grst/hatch-docs

Conversation

@grst
Copy link
Copy Markdown
Collaborator

@grst grst commented May 8, 2025

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2025

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
Copy link
Copy Markdown
Collaborator Author

grst commented May 8, 2025

Down from 44s to 26s.

Copy link
Copy Markdown
Member

@Zethson Zethson left a comment

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
Copy link
Copy Markdown
Collaborator Author

grst commented May 8, 2025

it should probably be added to pyproject.toml then.

Copy link
Copy Markdown
Member

@Zethson Zethson left a comment

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
Copy link
Copy Markdown
Collaborator Author

grst commented May 8, 2025

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
Copy link
Copy Markdown
Member

Zethson commented May 8, 2025

Actually, why does this work?

https://about.readthedocs.com/blog/2024/12/deprecate-config-files-without-sphinx-or-mkdocs-config/

We should need a configuration key.

@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.

Copy link
Copy Markdown
Member

@flying-sheep flying-sheep left a comment

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
Copy link
Copy Markdown
Collaborator Author

grst commented May 8, 2025

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