Package: maskpass
MaskpassMaskpass is a Python library like getpass but with advanced features like masking and reveal/un-reveal.It also works in Spyder IDEInstallationUse the package managerpipto installmaskpass.pipinstallmaskpassIt is currently recommended to enforce a version if you have plans to use it in a project, since backward incompatible changes may occur.UsageThis module contains functions askpass() and advpass()askpass() uses msvcrt.getch() in windows and altenatives in *nix OS, but it doesn't work in Spyder.importmaskpasspassword=maskpass.askpass()The function returns the entered password in string formatAccepts 2 optional arguments prompt and mask.Default for prompt isEnter password:.  Default for mask is*.Usemask=""for not echoing anything into the terminal. (Like entering sudo passwords in *nix)Using advpass()advpass() usespynputto get the password, and it works in Spyder too!importmaskpasspassword=maskpass.advpass()The function returns the entered password in string format.Accepts 4 optional arguments prompt, mask, ide and suppress.prompt is the string to be printed. Default for prompt isEnter password:.mask is the masking character to be used, can be an empty string"", single or multi length character. Default for mask is*.ide expects a bool, it is for overriding IDE check, and has default False. Usually there is no need to change this, since it's automatically checked whether it's running on IDE or terminal.  Default isFalse.suppress expects a bool, is used only in Spyder/QTConsole. Setting this to True prevents the input from being passed to the rest of the system. Seepynput documentationfor more info. This prevents the Spyder console from jumping down when spacebar is pressed. Default isTrue.advpass()also has a revealing feature which will toggle the visibility of the entered password whenLeft CTRLis pressed. Press it again to change back the visibility.Note: Only works withadvpass()and needspynputExceptions and other returnsIn both askpass and advpass, pressingCtrl+Craise the usualKeyboardInterrupt.Also, pressingEscapein both functions stops the input and returns an empty string"".ScreenshotsNormal askpassadvpass in Spyderadvpass in terminalContributingPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.IssuesThere is an issue in Spyder where pressing and holding the backspace key yields unpredictable result. This only happens when the key is held down and only in Spyder. Only workaround right now is to backspace letter by letter and not hold it down.Holding down backspace in advpass in SpyderCurrently I have only tested it in Windows 10, Manjaro and Parrot, so I'm not sure it works in macOS.This will not work in Jupyter Notebook correctly. Haven't tested it in PyCharm yet, so it might work.TipsIn some platforms, namely Termux in Android, maskpass does not get installed because pynput cannot install in that. In those platform (or in cases where you don't need advpass), if you would like to use only askpass, just copy both/maskpass/input_methods/without_pynput.pyand/maskpass/input_methods/cross_getchto your desired location and you can use askpass usingfrom without_pynput import askpassLicenseMIT License