Overview
A menu-driven command-line program that manages a small library catalogue. It keeps a list of books, lets a user add, search, borrow and return them, and saves everything to a JSON file so the data is still there the next time the program runs.
Screenshots
Problem addressed
A library needs to know which books it owns and who has which one. The program tracks that state per book, and it has to keep the saved file usable even when the file is missing, empty or damaged.
Verified features (from the source code)
- Six menu options: view the catalogue, add a book, search, check a book out, check a book in, and shut down.
- Each book records title, author, ISBN, whether it is borrowed, the borrower’s name and the date and time it was taken.
- ISBNs are normalised (trimmed and lower-cased) before use, so the same ISBN typed with different spacing or case is rejected as a duplicate.
- Search matches part of a title or author, ignoring case.
- Checking out a book stamps the borrower and the time; the program refuses to lend a book that is already out or does not exist, and warns when a book that is already on the shelf is returned.
- Empty inputs are refused at the menu before anything is changed.
- Every change is saved straight away to library_data.json.
Technologies
Python 3 with the standard library only (json, os and datetime). Two classes: Book holds one record and can turn itself into a dictionary for saving; Library owns the catalogue, the saving and loading, and the borrowing rules.
Technical challenges documented in the code
- Empty or damaged save files: the loader treats a missing or empty file as an empty library, and catches unreadable or malformed JSON and permission errors with a warning instead of crashing.
- Missing fields: records are read with default values, so a book with a missing field loads as “Unknown Title” or similar instead of raising a KeyError.
- Type leakage from JSON: the borrowed flag is cast to a boolean when a Book is created.
- Save failures: file errors while saving are caught and reported to the user.
Known limits (from reading the code)
- If the saved file cannot be read, the program starts with an empty library, and the next change would then overwrite that file. A backup step is not included.
- Saving rewrites the whole file in one step, so a crash in the middle of a save could leave a damaged file.
- A file whose top level is not an object (for example a list) is not covered by the error handling and would stop the program.
- Casting with bool() turns any non-empty text, including “false”, into True, so a hand-edited file with that text would load a book as borrowed.
- There is no way to edit or delete a book, and no due dates or fines.
Status and evidence
In progress: not yet deployed. These details come from reading the program’s source code; no automated tests or run records are published for it.


