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

move sage.misc.misc.*verbose* to new module sage.misc.verbose #29895

Closed
mkoeppe opened this issue Jun 18, 2020 · 31 comments
Closed

move sage.misc.misc.*verbose* to new module sage.misc.verbose #29895

mkoeppe opened this issue Jun 18, 2020 · 31 comments

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Jun 18, 2020

The "simple verbosity system" in sage.misc.misc has 2 global variables, LEVEL and verbose_files, which are meant to be internal.

  • Access is through functions verbose, set_verbose, set_verbose_files, get_verbose_files, unset_verbose_files, get_verbose, all of which are imported by sage.misc.all.

  • Only verbose and get_verbose are used in sagelib.

  • Additionally, set_verbose is used in doctests of sagelib.

We move the functions to a new module sage.misc.verbose, with lazy_import and deprecation. This is preparation for #21349, and is also helpful for #29865 (modularization).

We also add some documentation taken from #21349.

We also deprecate the import of verbose into sage.misc.all as proposed in #17815.

See also:

Depends on #29892

CC: @fchapoton @tscrim @dkrenn @mwageringel

Component: refactoring

Author: Daniel Krenn, Matthias Koeppe

Branch/Commit: 8d7609e

Reviewer: Travis Scrimshaw, Markus Wageringel

Issue created by migration from https://trac.sagemath.org/ticket/29895

@mkoeppe mkoeppe added this to the sage-9.2 milestone Jun 18, 2020
@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 18, 2020

comment:3

We can reuse some of the commits of #21349 for this ticket.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 18, 2020

Author: Daniel Krenn, Matthias Koeppe

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 19, 2020

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 19, 2020

comment:7

The branch does not work yet because it the moved functions depend on cputime from sage.misc.misc and other missing imports


Last 10 new commits:

a5453bfFixup: Add src/sage/misc/call.py
64c5701lazy_import from sage.misc.call with deprecation
65414f7Fix imports and one deprecation warning
b9314d4sage.misc.call: Add standard header information, add to reference manual
6024ffdsrc/sage/misc/call.py: register_unpickle_override for call_method
e8ad8d3sage.misc.verbose: New module
ad01c5fsage.misc.misc: Move *verbose* to sage.misc.verbose
67f7eb2sage.misc.all: Import *verbose* from sage.misc.verbose, deprecate import of function verbose
8068325sage.misc.misc: lazy_import *verbose* with deprecation
2363642fixup

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 19, 2020

Commit: 2363642

@mkoeppe

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 19, 2020

Changed commit from 2363642 to d8abdb0

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 19, 2020

Branch pushed to git repo; I updated commit sha1. This was a forced push. Last 10 new commits:

68da7f5replace all of sage.misc.*verbose by sage.verbose.*verbose
55ec500resolve verbose-nameclash
c9eb31dReplace imports *verbose* from sage.misc.all by imports from sage.misc.verbose
06dcba2sage.plot.graphics: Use warnings.warn instead of nonexisting sage.misc.misc.warn
210c1a7sage.plot: Import sage.misc.verbose
8a5e384Fix remaining imports of *verbose*
5632556src/sage/modular/modsym/relation_matrix_pyx.pyx: Fixup import
41d42e9sage.misc.verbose: Fix imports
b3af9e2sage.misc.verbose: Fix doctest
d8abdb0Fixup various imports and uses of verbose

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 20, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

db40fd5Fix pyflakes warnings regarding imports

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 20, 2020

Changed commit from d8abdb0 to db40fd5

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 21, 2020

comment:12

The remaining patchbot plugin warnings are old news. Needs review.

@tscrim
Copy link
Collaborator

tscrim commented Jun 22, 2020

comment:13

LGTM.

@tscrim
Copy link
Collaborator

tscrim commented Jun 22, 2020

Reviewer: Travis Scrimshaw

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 22, 2020

comment:14

Thank you!

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 4, 2020

Changed commit from db40fd5 to df742b1

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 4, 2020

Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. New commits:

df742b1Merge tag '9.2.beta3' into t/29895/move_sage_misc_misc__verbose__to_new_module_sage_misc_verbose

@vbraun
Copy link
Member

vbraun commented Jul 4, 2020

comment:17

Merge conflict

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 5, 2020

Dependencies: #29892

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 5, 2020

Changed commit from df742b1 to ceaf817

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 5, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

3f5b6eaMove sage.misc.misc.coeff_repr, repr_lincomb to new module sage.misc.repr
08fedfasrc/sage/combinat/root_system/type_dual.py: Remove unused variable to fix pyflakes warning
05efc11sage.misc.repr.coeff_repr: Add doctest, adapted from sage.misc.latex.coeff_repr
538323bsrc/sage/misc/call.py: Fix block syntax in docstring
b5f63a5src/sage/misc/call.py: Returns should be Return
ceaf817Merge branch 't/29892/move_sage_misc_misc_coeff_repr__repr_lincomb_to_new_module_sage_misc_repr' into t/29895/move_sage_misc_misc__verbose__to_new_module_sage_misc_verbose

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 5, 2020

comment:20

Trivial merge to resolve conflict

@vbraun
Copy link
Member

vbraun commented Jul 10, 2020

comment:21
sage -t --long --warn-long 36.6 src/sage/algebras/splitting_algebra.py
**********************************************************************
File "src/sage/algebras/splitting_algebra.py", line 56, in sage.algebras.splitting_algebra.SplittingAlgebraElement
Failed example:
    CR6.<e6> = SplittingAlgebra(cp6)
Expected nothing
Got:
    doctest:warning
      File "/home/release/Sage/src/bin/sage-runtests", line 177, in <module>
        err = DC.run()
      File "/home/release/Sage/local/lib/python3.7/site-packages/sage/doctest/control.py", line 1207, in run
        self.run_doctests()
      File "/home/release/Sage/local/lib/python3.7/site-packages/sage/doctest/control.py", line 908, in run_doctests
        self.dispatcher.dispatch()
      File "/home/release/Sage/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 2038, in dispatch
        self.parallel_dispatch()
      File "/home/release/Sage/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 1933, in parallel_dispatch
        w.start()  # This might take some time
      File "/home/release/Sage/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 2205, in start
        super(DocTestWorker, self).start()
      File "/home/release/Sage/local/lib/python3.7/multiprocessing/process.py", line 112, in start
        self._popen = self._Popen(self)
      File "/home/release/Sage/local/lib/python3.7/multiprocessing/context.py", line 223, in _Popen
        return _default_context.get_context().Process._Popen(process_obj)
      File "/home/release/Sage/local/lib/python3.7/multiprocessing/context.py", line 277, in _Popen
        return Popen(process_obj)
      File "/home/release/Sage/local/lib/python3.7/multiprocessing/popen_fork.py", line 20, in __init__
        self._launch(process_obj)
      File "/home/release/Sage/local/lib/python3.7/multiprocessing/popen_fork.py", line 74, in _launch
        code = process_obj._bootstrap()
      File "/home/release/Sage/local/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
        self.run()
      File "/home/release/Sage/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 2177, in run
        task(self.options, self.outtmpfile, msgpipe, self.result_queue)
      File "/home/release/Sage/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 2506, in __call__
        doctests, extras = self._run(runner, options, results)
      File "/home/release/Sage/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 2552, in _run
        result = runner.run(test)
      File "/home/release/Sage/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 905, in run
        return self._run(test, compileflags, out)
      File "/home/release/Sage/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 707, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/release/Sage/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 1131, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.algebras.splitting_algebra.SplittingAlgebraElement[2]>", line 1, in <module>
        CR6 = SplittingAlgebra(cp6, names=('e6',)); (e6,) = CR6._first_ngens(1)
      File "/home/release/Sage/local/lib/python3.7/site-packages/sage/algebras/splitting_algebra.py", line 224, in __init__
        % (base_ring, monic_polynomial, iterate, warning))
      File "/home/release/Sage/local/lib/python3.7/site-packages/sage/misc/superseded.py", line 100, in deprecation
        warning(trac_number, message, DeprecationWarning, stacklevel)
      File "/home/release/Sage/local/lib/python3.7/site-packages/sage/misc/superseded.py", line 146, in warning
        warn(message, warning_class, stacklevel)
      File "/home/release/Sage/local/lib/python3.7/warnings.py", line 110, in _showwarnmsg
        msg.file, msg.line)
    :
    DeprecationWarning: 
    Importing verbose from here is deprecated. If you need to use it, please import it directly from sage.misc.verbose
    See http://trac.sagemath.org/17815 for details.
**********************************************************************
1 item had failures:
   1 of   6 in sage.algebras.splitting_algebra.SplittingAlgebraElement
    [107 tests, 1 failure, 0.65 s]
----------------------------------------------------------------------
sage -t --long --warn-long 36.6 src/sage/algebras/splitting_algebra.py  # 1 doctest failed
----------------------------------------------------------------------

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 10, 2020

Changed commit from ceaf817 to 8d7609e

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 10, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

8d7609esrc/sage/algebras/splitting_algebra.py: from sage.misc.verbose import verbose

@mwageringel
Copy link

Changed reviewer from Travis Scrimshaw to Travis Scrimshaw, Markus Wageringel

@mwageringel
Copy link

comment:24

The fix looks good to me and the bot is green.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 10, 2020

comment:25

Thanks!

@vbraun
Copy link
Member

vbraun commented Jul 12, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants