GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — DOC: update to scipy-doctest 1.6.0 and fix tests by mattip · Pull Request #28023 · numpy/numpy

Conversation

@mattip

@mattip mattip commented Dec 17, 2024

Copy link
Copy Markdown
Member
  • update scipy-doctest to 1.6.0
  • remove the check-docs from the linux benchmark CI run, if desired this should become a separate run
  • fix failing doctests

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mattip
DOC: update to scipy-doctest 1.6.1 and fix tests [skip azp][skip cirrus]
5260965
@github-actions github-actions Bot added the 04 - Documentation label Dec 17, 2024
mattip
mattip commented Dec 17, 2024
View reviewed changes
Comment thread numpy/_core/_add_newdocs.py
['??->?', 'bb->b', 'BB->B', 'hh->h', 'HH->H', 'ii->i', 'II->I', 'll->l',
'LL->L', 'qq->q', 'QQ->Q', 'ff->f', 'dd->d', 'gg->g', 'FF->F', 'DD->D',
'GG->G', 'OO->O']
['??->?', 'bb->b', 'BB->B', 'hh->h', 'HH->H', 'ii->i', 'II->I', ...

@mattip mattip Dec 17, 2024

Copy link
Copy Markdown
Member Author

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.

Doctest does not like splitting lines, and I think a few examples is plenty. BTW, the docstring itself (on lines 5069-5074) is pretty unclear. I think the type signature mini-language is documented elsewhere, perhaps this docstring should point there?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@seberg seberg Dec 17, 2024

Copy link
Copy Markdown
Member

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.

Not sure why long lines are an issue, but I agree that this can be short and this seems fine.
Not sure we have a good place to link to (maybe the ufunc registration), but the few who have a reason to look at it, know about it anyway, I think...

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
mattip
mattip commented Dec 17, 2024
View reviewed changes
Comment thread numpy/polynomial/_polybase.py Outdated
Create a polynomial object for ``1 + 7*x + 4*x**2``:

# set the print format to ascii for doctests
>>> np.polynomial.set_default_printstyle("ascii")

@mattip mattip Dec 17, 2024

Copy link
Copy Markdown
Member Author

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.

I could have used 'unicode' but I am not sure what windows CI does...

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@seberg seberg Dec 17, 2024

Copy link
Copy Markdown
Member

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.

For this one, I think it would be nice to keep the unicode, because users are more likely to see it then not, I believe.

I suspect numpy/conftest.py is read? Maybe we can do p.polynomial.set_default_printstyle("unicode") there to remove windows from the equation?
(I think different defaults is just about bad terminals, which might print oddly if the test fails, but shouldn't influence test results.)

But if this isn't trivial, we can also just do this.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@mattip mattip Dec 18, 2024

Copy link
Copy Markdown
Member Author

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.

I changed it to unicode and checked that it works on my windows 10 machine. I prefer to leave the np.polynomial.set_default_printstyle in the example so it is more obvious there is an alternative. MAybe @rossbar knows why windows defaults to ascii?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@seberg seberg Dec 18, 2024

Copy link
Copy Markdown
Member

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.

OK, maybe @rossbar can follow up if he prefers a different approach, would be nice to get this in.

IIRC, some windows terminals (older powershell?) have poor unicode printing support (it may even have just been the font missing symbols).

The overview docs and the docs of set_default_printstyle itself mention it, so I think that setting it globally would be OK, but then those two places should make sure to reset it to whatever it (with a comment that docs use unicode).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mattip

mattip commented Dec 17, 2024

Copy link
Copy Markdown
Member Author

Closes #28019

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

seberg
seberg approved these changes Dec 17, 2024
View reviewed changes

@seberg seberg left a comment

Copy link
Copy Markdown
Member

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.

LGTM thanks for quickly looking into it and also disabling that confusing benchmark thing :).

I would slightly prefer to keep using the unicode printing, but if that isn't trivial, this all seems good.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread numpy/_core/_add_newdocs.py
['??->?', 'bb->b', 'BB->B', 'hh->h', 'HH->H', 'ii->i', 'II->I', 'll->l',
'LL->L', 'qq->q', 'QQ->Q', 'ff->f', 'dd->d', 'gg->g', 'FF->F', 'DD->D',
'GG->G', 'OO->O']
['??->?', 'bb->b', 'BB->B', 'hh->h', 'HH->H', 'ii->i', 'II->I', ...

@seberg seberg Dec 17, 2024

Copy link
Copy Markdown
Member

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.

Not sure why long lines are an issue, but I agree that this can be short and this seems fine.
Not sure we have a good place to link to (maybe the ufunc registration), but the few who have a reason to look at it, know about it anyway, I think...

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread numpy/polynomial/_polybase.py Outdated
Create a polynomial object for ``1 + 7*x + 4*x**2``:

# set the print format to ascii for doctests
>>> np.polynomial.set_default_printstyle("ascii")

@seberg seberg Dec 17, 2024

Copy link
Copy Markdown
Member

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.

For this one, I think it would be nice to keep the unicode, because users are more likely to see it then not, I believe.

I suspect numpy/conftest.py is read? Maybe we can do p.polynomial.set_default_printstyle("unicode") there to remove windows from the equation?
(I think different defaults is just about bad terminals, which might print oddly if the test fails, but shouldn't influence test results.)

But if this isn't trivial, we can also just do this.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mattip
DOC: use unicode formatting in polynomial doctest [skip actions][skip…
84fa489
… azp][skip cirrus]
seberg
seberg reviewed Dec 18, 2024
View reviewed changes
Comment thread numpy/_core/_add_newdocs.py

But if the arrays have different dtype metadata, the metadata may be
dropped:
If the arrays have different dtype metadata, the first one wins:

@seberg seberg Dec 18, 2024

Copy link
Copy Markdown
Member

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.

N.B.: The previous example says "currently", so I think this is fine, but we shouldn't make promises around this.
(the only true safe thing to do, IMO is to never propagate unless the dtype has custom logic)

FWIW, this works for our numerical dtypes, one already can't expect it to work e.g. with strings.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@mattip mattip Dec 18, 2024

Copy link
Copy Markdown
Member Author

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.

I am not sure about the current rules, but the test was failing so I fixed the test and the comment accordingly.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

seberg reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@seberg
seberg merged commit cb34472 into numpy:main Dec 18, 2024
@seberg seberg mentioned this pull request Dec 19, 2024
TST,DOC: Bump scipy_doctest (or remove pin) and fix new failures #28019
Closed
@mattip
mattip deleted the doctest-1.6.0 branch May 5, 2025 11:22
@ev-br ev-br mentioned this pull request May 30, 2025
MAINT: Bump scipy-doctest to 1.8 #29085
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@seberg seberg seberg approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

04 - Documentation

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@mattip @seberg
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.