Replies: 3 comments 3 replies
-
As I see it the pro/cons lists are kind of unbalanced in the sense that in option 1 the "Pros" are mostly for users, while the "Cons" are mostly for developers/packagers (and conversely for option 2). IMHO we should aim to make the experience as smooth as possible for users, even at the cost of slightly increasing the necessary work for developers/packagers. On a more specific level, option 2 would be quite a step back from my point of view as an Arch packager. That would mean I would have to choose between packaging every single optional dependency of Sage (even the more niche or obscure ones, and the list is increasing with each release: for 10.8 there are at least two new ones, khoca and regina) or make these optional features completely unaccesible to our users. Currently these features provided by non-packaged optional dependencies can easily be enabled by users by installing eg. user created packages from the AUR, or simply by downloading the files locally in the case of database files. I have no objections to options 1 or 3. |
Beta Was this translation helpful? Give feedback.
-
I don't see how "Con" in option 2 is actually correct - building/installing an extra library and a Cython interface to it does not entail re-building everything, quite the opposite. I also don't see why you say "everything". Surely something like an external binary can be dealt with by the existing mechanics, whereas an extra Cython module, something which needs building anyway, can be a build-time detected feature. |
Beta Was this translation helpful? Give feedback.
-
Thank you for opening this discussion! I think it's a good idea to distinguish each of the 4 different kinds of dependencies. There is not much harm in runtime-detection of external Python/Cython modules of the form: try:
import external_lib
catch ImportError:
disable feature Also you can easily (un)install The internal Cython modules (point 4) are in disguise external libs that sage links again - so this has to be already controlled by the build system. Leaves the external programs and databases. I would tend to make those build-time detection-only, with the option to override the location with specialized env variables (eg |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Sage supports many optional features by detecting their presence at run-time. This is used to show better errors to end users, and to skip
# needs <package>
doctests when<package>
is not installed. For the sake of the discussion, there are roughly four categories of feature:The benefit of run-time detection is that you don't have to reinstall (or at least, reconfigure) sage to enable new features. There are however many corresponding downsides. And now that the sage library has its own build system (independent of the sage distribution), we are free to consider alternatives.
Since we will eventually discuss other options, we christen the status quo...
Option 1: leave it alone
Pro:
Con:
spkg-configure.ac
) for packages that are standard in the distribution, but optional to the library.Option 2: detect/configure everything at build-time
The opposite of the status quo would be to detect everything at build time, with the user being able to specify explicitly whether or not he expects a particular feature to be enabled. The pros/cons lists are more or less inverted.
Pro
Con
meson
ormake
. On a source-based distro, you would have to reinstall sage completely. Binary distros would need to find some other way to support optional features.Option 3: build-time checks that can be deferred to run-time
This is a compromise between the first two. Basically, we would allow all features to be controlled at build-time, and the default would be to detect them at build-time automatically (if they're present, enable them; otherwise, disable them). However we would provide an override for people who want runtime detection, something like
-Ddefer-feature-checks=true
. This could be used by binary distros, and by default in the sage distribution to retain backwards compatibility.Pro
All of the above.
Con
None of the above, except:
sage.features
. To give one example of this, sage needs ffmpeg to support several file extensions: .avi, .flv, .gif, .mkv, .mov, .mp4, .ogg, .ogv, .webm, .wmv. The test for this is complicated, and we would have to repeat it. A build-time check is necessary to support-Dffmpeg=enabled
, and the run-time check is necessary to support-Ddefer-feature-checks=true
. This can lead to a lot of code duplication.Implementation details
The implementation of any of these would be straightforward. When a feature
foo
is enabled or disabled at build-time, we would writefoo_enabled = <value>
into a config file. We would then modifysage.features.foo
to return the configured value, rather than try to detect the presence of foo itself. With deferred checks, we would just keep doing what we are doing now (i.e. ignorefoo_enabled
ifdefer_feature_checks
isTrue
).The existing features would have to be ported to meson one at a time (and there is no hurry to do this). The internal libraries in
meson.options
would be a good starting point.Beta Was this translation helpful? Give feedback.
All reactions