readchar-readpass 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Shuraim Ibrahim Khan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,76 @@
1
+ Metadata-Version: 2.4
2
+ Name: readchar-readpass
3
+ Version: 0.1.0
4
+ Summary: A password reader.
5
+ Project-URL: Homepage, https://github.com/Uchihashuraim/getpassword
6
+ Author-email: Shuraim Ibrahim Khan <Uchihashuraim@gmail.com>
7
+ License-File: LICENSE
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Classifier: Programming Language :: Python :: 3
11
+ Requires-Python: >=3.8
12
+ Requires-Dist: readchar>=4.2.0
13
+ Description-Content-Type: text/markdown
14
+
15
+ # getpassword
16
+
17
+ A small Python utility for reading masked password input from the terminal.
18
+
19
+ This project provides a simple `get_password()` helper that accepts user input one character at a time, prints `*` for each keystroke, and supports backspace editing.
20
+
21
+ ## Features
22
+
23
+ - Reads a password from the terminal without showing the raw characters
24
+ - Displays `*` for each character typed
25
+ - Supports backspace to correct mistakes
26
+ - Minimal dependency footprint
27
+
28
+ ## Installation
29
+
30
+ This project includes packaging metadata in `pyproject.toml`, so it can be installed with:
31
+
32
+ ```bash
33
+ pip install getpassword
34
+ ```
35
+
36
+ For local development from the repository, install in editable mode:
37
+
38
+ ```bash
39
+ python -m pip install -e .
40
+ ```
41
+
42
+ If you prefer a normal local install:
43
+
44
+ ```bash
45
+ python -m pip install .
46
+ ```
47
+
48
+ The package dependency `readchar` will be installed automatically.
49
+
50
+ ## Usage
51
+
52
+ ```python
53
+ from getpassword import get_password
54
+
55
+ password = get_password("Password: ")
56
+ print("You entered", password)
57
+ ```
58
+
59
+ You can also run the script directly from the repository:
60
+
61
+ ```bash
62
+ python src/getpassword/getpassword.py
63
+ ```
64
+
65
+ ## Project structure
66
+
67
+ - `src/getpassword/getpassword.py` - core password input implementation
68
+ - `src/getpassword/__init__.py` - package entrypoint exposing `get_password`
69
+
70
+ ## Dependency
71
+
72
+ - `readchar`
73
+
74
+ ## Notes
75
+
76
+ This package is intended for simple console-based password entry. It does not provide advanced terminal handling or cross-platform terminal abstraction beyond the `readchar` dependency.
@@ -0,0 +1,62 @@
1
+ # getpassword
2
+
3
+ A small Python utility for reading masked password input from the terminal.
4
+
5
+ This project provides a simple `get_password()` helper that accepts user input one character at a time, prints `*` for each keystroke, and supports backspace editing.
6
+
7
+ ## Features
8
+
9
+ - Reads a password from the terminal without showing the raw characters
10
+ - Displays `*` for each character typed
11
+ - Supports backspace to correct mistakes
12
+ - Minimal dependency footprint
13
+
14
+ ## Installation
15
+
16
+ This project includes packaging metadata in `pyproject.toml`, so it can be installed with:
17
+
18
+ ```bash
19
+ pip install getpassword
20
+ ```
21
+
22
+ For local development from the repository, install in editable mode:
23
+
24
+ ```bash
25
+ python -m pip install -e .
26
+ ```
27
+
28
+ If you prefer a normal local install:
29
+
30
+ ```bash
31
+ python -m pip install .
32
+ ```
33
+
34
+ The package dependency `readchar` will be installed automatically.
35
+
36
+ ## Usage
37
+
38
+ ```python
39
+ from getpassword import get_password
40
+
41
+ password = get_password("Password: ")
42
+ print("You entered", password)
43
+ ```
44
+
45
+ You can also run the script directly from the repository:
46
+
47
+ ```bash
48
+ python src/getpassword/getpassword.py
49
+ ```
50
+
51
+ ## Project structure
52
+
53
+ - `src/getpassword/getpassword.py` - core password input implementation
54
+ - `src/getpassword/__init__.py` - package entrypoint exposing `get_password`
55
+
56
+ ## Dependency
57
+
58
+ - `readchar`
59
+
60
+ ## Notes
61
+
62
+ This package is intended for simple console-based password entry. It does not provide advanced terminal handling or cross-platform terminal abstraction beyond the `readchar` dependency.
@@ -0,0 +1,25 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "readchar-readpass"
7
+ version = "0.1.0"
8
+ description = "A password reader."
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ authors = [
12
+ { name="Shuraim Ibrahim Khan", email="Uchihashuraim@gmail.com" },
13
+ ]
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: OS Independent",
18
+ ]
19
+
20
+ dependencies = [
21
+ "readchar>=4.2.0",
22
+ ]
23
+
24
+ [project.urls]
25
+ Homepage = "https://github.com/Uchihashuraim/getpassword"
@@ -0,0 +1,22 @@
1
+ """getpassword package.
2
+
3
+ This package exposes a simple helper for obtaining a password from the
4
+ user without echoing it to the terminal. It instead echos a '*' character for each character typed, and allows the user to use backspace to correct mistakes.
5
+ """
6
+
7
+ from getpassword import getpass
8
+
9
+ __all__ = ["get_password", "__version__"]
10
+ __version__ = "0.1.0"
11
+
12
+
13
+ def get_password(prompt: str = "Password: ") -> str:
14
+ """Read a password from stdin without echoing it.
15
+
16
+ Args:
17
+ prompt: The prompt text shown to the user.
18
+
19
+ Returns:
20
+ The entered password string.
21
+ """
22
+ return getpass(prompt)
@@ -0,0 +1,20 @@
1
+ import readchar
2
+
3
+ def getpass():
4
+ password = ""
5
+ while True:
6
+ char = readchar.readchar()
7
+ if char == '\r':
8
+ break
9
+ elif char == '\b':
10
+ password = password[:-1]
11
+ print('\b \b', end='', flush=True)
12
+ else:
13
+ password += char
14
+ print('*', end='', flush=True)
15
+ return password
16
+
17
+ if __name__ == "__main__":
18
+ print("Enter your password: ", end='', flush=True)
19
+ password = getpass()
20
+ print("\nYour password is:", password)