Skip to main content

mukimov

A tiny cross-platform Python library for masked password input in the terminal.

PyPI version Python versions License: MIT Platform

Developed by Mukimov Studio

What is mukimov?

mukimov lets you read a password or any other secret text in the terminal while showing a mask character instead of the real keystrokes.

For example, the user really types:

123456

but the terminal shows:

Password: ******

And the function returns the real text "123456".

Important: this is NOT hashing and NOT encryption. The library only visually hides input from people who may be looking at the screen. The real password is still returned to your program as a plain string.

Installation

pip install mukimov

Upgrade to the latest version:

pip install --upgrade mukimov

Check the installed version:

pip show mukimov

Quick Start

The simplest possible example:

from mukimov import stars

password = stars("Password: ")

What the user sees:

Password: ******

If the user typed 123456, the variable password contains:

"123456"

Custom Mask ✨

The second argument controls which character is shown for every typed symbol:

stars("Password: ", "*")  # Password: ******
stars("Password: ", "/")  # Password: //////
stars("Password: ", "#")  # Password: ######
stars("Password: ", "•")  # Password: ••••••

API:

stars(prompt, mask="*")
Parameter Type Description
prompt str Text displayed before input.
mask str Character shown instead of each typed symbol. Defaults to "*".

Important: mask must contain exactly ONE character.

Full Example

A realistic login prompt:

from mukimov import stars

username = input("Username: ")
password = stars("Password: ")

print(f"Welcome, {username}!")

Example terminal session:

Username: Mukimov
Password: ********
Welcome, Mukimov!

Note that the real password is never printed — only the mask is shown.

Errors

mukimov raises clear, descriptive errors in Russian. Each message tells you which parameter is wrong, what value was passed, why it is wrong, what was expected, and shows a correct example.

Wrong usage:

stars("Password: ", "//")

Error:

ValueError: Параметр mask='//' содержит 2 символа. Допускается только 1 символ.
Пример: stars("Password: ", "*")

More examples (real messages from the library):

stars("Password: ", "")
ValueError: Параметр mask='' пустой. Укажите ровно 1 символ для маскировки.
Пример: stars("Password: ", "*")
stars("Password: ", 123)
TypeError: Параметр mask должен быть строкой (str), но получен int: 123.
Пример: stars("Password: ", "*")
stars(123)
TypeError: Параметр prompt должен быть строкой (str), но получен int: 123.
Пример: stars("Password: ")

Platform Support

Only systems actually supported by the current code are listed:

OS Backend
Windows msvcrt
Linux termios / tty
macOS termios / tty

The library uses only the Python standard library — no third-party dependencies. When standard input is not a TTY (pipes, IDE consoles, CI), it safely falls back to getpass with no echo.

Extra behavior worth knowing:

  • Backspace deletes the last mask character and the last symbol.
  • Enter finishes input.
  • Ctrl+C raises KeyboardInterrupt, Ctrl+D on empty input raises EOFError.

Why mukimov?

The goal of mukimov is a simple, short API for masked terminal input.

mukimov:

from mukimov import stars

password = stars("Password: ", "•")

And the standard-library alternative, where your Python version supports echo_char:

from getpass import getpass

password = getpass("Password: ", echo_char="•")

If you like the classic getpass, keep using it — mukimov is just a compact option when you want per-character masking with a tiny API.

Security 🔒

mukimov hides the password only visually, while it is being typed.

It does NOT:

  • hash the password
  • encrypt the password
  • store the password securely by itself
  • protect the process from malware
  • protect the contents of the process memory

After input, the function returns the real password as a regular Python string. To store passwords, developers must separately use a reliable password-hashing solution.

Also, error messages and logs of this library never include the typed password — only configuration values (prompt, mask) may appear in validation errors.

API

stars(prompt="Password: ", mask="*")

Parameters:

  • prompt: str — text displayed before input.
  • mask: str — exactly one character shown instead of each typed symbol.

Returns:

  • str — the real text the user typed.

Exceptions:

  • TypeError — prompt or mask is not a string.
  • ValueError — mask is empty or longer than one character.

Project

Release files for mukimov 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mukimov 0.1.3
File Size Uploaded
mukimov-0.1.3.tar.gz 9.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mukimov 0.1.3
File Interpreter ABI Platform
mukimov-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 16.4 kB

Release files / mukimov-0.1.3.tar.gz

Download URL mukimov-0.1.3.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9bd72e476ff721cd4a76592b88123fd5583ce645968de5be1fbca0bc8c8aa328
BLAKE2b-256 checksum
How to use checksums
e9f43d582df277a81200617e1b3b1545f526937f93a3e39cba3116b153062444
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / mukimov-0.1.3-py3-none-any.whl

Download URL mukimov-0.1.3-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
176210fb99b5924fa2486d8a02d2f18ab14fac4b1a02f416000efbab3a0203b2
BLAKE2b-256 checksum
How to use checksums
d006fb9a81ef5894f122fe00a9d177d6ea7beb23481f0128ee4e4765b0efb2b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

0.1.5

2 release files

0.1.4

2 release files

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page