Skip to content

TST/DOC: set up doctesting - #921

Open
fbourgey wants to merge 1 commit into
data-apis:mainfrom
fbourgey:doctest
Open

TST/DOC: set up doctesting#921
fbourgey wants to merge 1 commit into
data-apis:mainfrom
fbourgey:doctest

Conversation

@fbourgey

Copy link
Copy Markdown
Contributor

Closes #397

This PR tries to set up doctesting using scipy_doctest. I had to fixed a couple of doc examples for pixi run doctests to pass.

I worked with Codex on this, notably the conftest.py.

@fbourgey
fbourgey marked this pull request as draft August 13, 2026 18:00
@fbourgey
fbourgey marked this pull request as ready for review August 13, 2026 18:12
@fbourgey

Copy link
Copy Markdown
Contributor Author

cc @lucascolley

@lucascolley
lucascolley self-requested a review August 13, 2026 20:32
@lucascolley lucascolley added DX testing documentation Improvements or additions to documentation labels Aug 14, 2026
@lucascolley lucascolley changed the title DEV: set up doctesting TST/DOC: set up doctesting Aug 14, 2026
@lucascolley lucascolley removed the DX label Aug 14, 2026
@lucascolley lucascolley added this to the 0.11.2 milestone Aug 14, 2026
@lucascolley

Copy link
Copy Markdown
Member

aha, thanks for working on this! There are some merge conflicts now, sorry, bad timing with a big refactor. Let me know if you have any trouble resolving them.

@lucascolley
lucascolley removed their request for review August 15, 2026 15:14
>>> import array_api_extra as xpx
>>> xpx.at(x, idx).set(value) # or add(value), etc.
>>> xpx.at(x)[idx].set(value)
import array_api_extra as xpx

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.

Removing >>> disables the doctester AFAIU, is this the intent here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes. is there a better way?

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.

why are we disabling the doctester though? Can we not fix the example instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think they are all illustrative snippets (pseudocode): idx, x, value are not defined for example. Do you suggest making them all proper doc examples?

@ev-br ev-br Aug 17, 2026

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.

FWIW I did not realize these are illustrations nit proper examples. The latter are preferable long-term, but if your goal now is to shield this docstring from doctesting, sure, removing the REPL prompt is the way.
An alternative is to add the function name into the skiplist (cd scipy's conftest). Or indeed make a full doctest example, which us obviously more work.
Which of these options is preferable, I can't say. And won't hold this PR for either of these.

@fbourgey

Copy link
Copy Markdown
Contributor Author

aha, thanks for working on this! There are some merge conflicts now, sorry, bad timing with a big refactor. Let me know if you have any trouble resolving them.

@lucascolley I think the conflicts are fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DOC/TST: Add some form of doctesting

3 participants