Skip to content

TST/DEP: set direct requirements on test dependencies with accurate lower bounds#18780

Closed
neutrinoceros wants to merge 4 commits intoastropy:mainfrom
neutrinoceros:tst/dep/set-direct-requirement-on-hypothesis
Closed

TST/DEP: set direct requirements on test dependencies with accurate lower bounds#18780
neutrinoceros wants to merge 4 commits intoastropy:mainfrom
neutrinoceros:tst/dep/set-direct-requirement-on-hypothesis

Conversation

@neutrinoceros
Copy link
Copy Markdown
Contributor

@neutrinoceros neutrinoceros commented Oct 25, 2025

Description

Problem: mindeps testing still runs on the latest version of hypothesis, because it isn't already declared as a direct dependency (instead we rely on the meta-package pytest-astropy to provide it), and we resolve this test env with --resolution=lowest-direct (I'm actively working on moving to --resolution=lowest but this will take some work upstream and time).
Other test dependencies that we only pull in via pytest-astropy might also create issues but hypothesis is the one blocker I'm having right now in my trials for --resolution=lowest, because it emits a warning (for which I'm adding a filter here) at collection time.

partially address #18783

  • By checking this box, the PR author has requested that maintainers do NOT use the "Squash and Merge" button. Maintainers should respect this when possible; however, the final decision is at the discretion of the maintainer that merges the PR.

@neutrinoceros neutrinoceros added this to the v7.2.0 milestone Oct 25, 2025
@github-actions
Copy link
Copy Markdown
Contributor

Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.

  • Do the proposed changes actually accomplish desired goals?
  • Do the proposed changes follow the Astropy coding guidelines?
  • Are tests added/updated as required? If so, do they follow the Astropy testing guidelines?
  • Are docs added/updated as required? If so, do they follow the Astropy documentation guidelines?
  • Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see instructions for rebase and squash.
  • Did the CI pass? If no, are the failures related? If you need to run daily and weekly cron jobs as part of the PR, please apply the "Extra CI" label. Codestyle issues can be fixed by the bot.
  • Is a change log needed? If yes, did the change log check pass? If no, add the "no-changelog-entry-needed" label. If this is a manual backport, use the "skip-changelog-checks" label unless special changelog handling is necessary.
  • Is this a big PR that makes a "What's new?" entry worthwhile and if so, is (1) a "what's new" entry included in this PR and (2) the "whatsnew-needed" label applied?
  • At the time of adding the milestone, if the milestone set requires a backport to release branch(es), apply the appropriate "backport-X.Y.x" label(s) before merge.

@github-actions
Copy link
Copy Markdown
Contributor

👋 Thank you for your draft pull request! Do you know that you can use [ci skip] or [skip ci] in your commit messages to skip running continuous integration tests until you are ready?

@neutrinoceros neutrinoceros force-pushed the tst/dep/set-direct-requirement-on-hypothesis branch from b97a493 to 15ff4e7 Compare October 25, 2025 15:02
@neutrinoceros neutrinoceros changed the title TST/DEP: set a direct requirement on hypothesis with an accurate lower bound TST/DEP: set direct requirements on test dependencies with accurate lower bounds Oct 25, 2025
@neutrinoceros
Copy link
Copy Markdown
Contributor Author

actually I already figured out some other safe minimal requirements from pytest-astropy in my inquiries so might as well include them too

@neutrinoceros neutrinoceros force-pushed the tst/dep/set-direct-requirement-on-hypothesis branch 2 times, most recently from 3b79e71 to 3c84aa0 Compare October 25, 2025 17:17
@neutrinoceros
Copy link
Copy Markdown
Contributor Author

This should be stable now. I still want to revisit and see if we actually use everything that got pulled from pytest-astropy. Otherwise I'll use constraints rather than requirements.

# The base set of test-time dependencies.
test = [
"coverage>=6.4.4",
"hypothesis>=6.84.0",
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 not just put 6.142.4 here? No point forcing an older version and then have to ignore a bunch of warning.

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.

The problem is that we still get warnings with much more recent versions of hypothesis in the conditions I'm trying to resolve for (--resolution=lowest), so I must conclude that they are a side effect of some other, transitive dependencies that I haven't been able to identify just yet.

'ignore:_SixMetaPathImporter\.find_spec\(\) not found; falling back to find_module\(\):ImportWarning', # from hypothesis
'ignore:_SixMetaPathImporter\.exec_module\(\) not found; falling back to load_module\(\):ImportWarning', # from prompt-toolkit
"ignore:distutils Version classes are deprecated. Use packaging.version instead.:DeprecationWarning",
"ignore: module 'sre_constants' is deprecated:DeprecationWarning", # from matplotlib 3.6.0 via pyparsing 3.0.0
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.

Hmm. Why not pin older matplotlib to older pyparsing?

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.

we already set a lower bound for matplotlib (3.6.0), which itself has a lower bound for pyparsing, but it points to a version that didn't have wheels for Python 3.11.
We could in principle set our own lower bound on pyparsing via a constraint (not a requirement), but then we'd need to keep it in sync with whatever our current lowest supported versions for Python and matplotlib are. My current solution (exclude building pyparsing from source + ignore deprecation selected warnings) should be at least somewhat easier to maintain, as we don't need to rediscover an oldest working version manually each time we upgrade Python or mpl, but any new warning needing filters will be glaring. The cost is that we might accumulate a couple outdated, unused warning filters with time, but that seems benign to me (and we can always clean them up on our own schedule).

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.

I thought the whole point of this exercise is to have compatible lower bounds of deps, no?

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.

Indeed. But we don't have exact control over the majority of our dependencies that are only transitive, nor should we attempt to. We can however instruct the resolver to avoid wasteful builds. Does this make sense ?

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.

I am not super happy we have to start ignoring random warnings again just because of the new way we do oldest deps, but I would like to hear from other devs as well. Thanks for tackling this! Dependencies are hard to navigate in Python.

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.

(FWIW I just ran resolution=lowest tests with matplotlib>=3.6 as a constraint on top of everything included here except the warning filters and I didn't observe any improvement)

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.

    "ignore: module 'sre_constants' is deprecated:DeprecationWarning", # from matplotlib 3.6.0 via pyparsing 3.0.0

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.

Oh yes, well, I'm mostly concerned about collection-time warnings now, as they are completely blocking. Maybe we could move forward with this one first and then drop support for mpl 3.6 in a follow up PR ?

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 I have a better idea still: the reason for treating warnings as errors is that we want to know when something about our env changes or is about to change. This reason goes away if we get reproducible envs, which is the end goal here. So how about we merge this with the filters, but I also open a subissue for #18783 as reminder that

  • we can let warnings be warnings in oldestdeps
  • we can remove all filters introduced in this PR once we're there

how does this sound ?

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 opened and linked #18853

hope that satisfies everyone

@neutrinoceros neutrinoceros force-pushed the tst/dep/set-direct-requirement-on-hypothesis branch from a1c12c5 to a211b58 Compare November 10, 2025 17:12
@neutrinoceros
Copy link
Copy Markdown
Contributor Author

rebased to resolve a merge conflict.
FWIW, I believe this is the last piece I need before I can resolve #18783

@neutrinoceros neutrinoceros force-pushed the tst/dep/set-direct-requirement-on-hypothesis branch from a211b58 to 081027a Compare November 10, 2025 17:40
@neutrinoceros
Copy link
Copy Markdown
Contributor Author

superseded by #18896 and #18897

@neutrinoceros neutrinoceros deleted the tst/dep/set-direct-requirement-on-hypothesis branch November 12, 2025 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants