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

Discussion: visual design #1

Open
alexmojaki opened this issue Jun 30, 2019 · 15 comments
Open

Discussion: visual design #1

alexmojaki opened this issue Jun 30, 2019 · 15 comments
Labels
discussion Need to hear people's opinions

Comments

@alexmojaki
Copy link
Owner

The current look of snoop is the result of many small decisions and I really don't know if I made the right ones. What would you change about the appearance if you could? This could be about color, layout, the choice of words or special characters, and more. No detail is too small to post about here. Please also vote on proposals with reactions to help me see how popular they are.

@alexmojaki
Copy link
Owner Author

Here's a thought: what if each thread name/identifier in the columns (i.e. what shows after install(columns='thread thread_ident') had a unique color, making it easier to pick out the correct lines visually? E.g. suppose the name Thread-1 was always purple and Thread-2 was always green.

@alexmojaki
Copy link
Owner Author

Should I reverse the indentation when using pp.deep? For example this:

from snoop import pp

x = 1
y = 2
z = 3

assert 6 == pp.deep(lambda: x + y + z)

Currently outputs this:

12:21:10.98 LOG:
12:21:11.01 ............ x = 1
12:21:11.01 ............ y = 2
12:21:11.01 ........ x + y = 3
12:21:11.01 ........ z = 3
12:21:11.01 .... x + y + z = 6

Would it be better if I changed it to this?

12:17:40.91 LOG:
12:17:40.92 .... x = 1
12:17:40.93 .... y = 2
12:17:40.93 ........ x + y = 3
12:17:40.93 ........ z = 3
12:17:40.93 ............ x + y + z = 6

Thumbs up to change it, thumbs down to keep it the same.

@sirex
Copy link

sirex commented Sep 3, 2019

On my terminal, time color is almost invisible, here is how it looks:

Ekrano nuotrauka iš 2019-09-03 16-48-14

It would be nice, if column colors would be taken from pygments theme if that is possible.

@alexmojaki
Copy link
Owner Author

Thanks @sirex. Getting colors right across all terminals and backgrounds is very tricky and has caused me quite a bit of trouble. I've created #14 to try tackling this. It should make columns the same color as comments as configured by pygments. How does that sound?

@ivanhercaz
Copy link

Hi @alexmojaki! In order to reply to your question about if you have to reverse the indentation of pp.deep, it makes more sense to me if you reverse it, I mean like the next example:

12:17:40.92 .... x = 1
12:17:40.93 .... y = 2
12:17:40.93 ........ x + y = 3
12:17:40.93 ........ z = 3
12:17:40.93 ............ x + y + z = 6```

@martinsmid
Copy link

Would it make sense to change the indent char from . to something else to express the nested evaluation rather than source indentation ? Or maybe just change to color if there is no proper char, or you don't want to use some unicode special.

@alexmojaki
Copy link
Owner Author

@martinsmid can you elaborate?

@martinsmid
Copy link

Maybe something like this

12:17:40.92 .... x = 1
12:17:40.93 .... y = 2
12:17:40.93 .... . . x + y = 3
12:17:40.93 .... . . z = 3
12:17:40.93 .... . . . .  x + y + z = 6

I didn't think about this thoroughly yet. And also I am not experienced with the current snoop's output in general.

Now when I look at the original output in your post, I would probably just differentiate the indent as in my example, without the reversal of the indent.

12:21:11.01 .... . . . . x = 1
12:21:11.01 .... . . . . y = 2
12:21:11.01 .... . . x + y = 3
12:21:11.01 .... . . z = 3
12:21:11.01 .... x + y + z = 6

@alexmojaki
Copy link
Owner Author

Why do you want to differentiate between the dots? Does anyone else think this would be helpful?

@TejasAvinashShetty
Copy link

Why do you want to differentiate between the dots? Does anyone else think this would be helpful?

Nope

@KyleKing
Copy link

KyleKing commented Aug 5, 2020

For multi-line output, could the columns be printed only on the first LOG: line?

Example:

from pathlib import Path

import snoop

snooper = snoop.Config(columns='time,thread,thread_ident,file,full_file,function,function_qualname', out='tmp.log')

snooper.pp([*Path(__file__).parent.resolve().glob('*.*')])

Currently it might look like this:

06:28:24.23 MainThread 4534779328 tmp.py /Users/kyleking/Developer/Pull_Requests/Eel/tmp.py <module> <module> LOG:
06:28:24.25 MainThread 4534779328 tmp.py /Users/kyleking/Developer/Pull_Requests/Eel/tmp.py <module> <module> .... [*Path(__file__).parent.resolve().glob('*.*')] = [PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/.DS_Store'),
06:28:24.25 MainThread 4534779328 tmp.py /Users/kyleking/Developer/Pull_Requests/Eel/tmp.py <module> <module>                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/requirements.txt'),
06:28:24.25 MainThread 4534779328 tmp.py /Users/kyleking/Developer/Pull_Requests/Eel/tmp.py <module> <module>                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/.tox'),
06:28:24.25 MainThread 4534779328 tmp.py /Users/kyleking/Developer/Pull_Requests/Eel/tmp.py <module> <module>                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/README-developers.md'),
06:28:24.25 MainThread 4534779328 tmp.py /Users/kyleking/Developer/Pull_Requests/Eel/tmp.py <module> <module>                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/CHANGELOG.md'),
06:28:24.25 MainThread 4534779328 tmp.py /Users/kyleking/Developer/Pull_Requests/Eel/tmp.py <module> <module>                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/requirements-test.txt'),
06:28:24.25 MainThread 4534779328 tmp.py /Users/kyleking/Developer/Pull_Requests/Eel/tmp.py <module> <module>                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/tmp.py'),
06:28:24.25 MainThread 4534779328 tmp.py /Users/kyleking/Developer/Pull_Requests/Eel/tmp.py <module> <module>                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/MANIFEST.in'),
06:28:24.25 MainThread 4534779328 tmp.py /Users/kyleking/Developer/Pull_Requests/Eel/tmp.py <module> <module>                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/README.md'),
06:28:24.25 MainThread 4534779328 tmp.py /Users/kyleking/Developer/Pull_Requests/Eel/tmp.py <module> <module>                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/setup.py'),
06:28:24.25 MainThread 4534779328 tmp.py /Users/kyleking/Developer/Pull_Requests/Eel/tmp.py <module> <module>                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/.gitignore'),
06:28:24.25 MainThread 4534779328 tmp.py /Users/kyleking/Developer/Pull_Requests/Eel/tmp.py <module> <module>                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/Eel.egg-info'),
06:28:24.25 MainThread 4534779328 tmp.py /Users/kyleking/Developer/Pull_Requests/Eel/tmp.py <module> <module>                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/.github'),
06:28:24.25 MainThread 4534779328 tmp.py /Users/kyleking/Developer/Pull_Requests/Eel/tmp.py <module> <module>                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/tox.ini'),
06:28:24.25 MainThread 4534779328 tmp.py /Users/kyleking/Developer/Pull_Requests/Eel/tmp.py <module> <module>                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/requirements-meta.txt'),
06:28:24.25 MainThread 4534779328 tmp.py /Users/kyleking/Developer/Pull_Requests/Eel/tmp.py <module> <module>                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/.python-version'),
06:28:24.25 MainThread 4534779328 tmp.py /Users/kyleking/Developer/Pull_Requests/Eel/tmp.py <module> <module>                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/.git'),
06:28:24.25 MainThread 4534779328 tmp.py /Users/kyleking/Developer/Pull_Requests/Eel/tmp.py <module> <module>                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/.travis.yml')]

But i would find it easier to read like this

06:28:24.23 MainThread 4534779328 tmp.py /Users/kyleking/Developer/Pull_Requests/Eel/tmp.py <module> <module> LOG:
.... [*Path(__file__).parent.resolve().glob('*.*')] = [PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/.DS_Store'),
                                                       PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/requirements.txt'),
                                                       PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/.tox'),
                                                       PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/README-developers.md'),
                                                       PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/CHANGELOG.md'),
                                                       PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/requirements-test.txt'),
                                                       PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/tmp.py'),
                                                       PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/MANIFEST.in'),
                                                       PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/README.md'),
                                                       PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/setup.py'),
                                                       PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/.gitignore'),
                                                       PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/Eel.egg-info'),
                                                       PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/.github'),
                                                       PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/tox.ini'),
                                                       PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/requirements-meta.txt'),
                                                       PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/.python-version'),
                                                       PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/.git'),
                                                       PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/.travis.yml')]

Or maybe there is a happy medium:

06:28:24.23 MainThread 4534779328 tmp.py /Users/kyleking/Developer/Pull_Requests/Eel/tmp.py <module> <module> LOG:
06:28:24.25 .... [*Path(__file__).parent.resolve().glob('*.*')] = [PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/.DS_Store'),
06:28:24.25                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/requirements.txt'),
06:28:24.25                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/.tox'),
06:28:24.25                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/README-developers.md'),
06:28:24.25                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/CHANGELOG.md'),
06:28:24.25                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/requirements-test.txt'),
06:28:24.25                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/tmp.py'),
06:28:24.25                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/MANIFEST.in'),
06:28:24.25                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/README.md'),
06:28:24.25                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/setup.py'),
06:28:24.25                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/.gitignore'),
06:28:24.25                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/Eel.egg-info'),
06:28:24.25                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/.github'),
06:28:24.25                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/tox.ini'),
06:28:24.25                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/requirements-meta.txt'),
06:28:24.25                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/.python-version'),
06:28:24.25                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/.git'),
06:28:24.25                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/.travis.yml')]

@alexmojaki
Copy link
Owner Author

@KyleKing I don't like this idea. Having a consistent block of columns is:

  • Easy to visually ignore.
  • Easy to scroll past.
  • Easy to cut out with an editor that supports column selection.
  • Easy to use tools like grep on.

@KyleKing
Copy link

KyleKing commented Aug 5, 2020

Okay makes sense


On another note, could a column option be available for the line number?

from pathlib import Path

import snoop

snooper = snoop.Config(columns='time,file,line')

snooper.pp([*Path(__file__).parent.resolve().glob('*.*')])
06:28:24.23 tmp.py None LOG:
06:28:24.25 tmp.py 6  .... [*Path(__file__).parent.resolve().glob('*.*')] = [PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/.DS_Store'),
06:28:24.25 tmp.py 6                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/requirements.txt'),
06:28:24.25 tmp.py 6                                                        PosixPath('/Users/kyleking/Developer/Pull_Requests/Eel/.tox'),

(I'm not sure how the first LOG line would be handled, but put None for now)

@alexmojaki
Copy link
Owner Author

You can do this:

from pathlib import Path

import snoop


def line_column(event):
    return event.line_no


snooper = snoop.Config(columns=['time', 'file', line_column])

snooper.pp([*Path(__file__).parent.resolve().glob('*.*')])

It feels a bit weird to add this as a column since the line number is usually showing if you use @snoop and not just pp.

@danr
Copy link
Contributor

danr commented Mar 16, 2021

For this program:

from snoop import pp

x = 1
y = 2
z = 3

assert 6 == pp.deep(lambda: x + y + z)

Why not output this?

12:21:10.98 LOG:
12:21:11.01 .... x = 1
12:21:11.01 ........ y = 2
12:21:11.01 .... x + y = 3
12:21:11.01 ............ z = 3
12:21:11.01 .... x + y + z = 6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Need to hear people's opinions
Projects
None yet
Development

No branches or pull requests

7 participants