📚 Personal Library Manager
A dependency-free, command-line manager for your personal book collection. Add, remove, search, browse and track your reading — with automatic, crash-safe persistence to JSON and a human-readable TXT export.
Package names
- PyPI distribution:
personal-library-manager-cli-aui- Python import:
personal_library_manager- CLI command:
personal_library_managerThe distribution name differs because the plain
personal-library-managername is already registered on PyPI by another project. The import package and command are exactly as expected.PyPI: personal-library-manager-cli-aui — v0.1.1 is published. The badges above reflect the live project.
📑 Table of Contents
- Overview
- Features
- Installation
- Quick Start
- CLI Usage
- Where Your Data Lives
- Data Format
- Python API
- Project Structure
- Development Setup
- Testing
- Building Distributions
- Publishing (Maintainers)
- Compatibility
- Contributing
- Links
- License
- Author
✨ Overview
Personal Library Manager stores each book with its title, author, publication year, genre and read status, then lets you search, filter, and measure your reading progress from a simple numbered menu.
The project uses only the Python Standard Library, so installation is fast and there is nothing to compile. User data is written outside the installed package to a per-user data directory, which means your library survives upgrades and works on Windows, macOS and Linux.
🚀 Features
| Feature | Description |
|---|---|
| ➕ Add books | Store title, author, year, genre and read status |
| 🗑️ Remove books | Delete by title using case-insensitive matching |
| 🔎 Search | Case-insensitive substring search by title or author |
| 📖 Browse | Numbered, formatted list of every book |
| 📊 Statistics | Total books, books read, unread and completion percentage |
| 💾 Dual persistence | Writes library.json (data) and library.txt (readable export) |
| 🛡️ Crash-safe saves | Atomic writes via temporary file + rename |
| 🔁 Corrupt-file recovery | Broken JSON is backed up, never silently deleted |
| 📦 Legacy migration | Imports an existing library.json from the working directory |
| ✅ Validation | Rejects empty fields, non-numeric or non-positive years |
| 🧪 Tested | 98 automated tests covering models, storage, CLI and packaging |
| 🪶 Zero runtime dependencies | Standard library only |
📦 Installation
Requires Python 3.9 or newer.
From PyPI
The current release is 0.1.1:
pip install personal-library-manager-cli-aui
Isolated install with pipx
pipx install personal-library-manager-cli-aui
From source
git clone https://github.com/afaqulislam/personal_library_manager.git
cd personal_library_manager
python -m pip install .
For development (editable install with test tooling):
python -m pip install -e ".[dev]"
▶️ Quick Start
personal_library_manager
You can also run the module directly:
python -m personal_library_manager
Choose a custom data directory (useful for testing):
personal_library_manager --data-dir ./my-library
Check the installed version:
personal_library_manager --version
🖥️ CLI Usage
📚 Welcome to your Personal Library Manager!
1. Add a book
2. Remove a book
3. Search for a book
4. Display all books
5. Display statistics
6. Exit
Enter your choice: 1
Enter the book title: Atomic Habits
Enter the author: James Clear
Enter the publication year: 2018
Enter the genre: Self-Help
Have you read this book? (yes/no): yes
✅ 'Atomic Habits' added successfully!
Enter your choice: 4
📚 Your Library:
1. Atomic Habits by James Clear (2018) - Self-Help - ✅ Read
Enter your choice: 5
📊 Library Statistics:
📚 Total books: 1
✅ Books read: 1
📖 Percentage read: 100.00%
Enter your choice: 6
💾 Library saved to:
• C:\Users\<you>\AppData\Roaming\personal-library-manager\library.json
• C:\Users\<you>\AppData\Roaming\personal-library-manager\library.txt
📌 Exiting... Goodbye!
Menu reference
| Option | Action | Notes |
|---|---|---|
1 |
Add a book | All fields required; year must be digits; yes/y/true/1 = read |
2 |
Remove a book | First case-insensitive title match |
3 |
Search | Substring match by title or author |
4 |
Display all books | Numbered list with read status |
5 |
Statistics | Totals and percentage read |
6 |
Exit | Saves before exiting |
Saving behavior
- The library is saved when you choose
6(Exit). - It is also saved if you press Ctrl+C or close standard input, so work is not lost.
- Saves are atomic: data is written to a temporary file and then renamed.
Command-line options
| Option | Description |
|---|---|
--data-dir PATH |
Store library.json/library.txt in PATH |
--version |
Print the version and exit |
--help |
Show help and exit |
🗂️ Where Your Data Lives
User data is stored in a per-user directory, not inside the installed package:
| Platform | Default location |
|---|---|
| Windows | %APPDATA%\personal-library-manager\ |
| macOS | ~/Library/Application Support/personal-library-manager/ |
| Linux | $XDG_DATA_HOME/personal-library-manager/ (defaults to ~/.local/share/personal-library-manager/) |
Override the location with:
# environment variable
PERSONAL_LIBRARY_MANAGER_HOME=/path/to/data personal_library_manager
# or the command-line flag
personal_library_manager --data-dir /path/to/data
Legacy data: if no library exists yet and a valid library.json is present in the current working directory, it is imported automatically on first run.
🗃️ Data Format
library.json
[
{
"title": "Atomic Habits",
"author": "James Clear",
"year": 2018,
"genre": "Self-Help",
"read": true
}
]
| Key | Type | Description |
|---|---|---|
title |
string | Book title |
author |
string | Author name |
year |
integer | Positive publication year |
genre |
string | Genre / category |
read |
boolean | true = read, false = unread |
Invalid entries are skipped with a warning, and a corrupted file is renamed to library.json.corrupt-<timestamp> before the app starts with an empty library.
library.txt
Regenerated on every save:
Title: Atomic Habits | Author: James Clear | Year: 2018 | Genre: Self-Help | Read: Yes
🐍 Python API
The package can be used as a library:
from personal_library_manager import Book, Library
library = Library() # default user data directory
# library = Library(data_dir="./my-library") # or a custom directory
library.add_book("Atomic Habits", "James Clear", 2018, "Self-Help", read=True)
library.add(Book("Deep Work", "Cal Newport", 2016, "Productivity", False))
print(len(library)) # 2
print(library.statistics())
# {'total': 2, 'read': 1, 'unread': 1, 'percentage': 50.0}
for book in library.search("clear", field="author"):
print(book.describe())
removed = library.remove_book("deep work") # case-insensitive
json_path, text_path = library.save()
print(json_path, text_path)
Public classes and methods
| API | Description |
|---|---|
Book(title, author, year, genre, read=False) |
Validated book model; to_dict(), from_dict(), describe() |
Library(data_dir=None) |
Loads existing data by default |
Library.add_book(...) |
Add and return a Book |
Library.add(book) |
Add a Book instance |
Library.remove_book(title) |
Remove first match; returns Book or None |
Library.search(keyword, field="title") |
field is "title" or "author" |
Library.statistics() |
Totals and percentage |
Library.save() |
Write JSON + TXT atomically; returns paths |
Library.load() |
Reload from disk; returns count |
Library.export_text() |
TXT representation as a string |
len(library) / library.books / iteration |
Collection access |
Invalid input raises ValueError with a descriptive message.
📁 Project Structure
personal_library_manager/
├── src/
│ └── personal_library_manager/
│ ├── __init__.py # Public API and version
│ ├── __main__.py # python -m personal_library_manager
│ ├── cli.py # Menu loop, prompts, argparse entry point
│ ├── library.py # Collection logic + persistence
│ ├── models.py # Book model and validation
│ └── paths.py # Cross-platform data directory
├── tests/
│ ├── conftest.py
│ ├── test_cli.py
│ ├── test_library.py
│ ├── test_models.py
│ ├── test_package.py
│ └── test_storage.py
├── .github/workflows/ # CI and publishing workflows
├── CHANGELOG.md
├── LICENSE
├── MANIFEST.in
├── pyproject.toml
└── README.md
🛠️ Development Setup
git clone https://github.com/afaqulislam/personal_library_manager.git
cd personal_library_manager
python -m venv .venv
# Windows
.venv\Scripts\activate
# macOS / Linux
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"
🧪 Testing
The suite uses pytest and covers the data model, collection operations, JSON/TXT persistence, disaster recovery, the interactive CLI, module execution and installed metadata.
python -m pytest
Useful variants:
python -m pytest -q # quiet
python -m pytest tests/test_cli.py # one module
python -m pytest -k storage # keyword match
📦 Building Distributions
python -m pip install build twine
python -m build
python -m twine check dist/*
This produces:
dist/personal_library_manager_cli_aui-0.1.1-py3-none-any.whldist/personal_library_manager_cli_aui-0.1.1.tar.gz
Verify an artifact in a clean environment:
python -m venv /tmp/verify
/tmp/verify/bin/pip install dist/personal_library_manager_cli_aui-0.1.1-py3-none-any.whl
/tmp/verify/bin/personal_library_manager --version
🚢 Publishing (Maintainers)
Status: v0.1.1 is published on PyPI. Future releases require explicit approval.
Option A — Trusted Publishing via GitHub Actions (recommended)
Workflows are included:
.github/workflows/publish-testpypi.yml— manual TestPyPI publish.github/workflows/publish-pypi.yml— publish on a GitHub Release
One-time setup on PyPI / TestPyPI → Your projects → Publishing → Add a pending publisher:
| Field | TestPyPI | PyPI |
|---|---|---|
| PyPI project name | personal-library-manager-cli-aui |
personal-library-manager-cli-aui |
| Owner | afaqulislam |
afaqulislam |
| Repository | personal_library_manager |
personal_library_manager |
| Workflow name | publish-testpypi.yml |
publish-pypi.yml |
| Environment | testpypi |
pypi |
No API tokens are stored in the repository; the workflows use OIDC.
After that:
- Go to Actions → Publish to TestPyPI → Run workflow to validate.
- Create a GitHub Release with a new tag (for example,
vX.Y.Z) to publish that version to PyPI.
Option B — Manual upload
TestPyPI:
python -m build
python -m twine upload --repository testpypi dist/*
Official PyPI:
python -m twine upload dist/*
When prompted, use __token__ as the username and your API token as the password. Never commit tokens.
🧩 Compatibility
- Python: 3.9, 3.10, 3.11, 3.12, 3.13
- Operating systems: Windows, macOS, Linux
- Runtime dependencies: none
- Development dependencies:
pytest,ruff,build,twine
🤝 Contributing
- Fork the repository.
- Create a branch:
git checkout -b feature/short-description. - Make your change and add or update tests.
- Run
python -m pytestand confirm everything passes. - Commit with a clear message.
- Push the branch and open a Pull Request.
Please keep the package free of runtime dependencies unless there is a strong justification.
🔗 Links
- PyPI: personal-library-manager-cli-aui
- GitHub: afaqulislam/personal_library_manager
- Issues: Report a bug or request a feature
- Releases: Release history
- Changelog: CHANGELOG.md
📜 License
Released under the MIT License. See LICENSE.
👨💻 Author
Afaq Ul Islam
- GitHub: @afaqulislam
- LinkedIn: in/afaqulislam
- Portfolio: afaqulislam.github.io
- Email: afaqulislam707@gmail.com
⭐ If this project helps you, consider starring the repository.
Metadata
Release files for personal-library-manager-cli-aui 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| personal_library_manager_cli_aui-0.1.1.tar.gz | 26.1 kB | With provenance | Details for personal_library_manager_cli_aui-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| personal_library_manager_cli_aui-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for personal_library_manager_cli_aui-0.1.1-py3-none-any.whl |
Total release size: 42.7 kB
Release files / personal_library_manager_cli_aui-0.1.1.tar.gz
| Download URL | personal_library_manager_cli_aui-0.1.1.tar.gz |
|---|---|
| Size | 26.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
45bd5b7b71265daea617dff12c02a32cc8ee90794e92f3bb32631739b54c5b8f
|
|
BLAKE2b-256 checksum How to use checksums |
c4d982b6ca398ec411306117f734f63a93f17b0310f8d1be3c56cd713bb0f837
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logRelease files / personal_library_manager_cli_aui-0.1.1-py3-none-any.whl
| Download URL | personal_library_manager_cli_aui-0.1.1-py3-none-any.whl |
|---|---|
| Size | 16.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5110a66911825c8129bf777fa00d87e959d9ab9ea882e28711d886ce572314cc
|
|
BLAKE2b-256 checksum How to use checksums |
e0270e6a8b0838b879c2a940b06014cfcd9baa2a19c1108b13e90ac0d743a520
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logSecurity for personal-library-manager-cli-aui 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for personal_library_manager_cli_aui-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.