On Tuesday, April 23, 2024 at 8:38:13 AM UTC-7 Martin R wrote:

If I understand correctly, the current proposal does not mind if some 
things don't work or could be replaced without too much effort.  For 
example, Dima might have referred to the fact that 
OrderedPartitions.cardinality uses gap, even though it is in 
sagemath-combinat.

The gap dependency in `designs.database` (which is in sagemath-graphs) and 
`matrices.latin` (which is in sagemath-combinat) might have been overlooked.


Dependencies come in different flavors, or strengths. See again 
https://doc.sagemath.org/html/en/developer/packaging_sage_library.html#dependencies-and-distribution-packages

Here's a tl;dr version:

*Build-time dependencies:* If a Cython module uses cimport to pull in 
anything from .pxd files, these files must be either part of the portion 
shipped as the distribution being built, or the distribution that provides 
these files must be declared as a build-time dependency.

*Module-level runtime dependencies:* Any import statements at the top level 
of a Python or Cython module are executed when the module is imported. 
Hence, the imported modules must be part of the distribution, or provided 
by another distribution – which then must be declared as a run-time 
dependency.

*Other runtime dependencies:* If import statements are used within a 
method, the imported module is loaded the first time that the method is 
called. Hence the module defining the method can still be imported even if 
the module needed by the method is not present. 
It is then a question whether a run-time dependency should be declared. If 
the method needing that import provides core functionality, then probably 
yes. 
But if it only provides what can be considered “optional functionality”, 
then probably not, and in this case it will be up to the user to install 
the distribution enabling this optional functionality. It is possible to 
declare such *optional runtime dependencies* as "extras", which provides a 
way to give a nickname to a distribution that can be installed as an add-on.

*Doctest-only dependencies:* Doctests often use examples constructed using 
functionality provided by other portions of the Sage library. This kind of 
integration testing is one of the strengths of Sage; but it also creates 
extra dependencies. We can deal with them using the same mechanism that we 
use for making doctests conditional on the presence of optional libraries: 
using "# optional - FEATURE" (or "# needs FEATURE") directives in the 
doctests. Adding these directives will allow developers to test the 
distribution separately, without requiring all of Sage to be present.


Looking at your examples:

*$ head -n 4 src/sage/combinat/matrices/latin.py*
# sage_setup: distribution = sagemath-combinat
# sage.doctest: needs sage.combinat sage.groups sage.modules
r"""
Latin Squares

So here you see that the module is shipped by the distribution 
*sagemath-combinat*, but the functionality in this module depends at 
runtime on the features "sage.combinat sage.groups sage.modules".



*$ head -n 3 src/sage/combinat/designs/database.py*# sage_setup: 
distribution = sagemath-graphs
r"""
Database of small combinatorial designs
*$ git grep '# needs' src/sage/combinat/designs/database.py*
src/sage/combinat/designs/database.py:        sage: 
is_difference_matrix(M,G,8,1)                                             # 
needs sage.rings.finite_rings
src/sage/combinat/designs/database.py:        sage: _ = 
designs.difference_matrix(56,8)                                       # 
needs sage.rings.finite_rings
src/sage/combinat/designs/database.py:        sage: G,M = DM_57_8_1()       
                                                  # needs 
sage.rings.finite_rings sage.schemes
src/sage/combinat/designs/database.py:        sage: 
is_difference_matrix(M,G,8,1)                                             # 
needs sage.rings.finite_rings sage.schemes
src/sage/combinat/designs/database.py:        sage: _ = 
designs.difference_matrix(57,8)                                       # 
needs sage.rings.finite_rings sage.schemes
src/sage/combinat/designs/database.py:        sage: _ = 
designs.difference_matrix(75,8)                                       # 
needs sage.rings.finite_rings
src/sage/combinat/designs/database.py:        sage: G,M = DM_273_17_1()     
                                                  # needs sage.schemes
src/sage/combinat/designs/database.py:        sage: 
is_difference_matrix(M,G,17,1)                                            # 
needs sage.schemes
src/sage/combinat/designs/database.py:        sage: _ = 
designs.difference_matrix(273,17)                                     # 
needs sage.schemes
src/sage/combinat/designs/database.py:        sage: G,M = DM_993_32_1()     
                                                  # needs sage.schemes
src/sage/combinat/designs/database.py:        sage: 
is_difference_matrix(M,G,32,1)                                            # 
needs sage.schemes
src/sage/combinat/designs/database.py:        sage: _ = 
designs.difference_matrix(993,32)                                     # 
needs sage.schemes
src/sage/combinat/designs/database.py:        sage: RBIBD = RBIBD_120_8_1() 
                                                  # needs sage.modules
src/sage/combinat/designs/database.py:        sage: 
is_pairwise_balanced_design(RBIBD,120,[8])                                # 
needs sage.modules
src/sage/combinat/designs/database.py:        sage: for i in range(17):     
                                                  # needs sage.modules
src/sage/combinat/designs/database.py:        sage: _ = 
designs.balanced_incomplete_block_design(120,8)                       # 
needs sage.modules
src/sage/combinat/designs/database.py:        sage: B2 = 
Hypergraph(BIBD_45_9_8(from_code=True))      # not tested            # 
needs sage.rings.finite_rings
src/sage/combinat/designs/database.py:        sage: B2.is_isomorphic(B)     
          # not tested                            # needs 
sage.rings.finite_rings
src/sage/combinat/designs/database.py:        sage: D = 
IncidenceStructure(BIBD_79_13_2())                                    # 
needs sage.libs.gap

So here you see that some of the individual doctests are marked as 
dependent on additional features. These are the mildest kind of 
dependencies.


-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/39ddb7dc-2aeb-4f33-9760-63b217765fd3n%40googlegroups.com.

Reply via email to