Skip to content

Conversation

tobiasdiez
Copy link
Contributor

Mostly to try to reduce a few circular imports that happen when you don't import sage.all. A few of these changes are purely cosmetic.

📝 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

Mostly to try to reduce a few circular imports that happen when you don't import `sage.all`. A few of these changes are purely cosmetic.
Copy link

github-actions bot commented Jan 5, 2025

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

Copy link
Contributor

@user202729 user202729 left a comment

Choose a reason for hiding this comment

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

Maybe add some tests that the circular imports are fixed?

There's test_executable convenience function.

@@ -182,7 +181,7 @@ cdef Rational_sub_(Rational self, Rational other):

return x

cdef Parent the_rational_ring = sage.rings.rational_field.Q
cdef Parent the_rational_ring = Q
Copy link
Contributor

Choose a reason for hiding this comment

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

Not strictly related but maybe we can change to use QQ instead

Copy link
Contributor

Choose a reason for hiding this comment

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

and may be use from sage.rings.rational_field import Q as the_rational_ring ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've now used QQ here. I wasn't sure about the named import as @dcoudert suggests, as this is a cdef (and this is not really related to the aim of this PR).

Copy link
Contributor

@dcoudert dcoudert left a comment

Choose a reason for hiding this comment

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

LGTM.

@tobiasdiez
Copy link
Contributor Author

Thanks!

vbraun pushed a commit to vbraun/sage that referenced this pull request Jun 18, 2025
sagemathgh-39276: Various small improvements to imports
    
Mostly to try to reduce a few circular imports that happen when you
don't import `sage.all`. A few of these changes are purely cosmetic.

<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->



### 📝 Checklist

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

- [ ] 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

<!-- 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#39276
Reported by: Tobias Diez
Reviewer(s): David Coudert, Tobias Diez, user202729
vbraun pushed a commit to vbraun/sage that referenced this pull request Jun 21, 2025
sagemathgh-39276: Various small improvements to imports
    
Mostly to try to reduce a few circular imports that happen when you
don't import `sage.all`. A few of these changes are purely cosmetic.

<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->



### 📝 Checklist

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

- [ ] 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

<!-- 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#39276
Reported by: Tobias Diez
Reviewer(s): David Coudert, Tobias Diez, user202729
@vbraun vbraun merged commit 2f80984 into sagemath:develop Jun 25, 2025
25 checks passed
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