-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace imports from sage.all #123
Conversation
Thanks for looking into this. How stable are these import paths? How many versions of sage do they go back? The CI is configured to run SnapPy against various docker containers with different SageMath versions. It reports that 4 out of 11 suites failed. Unfortunately, github doesn't let me see which :( In the past, we had large try: ... except ImportError: ... blocks to account for different sage versions. |
AFAICS these imports are all unchanged in Sage over at least the past 5 years
Are you saying that the current branch was already tested? By the way, my motivation here is to get SnapPy to run on top of my modularized fork of Sage https://github.com/passagemath/passagemath |
Our CI tests SnapPy on the official Sage Docker images, from 9.3 (circa 2021) up to 10.4. We do not test against the development branch of Sage. I enabled the CI for this PR and tweaked the CI config. The PR fails when running the doctests for Sage 9.* and passes for Sage 10.*. The common error is:
|
Thanks @NathanDunfield. Would changes like just pushed in ada49ea be acceptable? |
Overall, it looks good to me. For the frequently imported things, it might be better to do the import in |
Here's a more complete version (still has a failure in doctesting |
1f24d84
to
92ab31b
Compare
…r imports from Sage
… instead of using try..except for imports
@NathanDunfield @unhyperbolic This passes tests now |
python/snap/find_field.py
Outdated
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.
Now that you've added a bunch of Sage imports to sage_helper.py
, I think it makes sense to import those objects through it here and in analogous places throughout. E.g.
from ..sage_helper import ZZ, QQ, matrix
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.
Done, I think. Preview: https://github.com/mkoeppe/SnapPy/actions/runs/12575148681
Happy new year!
…nal_linear_algebra*.py
c7bf7a5
to
d10df05
Compare
d10df05
to
2ded24e
Compare
be964e4
to
3bb486e
Compare
@mkoeppe Looks good to me so far. @unhyperbolic and @culler any comments? |
from sage.all import sqrt | ||
from sage.all import I, Infinity | ||
from sage.all import arccosh | ||
from sage.all import RIF, CIF |
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.
Do we actually need this?
Note: I do use the name RIF and CIF for RealIntervalField and ComplexIntervalField instances with precisions different from RealIntervalField() and ComplexIntervalField().
@@ -17,8 +17,8 @@ | |||
from ...sage_helper import _within_sage | |||
|
|||
if _within_sage: | |||
import sage.all | |||
from sage.all import matrix | |||
from ...sage_helper import I, matrix, RIF, CIF |
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.
This RIF and CIF import should go into run_tests again.
import sage.all | ||
from sage.all import matrix, sqrt | ||
from sage.rings.real_mpfi import is_RealIntervalFieldElement | ||
import sage |
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.
Is this "import sage" needed?
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 think it can be removed.
Thanks for merging! I'll follow up with some more proposed changes |
Preparation for using modularized distributions of the Sage library.
Done in part using
sage -fiximports
.