Skip to content

sphinx ext: include autosummary templates and extensions from cookiecutter-scverse#60

Merged
ilia-kats merged 9 commits into
mainfrom
autosummary_templates
Jul 3, 2026
Merged

sphinx ext: include autosummary templates and extensions from cookiecutter-scverse#60
ilia-kats merged 9 commits into
mainfrom
autosummary_templates

Conversation

@ilia-kats

Copy link
Copy Markdown
Collaborator

This moves the autosummary templates and custom Sphinx extensions from cookiecutter-scverse into our own Sphinx extension. See also the discussion in scverse/cookiecutter-scverse#483.

ilia-kats added 2 commits July 1, 2026 15:07
This moves the autosummary templates and custom Sphinx extensions from
cookiecutter-scverse into our own Sphinx extension. See also the
discussion in scverse/cookiecutter-scverse#483
@ilia-kats ilia-kats requested review from flying-sheep and grst July 1, 2026 13:08
@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.72727% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.26%. Comparing base (a1e1f01) to head (d423a0f).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/scverse_misc/sphinx_ext/__init__.py 92.72% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #60      +/-   ##
==========================================
- Coverage   93.28%   93.26%   -0.02%     
==========================================
  Files          11       11              
  Lines         536      579      +43     
==========================================
+ Hits          500      540      +40     
- Misses         36       39       +3     
Files with missing lines Coverage Δ
src/scverse_misc/sphinx_ext/__init__.py 89.06% <92.72%> (+1.14%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@grst

grst commented Jul 1, 2026

Copy link
Copy Markdown

I don't see any issues from the technical side.
I think some lines would need to be added to the scverse_misc docs to describe this additional functionality of the sphinx extension, how to enable it, and why this is needed.

@ilia-kats

Copy link
Copy Markdown
Collaborator Author

I've added some docs. I would love to get rid of our own _templates/autosummary/class.rst and just dogfood, but that template contains a workaround for sphinx-doc/sphinx#14515, which we need. I'm also happy to include the workaround in the shipped template file or try to fix napoleon's _skip_member and ship the fixed version here until it's released as part of Sphinx.

@grst

grst commented Jul 2, 2026

Copy link
Copy Markdown
  • Once this is merged, can't we update the template to use scverse_misc and get rid of all custom sphinx extensions there?
  • Keeping the workaround until it's fixed upstream sounds reasonable. Maybe we can also track it in a ticket in scverse_misc so we don't forget to remove it eventually.

@ilia-kats

Copy link
Copy Markdown
Collaborator Author

Once this is merged, can't we update the template to use scverse_misc and get rid of all custom sphinx extensions there?

That's the plan, isn't it?

@grst

grst commented Jul 2, 2026

Copy link
Copy Markdown

It is, but what do you mean by this then?

I'm also happy to include the workaround in the shipped template file

@ilia-kats

ilia-kats commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator Author

So scverse_misc currently has two sets of templates: One in docs/_templates, which was inherited from the cookiecutter template and is currently used to build the scverse_misc docs, and one in src/scverse_misc/sphinx_ext/templates (added in this PR), which will be used by downstream packages. The former contains the workaround (introduced in #40), the latter does not. So we can either also apply the workaround to the sphinx_ext template, or I attempt to fix the napoleon bug and make the fix part of our sphinx extension.

@grst

grst commented Jul 2, 2026

Copy link
Copy Markdown

IIUC, this bug only affects a minority of repos that want to document "special" functions with sphinx autodocs.
In that case I would keep the workaround in the local docs/_template fix and leave the sphinx_ext umodified and work on the napoleon fix in parallel.

Comment thread tests/test_sphinx.py
Comment thread src/scverse_misc/sphinx_ext/__init__.py
yield line


def _parse_returns_section(self: NumpyDocstring, section: str) -> list[str]:

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.

we should document that we do this (and what “this” is).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done. Not sure if that one sentence is enough, but the cookiecutter thing wasn't documented at all, so better than it used to be, I guess?

Comment thread tests/deprecation_decorator/test_sphinx.py Outdated
@ilia-kats ilia-kats enabled auto-merge (squash) July 3, 2026 14:04
@ilia-kats ilia-kats merged commit 3632417 into main Jul 3, 2026
12 checks passed
@ilia-kats ilia-kats deleted the autosummary_templates branch July 3, 2026 14:06
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.

3 participants