Skip to content
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

sage.misc.misc, sage.combinat: Modularization fixes #35564

Merged
merged 13 commits into from
Jun 21, 2023

Conversation

mkoeppe
Copy link
Contributor

@mkoeppe mkoeppe commented Apr 25, 2023

📚 Description

Part of:

📝 Checklist

  • The title is concise, informative, and self-explanatory.
  • 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 accordingly.

⌛ Dependencies

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Apr 27, 2023

Green. Ready for review

@mkoeppe mkoeppe force-pushed the sage_combinat_modularization branch from 8f24e58 to 9fe1cd6 Compare May 17, 2023 19:11
@mkoeppe
Copy link
Contributor Author

mkoeppe commented May 28, 2023

merged #35672 to resolve merge conflict

@mkoeppe mkoeppe requested a review from dcoudert June 7, 2023 15:35
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.

This is really a patch bomb. I don't understand why you mixed modularization and movements of functions from one file to another with deprecation warnings. All these changes are required, but it's too much for a single patch.
I did my best checking all changes. I noted a few issues that could be fixed.

@@ -1327,7 +1327,10 @@ def _test_coxeter_relations(self, **options):
one = self.one()
for si in s:
tester.assertEqual(si**2, one)
cox_mat = self.coxeter_matrix()
try:
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand this change. It hides import errors

Copy link
Contributor Author

@mkoeppe mkoeppe Jun 7, 2023

Choose a reason for hiding this comment

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

These _test_... methods are invoked whenever TestSuite is run on a parent in this category. As of #35095 , most of the root system functionality is shipped as part of sagemath-modules ("because root systems are just sets of vectors"). But parts of the functionality goes through Dynkin diagrams, which are Graphs and therefore depend (at runtime) on parts of sagemath-graphs. The idea is that in the modularized test of sagemath-modules, we can still run the TestSuite and just skip the tests that can't be tested, rather than blaming the implementation class for sagemath-graphs not being installed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the explanation.

- ``return_paths`` -- (default: False) if True, a shortest path of mutations from ``self`` to the given quiver is returned as well.
- ``up_to_equivalence`` -- (default: True) if True, only one seed up to simultaneous permutation of rows and columns of the exchange matrix is recorded.
- ``sink_source`` -- (default: False) if True, only mutations at sinks and sources are applied.
- ``show_depth`` -- (default: ``False``) if ``True``, the current depth of the mutation is shown while computing.
Copy link
Contributor

Choose a reason for hiding this comment

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

could be formatted in 80 columns mode

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 have made the suggested changes (and more) in #35742 (65e2568)

src/sage/combinat/cluster_algebra_quiver/cluster_seed.py Outdated Show resolved Hide resolved
src/sage/combinat/cluster_algebra_quiver/cluster_seed.py Outdated Show resolved Hide resolved
src/sage/combinat/cluster_algebra_quiver/cluster_seed.py Outdated Show resolved Hide resolved
src/sage/combinat/cluster_algebra_quiver/cluster_seed.py Outdated Show resolved Hide resolved
{2: 2-regular sequence 8, 8, 8, 12, 12, 16, 12, 16, 12, 24, ...,
3: 2-regular sequence -10, -8, -8, -8, -8, -8, -8, -8, -8, -12, ...,
6: 2-regular sequence 20, 22, 24, 28, 28, 32, 28, 32, 32, 48, ...}
sage: shifted_inhomog[2].mu[0].ncols() == 3*inhomogeneities[2].mu[0].ncols()
sage: shifted_inhomog[2].mu[0].ncols() == 3*inhomogeneities[2].mu[0].ncols() # optional - sage.symbolic
Copy link
Contributor

Choose a reason for hiding this comment

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

Starting from this line, the alignment of # optional... is different than previous lines

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in #35742 (acf16ad)

@@ -0,0 +1,148 @@
r"""
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't you add # cython: binding=True ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

answered in #35741 (comment)

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 7, 2023

This is really a patch bomb

Sorry about this, and thanks for taking a look anyway! I'll break it into separate PRs.

@mkoeppe mkoeppe force-pushed the sage_combinat_modularization branch from 87a04b8 to fa0c443 Compare June 7, 2023 19:39
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 7, 2023

@github-actions
Copy link

github-actions bot commented Jun 7, 2023

Documentation preview for this PR (built with commit fa0c443) is ready! 🎉

@mkoeppe mkoeppe requested a review from dcoudert June 9, 2023 20:40
@mkoeppe mkoeppe changed the title sage.combinat: Modularization fixes sage.misc.misc, sage.combinat: Modularization fixes Jun 9, 2023
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.

@@ -1327,7 +1327,10 @@ def _test_coxeter_relations(self, **options):
one = self.one()
for si in s:
tester.assertEqual(si**2, one)
cox_mat = self.coxeter_matrix()
try:
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the explanation.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 10, 2023

Thank you! May I set to "positive review"?

@dcoudert
Copy link
Contributor

Thank you! May I set to "positive review"?

done.

@vbraun vbraun merged commit 3aa3644 into sagemath:develop Jun 21, 2023
vbraun pushed a commit that referenced this pull request Jun 21, 2023
…fixes)

    
<!-- Please provide a concise, informative and self-explanatory title.
-->
<!-- Don't put issue numbers in the title. Put it in the Description
below. -->
<!-- For example, instead of "Fixes #12345", use "Add a new method to
multiply two integers" -->

### 📚 Description

<!-- Describe your changes here in detail. -->
<!-- Why is this change required? What problem does it solve? -->
Some basic modules of `sage.combinat` (`.permutation`, `.combination`,
etc.) are needed in the distribution **sagemath-categories** (as of
#35095). We make them importable (by splitting a Cython module into
several parts and by using lazy imports) and separately testable (using
`# optional` doctest directives).

Likewise, split the parts of `sage.combinat.posets.hasse_cython` that
need the FLINT library out as a separate module (this is for the package
**sagemath-graphs** in #35095)

<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes #12345". -->
- Split out from #35564
- Part of #29705
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. It should be `[x]` not `[x
]`. -->

- [x] The title is concise, informative, and self-explanatory.
- [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.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- #12345: short description why this is a dependency
- #34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: #35741
Reported by: Matthias Köppe
Reviewer(s): David Coudert
@mkoeppe mkoeppe added this to the sage-10.1 milestone Jun 21, 2023
@mkoeppe mkoeppe deleted the sage_combinat_modularization branch June 21, 2023 22:44
vbraun pushed a commit that referenced this pull request Jul 1, 2023
    
<!-- Please provide a concise, informative and self-explanatory title.
-->
<!-- Don't put issue numbers in the title. Put it in the Description
below. -->
<!-- For example, instead of "Fixes #12345", use "Add a new method to
multiply two integers" -->

### 📚 Description

<!-- Describe your changes here in detail. -->
Adding `# optional` doctest directives (for separate testability of
modularized distributions),
and incidental docstring/doctest cosmetics.
<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes #12345". -->
- Split out from #35564
- Part of #29705
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. It should be `[x]` not `[x
]`. -->

- [x] The title is concise, informative, and self-explanatory.
- [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.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- #12345: short description why this is a dependency
- #34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: #35742
Reported by: Matthias Köppe
Reviewer(s): David Coudert, Matthias Köppe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants