copier-org / copier

Library and command-line utility for rendering projects templates.
https://readthedocs.org/projects/copier/
MIT License
2k stars 178 forks source link

Cosmetic improvement of question visibility #344

Closed bosd closed 3 years ago

bosd commented 3 years ago

RFC to change the color of the questions to make it (more) readable. (anything light color visible on black and grey background will do ) image

pawamoy commented 3 years ago

I agree for a change of color in general, but keep in mind you are responsible for the colors in your theme. If the "blue" or "bold blue" color doesn't render well on your light grey background, that's a problem you should fix 🙂 Unless of course this color is defined as RGB or true color in Copier and not as one of the 16 colors of a palette.

yajo commented 3 years ago

Could you try with the last v6 alpha and report back please?

bosd commented 3 years ago

If the "blue" or "bold blue" color doesn't render well on your light grey background, that's a problem you should fix slightly_smiling_face

True, it was a standard Fedora terminal screenshot. However, most terminals have similar color scheme, like MX linux.

Dunno exactly what happened. But during active copier session, I was unable to change the theme of the terminal. (The "light" theme was not applied in active session)

bosd commented 3 years ago

The latest v6 alpha won't install. Could be my bad..

Uninstalled last stable and then.

$ pip install .

Defaulting to user installation because normal site-packages is not writeable
Processing /home/dev/Downloads/copier-6.0.0a5
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: pydantic<2.0.0,>=1.6.1 in /home/dev/.local/lib/python3.9/site-packages (from copier==0.0.0) (1.7.3)
Requirement already satisfied: pyyaml-include<2.0,>=1.2 in /home/dev/.local/lib/python3.9/site-packages (from copier==0.0.0) (1.2.post2)
Requirement already satisfied: colorama<0.5.0,>=0.4.3 in /home/dev/.local/lib/python3.9/site-packages (from copier==0.0.0) (0.4.4)
Requirement already satisfied: packaging<21.0,>=20.4 in /home/dev/.local/lib/python3.9/site-packages (from copier==0.0.0) (20.8)
Requirement already satisfied: questionary<2.0.0,>=1.7.0 in /home/dev/.local/lib/python3.9/site-packages (from copier==0.0.0) (1.9.0)
Requirement already satisfied: pathspec<0.9.0,>=0.8.0 in /home/dev/.local/lib/python3.9/site-packages (from copier==0.0.0) (0.8.1)
Requirement already satisfied: pyyaml<6.0.0,>=5.3.1 in /usr/lib64/python3.9/site-packages (from copier==0.0.0) (5.3.1)
Collecting iteration_utilities<0.11.0,>=0.10.1
  Using cached iteration_utilities-0.10.1.tar.gz (126 kB)
Requirement already satisfied: plumbum<2.0.0,>=1.6.9 in /home/dev/.local/lib/python3.9/site-packages (from copier==0.0.0) (1.6.9)
Requirement already satisfied: Pygments<3.0.0,>=2.7.1 in /home/dev/.local/lib/python3.9/site-packages (from copier==0.0.0) (2.7.4)
Requirement already satisfied: jinja2<3.0.0,>=2.11.2 in /home/dev/.local/lib/python3.9/site-packages (from copier==0.0.0) (2.11.3)
Requirement already satisfied: pyparsing>=2.0.2 in /home/dev/.local/lib/python3.9/site-packages (from packaging<21.0,>=20.4->copier==0.0.0) (2.4.7)
Requirement already satisfied: prompt_toolkit<4.0,>=2.0 in /home/dev/.local/lib/python3.9/site-packages (from questionary<2.0.0,>=1.7.0->copier==0.0.0) (3.0.14)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/lib64/python3.9/site-packages (from jinja2<3.0.0,>=2.11.2->copier==0.0.0) (1.1.1)
Requirement already satisfied: wcwidth in /home/dev/.local/lib/python3.9/site-packages (from prompt_toolkit<4.0,>=2.0->questionary<2.0.0,>=1.7.0->copier==0.0.0) (0.2.5)
Using legacy 'setup.py install' for iteration-utilities, since package 'wheel' is not installed.
Building wheels for collected packages: copier
  Building wheel for copier (PEP 517) ... done
  Created wheel for copier: filename=copier-0.0.0-py3-none-any.whl size=26381 sha256=e62d02898d9a6dce9c49a2a04942c8a319c968c5ab1804d35329e18de094e40f
  Stored in directory: /home/dev/.cache/pip/wheels/ff/4d/f3/9cf31f6c04ae1716e2b242cb2b6ca42911cc92321f130dc00c
Successfully built copier
Installing collected packages: iteration-utilities, copier
    Running setup.py install for iteration-utilities ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rs92976d/iteration-utilities/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rs92976d/iteration-utilities/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-5obvx4iu/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/dev/.local/include/python3.9/iteration-utilities
         cwd: /tmp/pip-install-rs92976d/iteration-utilities/
    Complete output (24 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.9
    creating build/lib.linux-x86_64-3.9/iteration_utilities
    copying src/iteration_utilities/_utils.py -> build/lib.linux-x86_64-3.9/iteration_utilities
    copying src/iteration_utilities/_recipes.py -> build/lib.linux-x86_64-3.9/iteration_utilities
    copying src/iteration_utilities/_convenience.py -> build/lib.linux-x86_64-3.9/iteration_utilities
    copying src/iteration_utilities/_classes.py -> build/lib.linux-x86_64-3.9/iteration_utilities
    copying src/iteration_utilities/_additional_recipes.py -> build/lib.linux-x86_64-3.9/iteration_utilities
    copying src/iteration_utilities/__init__.py -> build/lib.linux-x86_64-3.9/iteration_utilities
    running build_ext
    building 'iteration_utilities._iteration_utilities' extension
    creating build/temp.linux-x86_64-3.9
    creating build/temp.linux-x86_64-3.9/src
    creating build/temp.linux-x86_64-3.9/src/iteration_utilities
    creating build/temp.linux-x86_64-3.9/src/iteration_utilities/_iteration_utilities
    gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python3.9 -c src/iteration_utilities/_iteration_utilities/_iteration_utilities.c -o build/temp.linux-x86_64-3.9/src/iteration_utilities/_iteration_utilities/_iteration_utilities.o
    src/iteration_utilities/_iteration_utilities/_iteration_utilities.c:6:10: fatal error: Python.h: No such file or directory
        6 | #include <Python.h>
          |          ^~~~~~~~~~
    compilation terminated.
    error: command '/usr/bin/gcc' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rs92976d/iteration-utilities/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rs92976d/iteration-utilities/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-5obvx4iu/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/dev/.local/include/python3.9/iteration-utilities Check the logs for full command output.
yajo commented 3 years ago

It seems you need to install the python-devel package for some dependencies to compile.

bosd commented 3 years ago

Thanks @Yajo now it installs fine!!

Thanks for the great effort in this project. :tada: I'm excusing op front for my highly opinionated dummy test :sheep:

Edit: Github seems to resize the images, which makes the examples more readable then during my tests.

Guess, this is a feature.. The password field now shows the default as **** image I kinda liked the previous version, when the default pass was readable. (as it enabled to enter trough questions quickly, and read the pass) But with the standard passwords documented somewhere it will do. :) This is now obvious more secure, when someone would be reading your screen.

When first presented with the new list format, I was a bit puzzled. Where are the numbers :) The arrow symbol is rather small. (How did we do this in the DOS era?) image But that's due to the nature of terminal.. (and high res small font display) image From the test, IMO the colored pointing finger has most visibility.

I'm sorry, I still struggle a lot with the multiline yaml with copier. image Maybe just me, but it looks like way more options are presented to me now, as opposed to the copier of doodba which I ran yesterday. cosmetic POV: In the image the blue ^j has no good readability Oops, looks like you got the right dummy to test this :smile: It reads finish with "Alt+Enter".. Being a creature of habit. I pressed "Enter"... and it's gone... :facepalm:

My preferred workflow would be to keep the default example input, and modify it to my needs. Specifically when with each version, the amount of data to put in begins to grow larger. (Would it be possible to crtl+z to undo the deletion?)

Looks like "enter" deletes the default input and is a new line. "Alt+Enter" is used to confirm the entry. I think the description could be more clear: image Is it possible to imitate a text editor? shit+enter for new line, crtl+enter to confirm the input. Let a regular enter do nothing. So dummys like me do not enter trough too quickly on these large input areas, or delete the defaults and have to start over again?

The esc key is mentioned, but does not seem to trigger an action.

Did not complete due to an error. image

yajo commented 3 years ago

Thanks for all your comments 😊

I kinda liked the previous version, when the default pass was readable. (as it enabled to enter trough questions quickly, and read the pass) But with the standard passwords documented somewhere it will do. :) This is now obvious more secure, when someone would be reading your screen.

Well... I'm sorry but this is probably how it's gonna stay 🤷🏼‍♂️

Passwords are supposed to be secure, after all... I know there are always corner cases, but I want to keep a straightforward and predictable behavior.

When first presented with the new list format, I was a bit puzzled. Where are the numbers :)

Questionary actually supports that, but after some testing I found it a bit confusing.

Sometimes, you gotta select a number... let's say a question such as this one.

I find it confusing that I have to type 3 to select the 10 value. I think keyboard navigation is more comfortable and predictable too.

When first presented with the new list format, I was a bit puzzled. Where are the numbers :) The arrow symbol is rather small. (How did we do this in the DOS era?)

It seems like https://github.com/tmbo/questionary/pull/104 would let us pick a different pointer, but it's not released yet. You could ask the questionary staff to make a release, and then we can consider that subject here.

cosmetic POV: In the image the blue ^j has no good readability

Yes, that one is tracked on #297.

It reads finish with "Alt+Enter".. Being a creature of habit. I pressed "Enter"... and it's gone... facepalm

Just hit Backspace to delete your newline, and it should appear again.

My preferred workflow would be to keep the default example input, and modify it to my needs.

These are different things: placeholder is what should be displayed when the value is empty, and it's just a clue to users. default is the default value when the user is asked for the 1st time and didn't provide a value. You should probably use default then.

Specifically when with each version, the amount of data to put in begins to grow larger.

Yep, well that's a problem of the template itself (https://github.com/Tecnativa/doodba-copier-template) which is rather complex. Gotta rethink a bit the questionary itself. Possibly, instead of supplying so much text, there should be proper docs and a link to them, so you can see your term on the left, and github on the right with a cheatsheet for the complex questions.

So, basically, not a copier problem, but a template problem.

(Would it be possible to crtl+z to undo the deletion?) Is it possible to imitate a text editor? shit+enter for new line, crtl+enter to confirm the input.

In terminals, usually that combination will sleep your current job to the background.

When implementing interactive TUI, I was amazed on how hard it is to get proper keybindings, so I'd prefer to just rely on https://github.com/tmbo/questionary for the hard stuff. You could open an issue there for this if you find it important.

Let a regular enter do nothing. So dummys like me do not enter trough too quickly on these large input areas, or delete the defaults and have to start over again?

A regular Enter will enter a newline. This is the expected behavior because you're using a multiline input now.

Consider this: if you don't read it and hit Enter, 2 things could happen:

  1. Enter a newline, so you have to delete it (or not... it will probably not affect a YAML answers, for example).
  2. Send the current answer.

If I have to choose between those 2 unexpected actions, I choose number 1, which is easier to undo.

The esc key is mentioned, but does not seem to trigger an action.

Well, it says actually 'Esc, Enter', which means "Hit Esc, then Enter".

In reality, your terminal interprets any "Esc, something" combination as "Alt+something".

Remember what I said before about crazy keybindings on terms? Well, there you have one.

Do you think it could be rephrased somehow to be better understood?

Did not complete due to an error.

That seems a template bug too, please open an issue there, with proper steps to reproduce.

bosd commented 3 years ago

Thanks for the very detailed feedback. Cool to see that there is so much work done already. Let's see what the new Questionarry brings.

I find it confusing that I have to type 3 to select the 10 value. I think keyboard navigation is more comfortable and predictable too.

That indeed makes more sense.

Well, it says actually 'Esc, Enter', which means "Hit Esc, then Enter".

Just adding the word then, makes it way more clear.

Have been thinking on making the large-amount multi line input easier. It's a tricky one. Having to edit a yaml file outside the copier/questionnary can be acceptable. But it kinda defeats the purpose. Think the cheat sheet approach is the best way forward.

I'm not sure what caused this to fail. Maybe my bad, input or distro problems. Don't think its worth looking into. After this test I used the doodba template on a Debian machine with copier stable successfully. :tada: Will report if I find issues.

yajo commented 3 years ago

Well, it says actually 'Esc, Enter', which means "Hit Esc, then Enter".

Just adding the word then, makes it way more clear.

Please open it on questionary itself, as it comes from https://github.com/tmbo/questionary/blob/11ceb8e270457113eb40ef1603fbd888ef500b5e/questionary/constants.py#L16.

It seems to me that I can close this one then 😃