Skip to content

Conversation

@antonio-rojas
Copy link
Contributor

@antonio-rojas antonio-rojas commented Aug 25, 2025

Currently the meson build doesn't install the pyx source files, as opposed to the setuptools build. This has caused/is causing several issues:

The only reason why these issues are not present in sage-the-distro is that cython wrongly embeds the absolute paths of source files, which masks the issues as long as the source is present in its original location. But as soon as cython/cython#6755 is released this will affect all types of sage build.

In any case, I believe being able to inspect the methods implementation from the sage interface itself is a valuable feature for mathematicians, which are its main user base.

I have only done one dir so far so I don't waste my time in case this is rejected or a different implementation is proposed. I will do the rest when I get the OK.

Fixes #39874

@github-actions
Copy link

github-actions bot commented Aug 25, 2025

Documentation preview for this PR (built with commit 79bca41; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@tobiasdiez
Copy link
Contributor

Sure, why not? The only 'disadvantage' I can see is that the sdist is a little bit bigger. Are there any other side effects?

There is a bug in the update-meson script that it only can handle one install_sources call. Either this would need to be fixed, or you change the update-meson script to all also include the pyx files in the install_sources call at the top of the meson file. I don't have an opinion on the best way to install them, but probably changing update-meson and then run it once is the least amount of work.

@antonio-rojas
Copy link
Contributor Author

Ah, right. I was trying to avoid keeping duplicate pyx file lists that may get out of sync, but since this is scripted I guess there is no risk of that.

@antonio-rojas antonio-rojas changed the title [DRAFT] Install pyx sources with meson Install pyx sources with meson Aug 26, 2025
@antonio-rojas
Copy link
Contributor Author

Sure, why not? The only 'disadvantage' I can see is that the sdist is a little bit bigger. Are there any other side effects?

I can't think of any. If something comes up we could make it a meson option, but that would require adding a feature for the presence of source files so we could disable the relevant tests accordingly. As of now I don't think it's worth the effort.

Copy link
Contributor

@tobiasdiez tobiasdiez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

vbraun pushed a commit to vbraun/sage that referenced this pull request Sep 16, 2025
sagemathgh-40686: Install pyx sources with meson
    
Currently the meson build doesn't install the pyx source files, as
opposed to the setuptools build. This has caused/is causing several
issues:
- The method `sage_getsource` as well as ipython's own source viewer
`??` don't work for cython methods. This creates an inconsistency with
python methods, and breaks several tests when the sage source is not
available (eg. distro packages).
- It breaks the doc builder
sagemath#39973 (comment)
- It used to cause issues when accessing some methods
(sagemath#39735), now worked around.

The only reason why these issues are not present in sage-the-distro is
that cython wrongly embeds the absolute paths of source files, which
masks the issues as long as the source is present in its original
location. But as soon as cython/cython#6755 is
released this will affect all types of sage build.

In any case, I believe being able to inspect the methods implementation
from the sage interface itself is a valuable feature for mathematicians,
which are its main user base.

I have only done one dir so far so I don't waste my time in case this is
rejected or a different implementation is proposed. I will do the rest
when I get the OK.

Fixes sagemath#39874
    
URL: sagemath#40686
Reported by: Antonio Rojas
Reviewer(s): Tobias Diez
@vbraun vbraun merged commit 7562e51 into sagemath:develop Sep 21, 2025
25 of 29 checks passed
@antonio-rojas antonio-rojas deleted the install-pyx branch September 21, 2025 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Meson build: sage_getsource.sageinspect doesn't work due to missing sources

3 participants