Closed mkoeppe closed 4 years ago
I propose to copy the current sage-brial code under sage/rings/polynomial
. This is based on the fact all (but one) imports of brial happen there.
$ grep -r brial src/sage/*
src/sage/rings/polynomial/pbori.pyx:# distutils: libraries = brial brial_groebner M4RI_LIBRARIES LIBPNG_LIBRARIES
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: #from brial.interpolate import interpolate_smallest_lex
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid, BooleanMonomial
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid, BooleanMonomial
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleSet
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanPolynomial
src/sage/rings/polynomial/pbori.pyx: from brial.parallel import _encode_polynomial
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleSet
src/sage/rings/polynomial/pbori.pyx: from brial import red_tail
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: from brial.gbcore import groebner_basis
src/sage/rings/polynomial/pbori.pyx: from brial import red_tail
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleSet
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleSet
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleSet
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanPolynomialVector
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanPolynomialVector
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanPolynomialVector
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanPolynomialVector
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanPolynomialVector
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanPolynomialVector
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanPolynomialVector
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import GroebnerStrategy
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import GroebnerStrategy
src/sage/rings/polynomial/pbori.pyx: sage: from brial import groebner_basis
src/sage/rings/polynomial/pbori.pyx: sage: from brial import GroebnerStrategy
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanPolynomialVector
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import GroebnerStrategy
src/sage/rings/polynomial/pbori.pyx: sage: from brial import groebner_basis
src/sage/rings/polynomial/pbori.pyx: sage: from brial import GroebnerStrategy
src/sage/rings/polynomial/pbori.pyx: sage: from brial import GroebnerStrategy
src/sage/rings/polynomial/pbori.pyx: sage: from brial import GroebnerStrategy
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleanMonomialMonoid
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import map_every_x_to_x_plus_one
src/sage/rings/polynomial/pbori.pyx: sage: from brial import zeros
src/sage/rings/polynomial/pbori.pyx: sage: from brial.interpolate import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial.interpolate import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import ll_red_nf_redsb
src/sage/rings/polynomial/pbori.pyx: sage: from brial import ll_red_nf_noredsb
src/sage/rings/polynomial/pbori.pyx: sage: from brial import ll_red_nf_noredsb_single_recursive_call
src/sage/rings/polynomial/pbori.pyx: sage: from brial import if_then_else
src/sage/rings/polynomial/pbori.pyx: sage: from brial import top_index
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import substitute_variables
src/sage/rings/polynomial/pbori.pyx: sage: from brial import substitute_variables
src/sage/rings/polynomial/pbori.pyx: sage: from brial import random_set, set_random_seed
src/sage/rings/polynomial/pbori.pyx: sage: from brial import random_set, set_random_seed
src/sage/rings/polynomial/pbori.pyx:# todo: merge with pickling from brial.parallel
src/sage/rings/polynomial/pbori.pyx:# todo: merge with pickling from brial.parallel
src/sage/rings/polynomial/pbori.pyx: from brial.parallel import _decode_polynomial
src/sage/rings/polynomial/pbori.pyx:# todo: merge with pickling from brial.parallel
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleConstant
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleConstant
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleConstant
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleConstant
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleConstant
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleConstant
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleConstant
src/sage/rings/polynomial/pbori.pyx: sage: from brial import BooleConstant
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/pbori.pyx: sage: from brial import *
src/sage/rings/polynomial/multi_polynomial_sequence.py: from brial import gauss_on_polys
src/sage/rings/polynomial/multi_polynomial_sequence.py: from brial.ll import eliminate,ll_encode,ll_red_nf_redsb
src/sage/rings/polynomial/multi_polynomial_sequence.py: from brial.interred import interred as inter_red
src/sage/sat/converters/__init__.py:from brial.cnf import CNFEncoder as PolyBoRiCNFEncoder
but other suggestions based on best practices will be given the priority.
So there's a Cython interface sage.libs.polybori
, then a Python library brial
, and also sage.rings.polynomial.pbori
? What is depending on what?
I thought that sage-brial depends on sage.libs.polybori
but that may not be the case. It imports sage.all
and specifically sage.rings.polynomial.pbori
and that's the only sage specific bits it imports.
sage.rings.polynomial.pbori
itself relies on sage.libs.polybori
(through sage.libs.polybori.decl
) and both need the C++ brial library.
Does that answer your question?
Thanks. I agree that sage.rings.polynomial
seems to be a good place for the Python code from sage-brial. Perhaps it would be best to create a package sage.rings.polynomial.brial
and to move the current pbori.pyx
inside it (leaving deprecated reimport behind). There are only a few places in Sage where things are imported from sage.rings.polynomial.pbori
and they could be easily update. Or, if you don't mind keep the old name pbori
, the same could be done with sage.rings.polynomial.pbori
instead of ...brial
.
One thing to keep in mind is the context of the planned modularization of sagelib.
In Sage 9.3 I would hope to be able to create a separate distribution (distutils package) sage-brial
, which would then package sage.rings.polynomial.{brial,pbori}
, sage.libs.polybori
, sage.libs.fes
, sage.crypto.boolean_function
-- everything that has a compile-time dependency on libbrial
. This will make it possible to separately compile sagelib
on systems without brial.
On the legal side, the code is GPL2.0 or later. Although I will need to fix the license on github. It seems I changed it from 2+ to 2 carelessly back in 2017 (probably by copying a template). I obviously had no rights to do that.
The only thing I may need guidance with is the deprecated re-import. Otherwise moving stuff, including pbori.{pyx,pxd}
, in sage.rings.polynomial.pbori
seems to be a good idea and hopefully will help with modularization.
Replying to @kiwifb:
On the legal side, the code is GPL2.0 or later. Although I will need to fix the license on github. It seems I changed it from 2+ to 2 carelessly back in 2017 (probably by copying a template). I obviously had no rights to do that.
I think GitHub takes the position that there is no such thing as "GPL 2 only": That the license includes "... or any later version" no matter whether you write these words in the files or not.
Replying to @mkoeppe:
Replying to @kiwifb:
On the legal side, the code is GPL2.0 or later. Although I will need to fix the license on github. It seems I changed it from 2+ to 2 carelessly back in 2017 (probably by copying a template). I obviously had no rights to do that.
I think GitHub takes the position that there is no such thing as "GPL 2 only": That the license includes "... or any later version" no matter whether you write these words in the files or not.
Very nice of them. But they are not lawyers and I think the "LICENSE" file should be explicit for people who look for these subtle clarification (distros). The GPL FAQ https://www.gnu.org/licenses/old-licenses/gpl-2.0-faq.html#VersionTwoOrLater seem to imply that you should explicitly state it.
Tests included inside sage-brial
will have to be moved to sage doctesting. More generally it will have to be documented properly as much as possible. This will be so much fun.
It looks like that will take much more than just drag and drop in place with a few cosmetic changes.
I suppose you could prepare the change to using the sage doctester first, before merging into Sage.
Given that sage_brial has no Cython bits, I think it could in fact be removed from the dependencies of sagelib, as it won't really be needed while installing sagelib, only later for docbuild and doctest.
Replying to @mkoeppe:
Given that sage_brial has no Cython bits, I think it could in fact be removed from the dependencies of sagelib, as it won't really be needed while installing sagelib, only later for docbuild and doctest.
Technically correct.
This is not ready for review. I am just pushing my work in progress so it is not just on my workstation, it is visible and open to others contribution.
There is a lot to do:
This may take some time and I doubt it will be ready in time for 9.2 but we can only try.
New commits:
884ca66 | WIP: move sage-brial files and pbori.{pxd,pyx} in sage/rings/polynomial/pbori/ |
Branch: public/merge_sage_brial
Branch pushed to git repo; I updated commit sha1. New commits:
2226097 | src/sage/rings/polynomial/pbori/__init__.py: Draft of lazy_import call |
Branch pushed to git repo; I updated commit sha1. New commits:
d0bc786 | transform python test into sage tests - step one. |
I am currently converting docstrings :( I am also doing some selective code deletion as I come along across it. There is a module for memory usage, it is imported once but never used and even less tested. So, I am removing it. It will be worth another look after that first pass.
Branch pushed to git repo; I updated commit sha1. New commits:
ae30cf3 | Basic conversion to sage doctrings/doctesting. Remove original copyright/license functions. |
4c0d80f | Some basic docstring in general_boolean_polynomial.py - remove memusage.py and its only import. |
bdf1fec | First pass in converting to docstring and doctests. It is quite likely a lot of doctests are broken at this stage. |
Branch pushed to git repo; I updated commit sha1. New commits:
2e94a77 | Merge branch 'develop' into brial-merging |
I suspect the building of the html doc will break at this stage. If it doesn't the output may very well be useless. Once I figure that out, I'll do the doctesting to see what's broken. I am expecting a lot of breaking in the newly imported tests.
Branch pushed to git repo; I updated commit sha1. New commits:
4e3ed88 | one too many pbori. |
Branch pushed to git repo; I updated commit sha1. New commits:
563e959 | add miising import of lazy_import |
Branch pushed to git repo; I updated commit sha1. New commits:
443a3a8 | Remove addition.py - nothing from this file is used and tests failures point to the file being obsolote. |
Branch pushed to git repo; I updated commit sha1. New commits:
167ef09 | migrate xrange (unsupported in python3) to range |
At this point documentation builds and is identical to the old one. doctesting gets a lot of failures. There is still quite a bit of cleaning to be done, including removing files that should have been trashed long ago.
More joy! I found a subtle coding error while fixing the test suite. I guess it won't have an impact on the rest of sage because that code path just error-ed out when taken. So it is probably a dead code path anyway.
Branch pushed to git repo; I updated commit sha1. New commits:
afdbb9d | fix doctests in blocks.py |
ec4cddb | remove check_claims.py which appears to be a standalone script. |
d53714f | remove another script |
72f8a6a | Fix doctest and code in cnf.py |
e25dd81 | Fix pbori related doctests and code in multi_polynomial_sequence |
Branch pushed to git repo; I updated commit sha1. New commits:
bc1f9e2 | fix more doctests |
This is ready for a first review. I am not expecting it to make it as is. But other people should comment now.
Branch pushed to git repo; I updated commit sha1. New commits:
878d941 | Remove the sage_brial package since its meaningful content is merged. |
As discussed in #29369 and #28918.
CC: @kiwifb @orlitzky @tscrim
Component: packages: standard
Author: François Bissey
Branch/Commit:
91fe5e1
Reviewer: Matthias Koeppe
Issue created by migration from https://trac.sagemath.org/ticket/30332