Conversation
|
Documentation preview for this PR (built with commit bead86a; changes) is ready! 🎉 |
2b669f7 to
d045aee
Compare
d045aee to
5b776af
Compare
cc97f87 to
fba22ba
Compare
|
The distro CI is hosed, but I think this works now and there are no major problems with the docs. Please play around and let me know your thoughts. The implementation was straightforward so far, but I haven't tried to convert any other runtime features yet, only the ones with existing meson options/checks. |
|
I would expect |
|
This doesn't look right: |
No problem, I didn't realize anyone was doing this yet. How is it implemented, are you packaging the optional python modules (like sage.libs.sirocco) separately? If so I'll put back the python module check as
Ugh, no, I'll take a look. I have a feeling that this was caused by changing |
For now I'm shipping everything together (and the features are enabled by installing the corresponding libraries), but I may move to split packages soon as our tooling is moving towards automatic detection of link libraries at packaging time. Since sage Features check for the modules loadability (as opposed to their presence), this works fine either way (currently). |
|
Ok, runtime detection probably works. Tested with the ones I happen to have installed (bliss, brial, eclib, rankwidth). |
|
(And the Mrwank bug is fixed.) |
|
Thanks. Besides the coxeter issue, everything works fine here with |
|
On 2026-01-31 11:31:11, Antonio Rojas wrote:
antonio-rojas left a comment (sagemath/sage#41550)
Thanks. Besides the coxeter issue, everything works fine here with `defer_feature_checks=true` (as in, same as before)
Coxeter should be fixed now too, thanks a lot for testing.
|
The meson build system is now capable of building sagelib without linking to libec, which means that the mwrank program may not be installed. Here we add a new feature to represent it. In particular this allows us to use "needs mwrank" in tests.
The meson build system is now capable of building sagelib without sage.libs.eclib. Here we add a new feature to represent it. In particular this allows us to use "needs sage.libs.eclib" in tests.
When a feature is not runtime-detectable, don't include it in the list of features to be detected. This keeps the list, $ sage -t src ... Features to be detected: 32_bit,4ti2,benzene,buckygen, ... ... Features detected for doctesting: database_ellcurves, ... free of misleading information and clutter.
If the feature for sage.libs.foo is enabled, we shouldn't skip over files that fail to collect with an ImportError for sage.libs.foo.
When sage.libs.eclib doesn't exist, pytest will still try to collect *.py files that import it, leading to an ImportError. We add eclib to the list of feature-backed modules with workarounds for this issue.
For backwards compatibility, defer all possible build-time feature checks to run-time. (For now this only affects the detection of the mwrank program.)
A trick is needed to dynamically add a method to an object.
Call Executable._is_present() instead of Executable.is_present() to avoid infinite recursion. Somehow this worked before I replaced the relative import of Executable with an absolute one.
The result of _is_present() is cached and we want to check for a module with a different name than that of the feature, so we create a new PythonModule on the fly for this.
The result of _is_present() is cached and we want to check for a module with a different name than that of the feature, so we create a new PythonModule on the fly for this.
The result of _is_present() is cached and we want to check for a module with a different name than that of the feature, so we create a new PythonModule on the fly for this.
The result of _is_present() is cached and we want to check for a module with a different name than that of the feature, so we create a new PythonModule on the fly for this.
The result of _is_present() is cached and we want to check for a module with a different name than that of the feature, so we create a new PythonModule on the fly for this.
The result of _is_present() is cached and we want to check for a module with a different name than that of the feature, so we create a new PythonModule on the fly for this.
The result of _is_present() is cached and we want to check for a module with a different name than that of the feature, so we create a new PythonModule on the fly for this.
The result of _is_present() is cached and we want to check for a module with a different name than that of the feature, so we create a new PythonModule on the fly for this.
The module name that we check for in this case is the same as the feature name, so we can subclass the feature from PythonModule and use PythonModule's _is_present() in is_present_at_runtime().
To detect coxeter3 at runtime, we should check for a module that won't be present when coxeter3 support is disabled. This feature now checks for a conditionally-compiled cython module beneath sage.libs.coxeter3, rather than for sage.libs.coxeter3 itself.
Add the "needs rankwidth" tags for the doctests in this module, all of which need rankwidth. At first a one-line magic sage.doctest header appears to make more sense, but pytest does not understand these and needs workarounds (see conftest.py). Given the small number of tests in this module, individual annotations seem like less of a hassle.
a947492 to
bead86a
Compare
Implement Option 3 from #41067.
defer_feature_checksthat defaults to false in meson, and true in the sage distro (for backwards compatibility). Record its value insage/config.py.meson.options, define variables insage/config.pystating whether or not they were enabled in the build.sage.features.build_feature.BuildFeatureclass to handle the processing.BuildFeaturein the sage features for things inmeson.options.sage -t.All permutations of the options should work, but for an example using the meson build,
meson setup -Dauto_features=disabled ...will disable everything at build-time, and not check for it again at run-time. You should be able to see the valuesfoo_enabled = 0insage/config.py. The feature objects (BuildFeaturesubclasses) will consult these variables to determine if the feature is enabled.An example of a feature that can be detected at runtime is the mwrank executable. In the current scenario, its
BuildFeaturecheckssage.config.eclib_enabled, so even if eclib is installed, the mwank executable will not be used. However, if you rebuild withmeson setup -Ddefer_feature_checks=true ..., then mwrank will be detected at run-time.The other features can also be detected at run-time, but they are linked to various python modules at build time. To test the runtime detection, one option is to uninstall the library that the feature uses (say, sirocco). This will cause the import test of sage.libs.sirocco to fail at runtime, leading to the feature being disabled. Reinstall sirocco and the feature should re-enable itself.
Relevant docs: