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

Update to new conway-polynomials python package #36765

Merged
merged 13 commits into from
Dec 14, 2023

Conversation

orlitzky
Copy link
Contributor

Fix #32747 by switching to the newly-minted conway-polynomials package on pypi.

IMO sage.databases.conway (which makes the dict immutable by wrapping it in a class) is of dubious value but I've left everything alone for now.

@@ -152,7 +144,7 @@ def __len__(self):

sage: c = ConwayPolynomials()
sage: len(c)
35352
35357
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh? What happened there?

Copy link
Member

Choose a reason for hiding this comment

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

I was asking myself the same question.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Inflation.

The old package came with preprocessed data that would have been harder to diff against the upstream list for changes. I think it was just a tiny bit out-of-date. Here's the diff:

103a104
> [2,110,[1,1,1,0,0,0,1,0,0,0,1,1,0,1,1,0,0,1,0,0,1,0,0,0,0,1,1,0,1,1,0,0,0,1,0,1,1,1,0,1,0,0,1,1,0,0,0,0,1,0,0,0,0,0,1,1,1,1,1,1,0,0,1,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]],
219a221
> [3,52,[2,0,1,1,1,2,0,1,2,0,0,0,1,0,2,0,2,2,2,1,2,0,2,1,0,0,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]],
222a225,226
> [3,56,[2,2,0,0,0,1,0,2,0,0,0,0,2,1,1,0,0,1,2,2,2,2,0,2,2,1,2,2,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]],
> [3,57,[1,1,2,2,2,2,1,0,1,1,0,2,1,0,2,2,2,1,0,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]],
229a234
> [3,72,[2,2,0,2,1,1,1,2,1,0,2,1,2,1,0,1,0,2,1,1,0,2,1,2,1,2,0,2,0,1,1,1,2,2,1,0,2,2,1,1,0,0,1,2,0,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]],

Copy link
Member

Choose a reason for hiding this comment

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

I see. Does upstream update the list "often"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No idea. There's no change history on the site, but the new package ships the upstream file unmodified so at least we can git diff it in the future.

Copy link
Member

Choose a reason for hiding this comment

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

Shipping upstream file unmodified sounds very good to me. I think it is ready.

Add back the "conway_polynomials: " prefix in the header to fix the
package's inclusion into the TOC.
@orlitzky orlitzky force-pushed the update-conway-polynomials branch from 7a1fada to 4b45b63 Compare November 24, 2023 22:00
@dimpase
Copy link
Member

dimpase commented Nov 25, 2023

isn't this duplicating data available from GAP ?

@mkoeppe
Copy link
Contributor

mkoeppe commented Nov 25, 2023

We discussed that in #32747.

@mkoeppe
Copy link
Contributor

mkoeppe commented Nov 25, 2023

sage -t --long --random-seed=286735480429121101562228604801325644303 sage/databases/all.py  # 1 doctest failed
sage -t --long --random-seed=286735480429121101562228604801325644303 sage/features/__init__.py  # 1 doctest failed

This fixes a failing doctest describing the database.
This fixes a failing doctest for the description of the Conway
polynomials database.
Copy link
Contributor

@mkoeppe mkoeppe left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for working on this!

@orlitzky
Copy link
Contributor Author

No problem, thanks for the help. I'll work on the others as time permits. We're in the single-digits now for missing Gentoo packages and zero is starting to look possible.

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.

Nice, thanks for working on this.

The conda tests are failing, e.g. because of

File "src/sage/combinat/designs/database.py", line 820, in sage.combinat.designs.database.OA_9_135
Failed example:
    OA = OA_9_135()                                                           # needs sage.rings.finite_rings sage.schemes
Exception raised:
    Traceback (most recent call last):
      File "/home/runner/work/sage/sage/src/sage/doctest/forker.py", line 709, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/runner/work/sage/sage/src/sage/doctest/forker.py", line 1144, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.combinat.designs.database.OA_9_135[2]>", line 1, in <module>
        OA = OA_9_135()                                                           # needs sage.rings.finite_rings sage.schemes
      File "/home/runner/work/sage/sage/src/sage/combinat/designs/database.py", line 837, in OA_9_135
        G,B = singer_difference_set(16,2)
      File "/home/runner/work/sage/sage/src/sage/combinat/designs/difference_family.py", line 390, in singer_difference_set
        c = conway_polynomial(p,e*(d+1))
      File "/home/runner/work/sage/sage/src/sage/rings/finite_rings/conway_polynomials.py", line 63, in conway_polynomial
        return R(ConwayPolynomials()[p][n])
      File "/home/runner/work/sage/sage/src/sage/databases/conway.py", line 96, in __init__
        import conway_polynomials
    ModuleNotFoundError: No module named 'conway_polynomials'

So we need to also create a conda feedstock for it.

I think we can also remove the conway_polynomials feature (these failures show that it's presence or absence doesn't really imply anything).

spkg='conway_polynomials',
description="Frank Luebeck's database of Conway polynomials",
type='standard')
PythonModule.__init__(
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
PythonModule.__init__(
super().__init__(

(not that it is that important)

@mkoeppe
Copy link
Contributor

mkoeppe commented Nov 25, 2023

Right, conway-polynomials needs to be added to "install-requires" in src/setup.cfg.m4

Adding conda packaging is a downstream activity and not the burden of the PR author

conway_polynomials is a python package now and can be depended upon
via the python tooling.
The conway_polynomials package is now a standard python dependency of
sagelib and does not need to be detected at runtime.
The feature detection for Conway polynomials was removed; they're
always installed via a python package now.
@tobiasdiez
Copy link
Contributor

Adding conda packaging is a downstream activity and not the burden of the PR author

How is that a downstream activity if we are the ones offering the package?!
I've now opened conda-forge/staged-recipes#24585 for this, does anyone of you wants to be added as maintainer? Would be nice if a license file could be added as well (sagemath/conway-polynomials#1).

@mkoeppe
Copy link
Contributor

mkoeppe commented Nov 25, 2023

Adding conda packaging is a downstream activity and not the burden of the PR author

How is that a downstream activity if we are the ones offering the package?!

Upstream = offers source repo and PyPI package

Downstream = provides Debian, Fedora, OpenSuSE, Arch Linux, Conda, Gentoo, ... packaging.

CREMONA_MINI_DATA_DIR, CREMONA_LARGE_DATA_DIR,
POLYTOPE_DATA_DIR)


class DatabaseConwayPolynomials(StaticFile):
Copy link
Contributor

@mkoeppe mkoeppe Nov 25, 2023

Choose a reason for hiding this comment

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

Normally I think we would say that this is API and should not be removed without deprecation. But I don't object to removing it

@tobiasdiez
Copy link
Contributor

It's now available on conda-forge, so it should work now once you added a conda.txt file.

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

@orlitzky
Copy link
Contributor Author

We should update this to v0.8 first but my sage has been occupied all day running gap tests.

Copy link

Documentation preview for this PR (built with commit 1685d81; changes) is ready! 🎉

vbraun pushed a commit to vbraun/sage that referenced this pull request Dec 10, 2023
    
Fix sagemath#32747 by switching to the
newly-minted [conway-polynomials
package](https://pypi.org/project/conway-polynomials/0.7/) on pypi.

IMO `sage.databases.conway` (which makes the dict immutable by wrapping
it in a class) is of dubious value but I've left everything alone for
now.
    
URL: sagemath#36765
Reported by: Michael Orlitzky
Reviewer(s): François Bissey, Matthias Köppe, Michael Orlitzky, Tobias Diez
@vbraun vbraun merged commit dfdd7da into sagemath:develop Dec 14, 2023
@mkoeppe mkoeppe added this to the sage-10.3 milestone Dec 14, 2023
@orlitzky orlitzky deleted the update-conway-polynomials branch January 24, 2024 14:45
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.

Upstream Python distribution package for conway_polynomials
6 participants