reproman icon indicating copy to clipboard operation
reproman copied to clipboard

ls: Use pyout

Open kyleam opened this issue 5 years ago • 5 comments

Closes #318.

kyleam avatar Apr 01 '19 14:04 kyleam

The length bit of test_no_heavy_imports fails. I'll take a look at what's being pulled in.

kyleam avatar Apr 01 '19 14:04 kyleam

Codecov Report

Merging #399 into master will decrease coverage by 0.01%. The diff coverage is 93.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #399      +/-   ##
==========================================
- Coverage   89.82%   89.81%   -0.02%     
==========================================
  Files         148      148              
  Lines       11658    11676      +18     
==========================================
+ Hits        10472    10487      +15     
- Misses       1186     1189       +3
Impacted Files Coverage Δ
reproman/interface/tests/test_ls.py 100% <100%> (ø) :arrow_up:
reproman/interface/ls.py 93.1% <89.18%> (-0.52%) :arrow_down:
...eproman/interface/tests/test_backend_parameters.py 95.65% <0%> (-4.35%) :arrow_down:
reproman/tests/skip.py 95% <0%> (-2.5%) :arrow_down:
reproman/resource/docker_container.py 95.3% <0%> (+0.63%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c199c04...bdfbc6d. Read the comment docs.

codecov[bot] avatar Apr 01 '19 15:04 codecov[bot]

Codecov Report

Merging #399 into master will increase coverage by 0.04%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #399      +/-   ##
==========================================
+ Coverage   89.82%   89.87%   +0.04%     
==========================================
  Files         148      148              
  Lines       11658    11684      +26     
==========================================
+ Hits        10472    10501      +29     
+ Misses       1186     1183       -3
Impacted Files Coverage Δ
reproman/interface/tests/test_ls.py 100% <100%> (ø) :arrow_up:
reproman/interface/ls.py 100% <100%> (+6.38%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c199c04...afd47ef. Read the comment docs.

codecov[bot] avatar Apr 01 '19 15:04 codecov[bot]

The length bit of test_no_heavy_imports fails. I'll take a look at what's being pulled in.

It was mostly what you'd expect by importing pyout at the top-level:

diff of modules
--- modules-master	2019-04-01 10:58:44.273588743 -0400
+++ modules-pr	2019-04-01 10:58:22.400929834 -0400
@@ -1,4 +1,5 @@
 {'__future__',
+ '__mp_main__',
  '_ast',
  '_bisect',
  '_bz2',
@@ -6,6 +7,7 @@
  '_compat_pickle',
  '_compression',
  '_ctypes',
+ '_curses',
  '_datetime',
  '_functools',
  '_hashlib',
@@ -24,6 +26,7 @@
  '_virtualenv_distutils',
  'appdirs',
  'argparse',
+ 'array',
  'ast',
  'atexit',
  'attr',
@@ -38,6 +41,7 @@
  'base64',
  'binascii',
  'bisect',
+ 'blessings',
  'bz2',
  'calendar',
  'collections',
@@ -49,6 +53,7 @@
  'ctypes',
  'ctypes._endian',
  'ctypes.util',
+ 'curses',
  'datetime',
  'dis',
  'distutils',
@@ -71,6 +76,7 @@
  'email.quoprimime',
  'email.utils',
  'enum',
+ 'fcntl',
  'fnmatch',
  'functools',
  'gc',
@@ -101,11 +107,24 @@
  'logging.handlers',
  'lzma',
  'math',
+ 'multiprocessing',
+ 'multiprocessing.context',
+ 'multiprocessing.dummy',
+ 'multiprocessing.dummy.connection',
+ 'multiprocessing.process',
  'opcode',
  'operator',
  'pickle',
  'platform',
  'pwd',
+ 'pyout',
+ 'pyout.common',
+ 'pyout.elements',
+ 'pyout.field',
+ 'pyout.interface',
+ 'pyout.summary',
+ 'pyout.tabular',
+ 'pyout.truncate',
  'pytz',
  'pytz.exceptions',
  'pytz.lazy',
@@ -177,6 +196,7 @@
  'shlex',
  'shutil',
  'signal',
+ 'six',
  'socket',
  'sre_compile',
  'sre_constants',

I've moved the pyout import to Ls.__call__.

range-diff
1:  0d092d042 = 1:  0d092d042 setup.py: Add pyout
2:  1cfe18525 = 2:  1cfe18525 TST: ls: Adjust return structure to mirror pyout
3:  ed4b31442 ! 3:  bdfbc6d02 ENH: ls: Use pyout to render table
    @@ -25,8 +25,6 @@

     -from collections import OrderedDict
     +from functools import partial
    -+
    -+from pyout import Tabular

      from .base import Interface
      # import reproman.interface.base  # Needed for test patching
    @@ -38,7 +36,8 @@
     -        template = '{:<20} {:<20} {:<%(id_length)s} {!s:<10}' % locals()
     -        ui.message(template.format('RESOURCE NAME', 'TYPE', 'ID', 'STATUS'))
     -        ui.message(template.format('-------------', '----', '--', '------'))
    --
    ++        from pyout import Tabular
    +
     -        results = OrderedDict()
              manager = get_manager()
              if not resrefs:
    @@ -184,8 +183,7 @@
                                            return_value=resource_manager))
     -            stack.enter_context(patch("reproman.interface.ls.ui._ui.out",
     -                                      stream))
    -+            stack.enter_context(patch("reproman.interface.ls.Tabular",
    -+                                      TestTabular))
    ++            stack.enter_context(patch("pyout.Tabular", TestTabular))
                  return ls(*args, **kwargs), stream.getvalue()
          return fn

kyleam avatar Apr 01 '19 15:04 kyleam

Marking this as WIP because I consider the issue @yarikoptic raises in #400 to be a blocker.

kyleam avatar Apr 01 '19 21:04 kyleam