Skip to content

Specify use_sources=True in cython compilation #39275

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

Merged
merged 6 commits into from
Feb 10, 2025

Conversation

user202729
Copy link
Contributor

@user202729 user202729 commented Jan 4, 2025

In my testing, this allows cython compilation of code with from sage.[...] cimport [...] to work when built with meson. Ability to compile cython code when use legacy build system is unaffected.

Actually without this change cython compilation works fine on conda & meson CI anyway (probably because of some coincidence, I didn't inspect)

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

Copy link

github-actions bot commented Jan 4, 2025

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

@dimpase
Copy link
Member

dimpase commented Jan 22, 2025

has this fixed any failing tests?

@user202729
Copy link
Contributor Author

for some reason (probably some path coincidence or whatever) it works fine on CI either way. Maybe I should figure out some way to test it on CI.

@dimpase
Copy link
Member

dimpase commented Jan 22, 2025

Please post an explicit example of what fails for you, and the specifics of your Cython setup.

@user202729
Copy link
Contributor Author

user202729 commented Jan 23, 2025

Okay here it is: if --editable install is used with meson then it fails.

e.g.

https://github.com/sagemath/sage/actions/runs/12913561812/job/36011095007#step:10:14938

2025-01-22T17:30:30.3441153Z **********************************************************************
2025-01-22T17:30:30.3441906Z File "src/sage/arith/long.pxd", line 119, in sage.arith.long.pxd.integer_check_long
2025-01-22T17:30:30.3486008Z Failed example:
2025-01-22T17:30:30.3486410Z     cython('''
2025-01-22T17:30:30.3486776Z     from sage.arith.long cimport *
2025-01-22T17:30:30.3487271Z     from sage.rings.integer cimport smallInteger

[...]

2025-01-22T17:30:30.3550836Z     RuntimeError: Error compiling Cython file:
2025-01-22T17:30:30.3551358Z     ------------------------------------------------------------
2025-01-22T17:30:30.3551848Z     ...
2025-01-22T17:30:30.3552031Z 
2025-01-22T17:30:30.3552192Z     from sage.arith.long cimport *
2025-01-22T17:30:30.3552601Z     ^
2025-01-22T17:30:30.3552970Z     ------------------------------------------------------------
2025-01-22T17:30:30.3553339Z 
2025-01-22T17:30:30.3553979Z     _tmp_sage_3enyaq4d_tmp_1nsgnqax_pyx_0.pyx:2:0: 'sage/arith/long.pxd' not found

Side note, do you think it's desirable to test all combinations (Python 3.11, 12 × editable: true, false) each pull request? Or we could cut down to only test e.g. {Python 3.11 non-editable, Python 3.12 editable} on pull request and test the full matrix in pushes to branch.

@user202729
Copy link
Contributor Author

user202729 commented Jan 23, 2025

There's a bunch of additional things that fail with --editable apparently.

Maybe we can just merge the first commit in and enable --editable on CI later? (or should they be put as known CI failure to be fixed gradually?)

@user202729 user202729 mentioned this pull request Jan 25, 2025
5 tasks
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.

Okay, why not if it's works better.

vbraun pushed a commit to vbraun/sage that referenced this pull request Feb 9, 2025
sagemathgh-39275: Specify use_sources=True in cython compilation
    
In my testing, this allows cython compilation of code with `from
sage.[...] cimport [...]` to work when built with meson. Ability to
compile cython code when use legacy build system is unaffected.

Actually without this change cython compilation works fine on conda &
meson CI anyway (probably because of some coincidence, I didn't inspect)

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [x] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#39275
Reported by: user202729
Reviewer(s): Tobias Diez
vbraun pushed a commit to vbraun/sage that referenced this pull request Feb 9, 2025
sagemathgh-39275: Specify use_sources=True in cython compilation
    
In my testing, this allows cython compilation of code with `from
sage.[...] cimport [...]` to work when built with meson. Ability to
compile cython code when use legacy build system is unaffected.

Actually without this change cython compilation works fine on conda &
meson CI anyway (probably because of some coincidence, I didn't inspect)

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [x] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#39275
Reported by: user202729
Reviewer(s): Tobias Diez
@vbraun vbraun merged commit 32f121b into sagemath:develop Feb 10, 2025
22 of 23 checks passed
vbraun pushed a commit to vbraun/sage that referenced this pull request Mar 9, 2025
sagemathgh-39369: Test pip editable install with meson
    
Tests pip editable install with meson on GitHub Actions.

This uncovers several failing tests, which are fixed by (see
dependencies below)

Note: review is hard because of the large number of dependencies. It is
probably easier to look only in `.github` folder.


### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.

### ⌛ Dependencies


- sagemath#39423
- sagemath#39498
- sagemath#39494
- sagemath#39424
- sagemath#39275
- sagemath#39499
    
URL: sagemath#39369
Reported by: user202729
Reviewer(s): Tobias Diez, user202729
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.

4 participants