-
-
Notifications
You must be signed in to change notification settings - Fork 453
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
Add HAVE_GMPY2 compile-time constant #24215
Comments
comment:1
I find this too complicated. Having Sage compilation depending on optional packages is awful. For example, if I want to compile Sage with gmpy2 support I would have to do:
Not mentioning how impredictable this could be in doctesting. |
comment:2
Replying to @videlec:
We already do that for several packages (e.g. |
comment:3
Replying to @videlec:
Two steps are sufficient:
Again, this is not different from existing optional packages. |
comment:4
Replying to @videlec:
Use |
comment:5
Replying to @jdemeyer:
|
comment:6
Replying to @jdemeyer:
Not exactly. These two examples are handled as optional extensions. It is easy to figure out what is actually changed by their installation. With compilation constant, the distinction is less clear. |
comment:7
Just as a reminder trac #23024 require pplpy and therefore gmpy2 to be standard package. I am aware that it's not directly linked to the subject but that means we are probably going to make gmpy2 optional then standard again. |
comment:8
Indeed! |
Branch: u/jdemeyer/ticket/24215 |
Commit: |
comment:12
Replying to @vinklein:
Fine for me. To be clear: I'm not opposing to make |
comment:14
Your
(see also #20382 comment 40). It would better be specified in the doc. Moreover, the function is not testing that a module is installed but testing whether you can load a given module (that might well correspond to a file in the current directory). According to the specification, this is one false positive (a module not installed) and a wrong negative (a module installed but that can not be loaded). |
comment:16
Replying to @jdemeyer:
If anything Sage needs more of this sort of thing, with more packages made "optional" IMO :) |
comment:17
I don't understand why this calls |
comment:18
Replying to @embray:
To avoid local imports. See comment:14. |
comment:19
Replying to @embray:
On the other hand, |
comment:20
Replying to @jdemeyer:
See https://docs.python.org/3.6/library/importlib.html#importlib.import_module |
comment:21
Replying to @embray:
And how does it handle relative imports in Python 2? That's not documented, but it is documented for |
comment:22
Replying to @videlec:
If I understand your point correctly, using
This is because (traditionally) inserting the module into
|
comment:23
Replying to @embray:
...are not relevant since Sage still uses Python 2. What are you pushing so much for |
comment:24
Replying to @jdemeyer:
For now...
I'm so sorry that the documentation in Python 2 surrounding this is not to your liking. A lot of the import-related modules that wasn't previously well documented is better documented now in the Python 3 docs simply because that's where the documentation improvements were made, and many of them were not backported I guess (maybe in part because there were so many other changes to the import system). The whole point of In other words, its purpose is to do exactly what you want to do without dealing with the more complicated (and sometimes shifting) sematics of |
comment:25
This is kind of like asking "why are you using |
comment:26
Replying to @embray:
You're sounding sarcastic (intentional or not, I have no idea). But the point is that documentation is important. The If you want to use |
comment:27
Replying to @jdemeyer:
Yes and no. I sincerely am sorry, because I understand where you're coming from and I don't think this actually matters much, but I also feel like you're stubbornly sticking to a more complicated way to do a thing because the version of the documentation you looked at wasn't as current-as if documentation is always perfect. In this case your choice isn't wrong--it's just needlessly using a lower-level interface for something that can be doing with a simpler higher level interface.
No, actually, you don't; not any more than you need to read the source code of I'll explain--I think the misunderstanding here is that By all means, leave it as is--as you said it works. I was just trying to help by pointing out a simpler way... |
Reviewer: Erik Bray |
Changed branch from u/jdemeyer/ticket/24215 to |
In order to optionally include code depending on gmpy2, we introduce a compile-time Cython constant
HAVE_GMPY2
.CC: @vinklein
Component: cython
Author: Jeroen Demeyer
Branch/Commit:
7f06e71
Reviewer: Erik Bray
Issue created by migration from https://trac.sagemath.org/ticket/24215
The text was updated successfully, but these errors were encountered: