Dependency usage tracking for citations

sage.misc.citation.cython_profile_enabled()

Return whether Cython profiling is enabled.

EXAMPLES:

sage: from sage.misc.citation import cython_profile_enabled
sage: cython_profile_enabled()  # random
False
sage: type(cython_profile_enabled()) is bool
True
sage.misc.citation.get_systems(cmd)

Return a list of the systems used in running the command cmd.

Note that the results can sometimes include systems that did not actually contribute to the computation. Due to caching, it could miss some dependencies as well.

INPUT:

  • cmd – a string to run

Warning

In order to properly support Cython code, this requires that Sage was compiled with the environment variable SAGE_PROFILE=yes. If this was not the case, a warning will be given when calling this function.

EXAMPLES:

sage: from sage.misc.citation import get_systems
sage: get_systems('print("hello")')  # random (may print warning)
[]
sage: integrate(x^2, x)  # Priming coercion model
1/3*x^3
sage: get_systems('integrate(x^2, x)')
['Maxima', 'ginac']
sage: R.<x,y,z> = QQ[]
sage: I = R.ideal(x^2+y^2, z^2+y)
sage: get_systems('I.primary_decomposition()')
['Singular']

Here we get a spurious MPFR because some coercions need to be initialized. The second time it is gone:

sage: a = var('a')
sage: get_systems('((a+1)^2).expand()')
['MPFR', 'ginac']
sage: get_systems('((a+1)^2).expand()')
['ginac']