I'm developing a multi-platform python script that requires input from the user. We wanted a hidden password input that allows seeing *** as the user types and also allows clipboard paste
(cmd+v / ctrl+v) functionality. Thus stdiomask is out of the picture. We implemented a custom function which uses getch().
Getch is not available on Windows, so instead if the os is windows, use msvcrt
if os.name == "posix":
from getch import getch
g = True
elif os.name == "nt":
import msvcrt
g = False
And in the custom function
...
while True:
if g:
ch = getch().encode()
else:
ch = msvcrt.getch().encode()
...
This also means that Unix os users will need to install getch and windows users will only be using the inbuild msvcrt. Since I use a requirements.txt to install also the dependencies, is there a way to inject code after just running *pip install requirements.txt and starting to install the requirements themselves, instead of having two requirements files?