A small, educational command‑line password manager built to practice Python fundamentals, software design, and a disciplined Git workflow. This project is for learning—the initial versions store secrets in plaintext. Do not use for real credentials until encryption is added.
This project is a practical lab for becoming a stronger Python/Backend/AI‑automation engineer. It exercises:
- Python basics → functions, modules, and packages
- Clean CLI design with
argparse - File persistence with JSON (then encryption later)
- Error handling and custom exceptions
- OOP refactor into a
PasswordManagerclass - Git branching and tidy commits
MVP v0.1
startplaceholder command (sanity check)add→ store a credential (service, username, password) in a JSON fileget→ retrieve one or more credentials by servicelist→ show all saved entries- JSON persistence with atomic writes
- Friendly error messages for missing/corrupt DB
Planned next steps
- OOP refactor (
PasswordManagerwith methods:add,retrieve,list) - Optional DB path flag (
--db-path) - Basic encryption layer (key management TBD)
- Tests (pytest) and linting (ruff/black)
- Language: Python 3.11+
- Standard Library:
argparse,pathlib,json,typing,sys,getpass - Dev Environment: PyCharm or VS Code,
venv, Git, GitHub - OS: macOS (but code is cross‑platform)
- Write small, composable modules
- Design a user‑friendly CLI using subcommands
- Persist data safely and handle edge cases
- Use exceptions for clear failure modes
- Practice clean Git habits (branches, focused commits, readable messages)
password-manager/
├─ password_manager.py # CLI entrypoint (argparse + subcommands)
├─ storage.py # JSON persistence helpers (load/save/add/query)
├─ passwords.json # Data file (created on first save)
├─ README.md # This file
└─ .gitignore
Later:
password-manager/
├─ password_manager/
│ ├─ __init__.py
│ ├─ cli.py # CLI wiring
│ ├─ core.py # PasswordManager class
│ ├─ storage.py # Persistence strategies
│ └─ crypto.py # Encryption (future)
└─ tests/
{
"entries": [
{ "service": "github", "username": "alice@example.com", "password": "plain-for-now" }
]
}Notes:
- Top‑level
entrieslist keeps schema flexible (easy to add fields later) - Atomic writes via temp file → replace, to avoid corruption
Usage examples:
# Start / hello‑world check
python password_manager.py --start
# Add a credential (plaintext for MVP)
python password_manager.py add --service github --username you@example.com --password secret
# Retrieve by service (may return multiple)
python password_manager.py get --service github
# List everything
python password_manager.py listPlanned flags:
--db-path PATH→ optional alternate DB location--format json|table→ output formatting (later)
Requirements
- Python 3.11+
- Git
Create and activate a virtual environment
python -m venv .venv
source .venv/bin/activate # macOS/Linux
# .venv\Scripts\activate # WindowsInstall dependencies
MVP uses only the standard library. When encryption is added: pip install cryptography.
Run
python password_manager.py --startInitialize Git & push
git init
git add .
git commit -m "Initial commit: basic CLI setup"
git branch -M main
git remote add origin https://github.com/<you>/cli-password-manager.git
git push -u origin mainBranching model (simple)
main→ stable, working- Feature branches →
feat/subcommands,feat/encryption,fix/corrupt-json
Commit message style
- Imperative, focused:
Add JSON storage helpers,Handle corrupt DB gracefully
- Graceful first‑run: missing file returns empty DB
- Corrupt JSON → warn, fall back to empty; never crash the CLI
- I/O issues → raise
StorageErrorwith actionable message
- MVP stores passwords in plaintext (educational only). Do not use real credentials.
- Encryption will be added in a later milestone. Even then, treat this as a learning tool, not a production vault.
- CLI bootstrap with
argparse(done) - JSON persistence (load/save/add/query)
- Error handling & custom exceptions
- Subcommands wired to storage
- OOP refactor (
PasswordManager) - Git branching exercise
- Basic encryption & README polish
MIT
Inspired by project‑driven learning and Python’s excellent standard library. This repo exists to build engineering instincts through repetition and iteration.