A command-line tool to track books read
Project description
Libro
📚 Libro: A simple command-line tool to track your reading history, with your data stored locally in a SQLite database.
Usage
Add new book: libro add
Show books read by year: libro show --year 2024
Show book details by id: libro show 123
Show books read by year: libro report
Show books read by author: libro report --author
Install
Libro is packaged as libro-book on PyPI.
pip install libro-book
You can also clone this repository and install it locally:
git clone https://github.com/mkaz/libro.git
cd libro
pip install -e .
Setup
On first run, libro will create a libro.db database file based on database location. It will prompt for confirmation to proceed which also shows the location where the file will be created.
Database locations:
The following order is used to determine the database location:
-
Using the
--dbflag on command-line. -
libro.dbin current directory -
Environment variable
LIBRO_DBto specify custom file/location -
Finally, the user's platform-specific data directory
- Linux:
~/.local/share/libro/libro.db - macOS:
~/Library/Application Support/libro/libro.db - Windows:
%APPDATA%\libro\libro.db
- Linux:
For example, if you want to create a new database file in the current directory, you can use the following command:
libro --db ./libro.db
Import from Goodreads
Libro can import your reading history from a Goodreads export CSV file.
libro import goodreads_library_export.csv
There is a genre field for fiction and nonfiction, but this data is not available in the Goodreads export. I still need to build the edit book functionality to change the genre.
Database Schema
Books table
| Field | Type | Description |
|---|---|---|
| id | primary key | Unique identifier |
| title | string | Book title |
| author | string | Book author |
| pages | int | Number of pages in book |
| pub_year | int | Year book was published |
| genre | string | Fiction or nonfiction |
Reviews table
| Field | Type | Description |
|---|---|---|
| id | primary key | Unique identifier |
| book_id | foreign key | Book identifier |
| date_read | date | Date book was read |
| rating | float | Number between 0 and 5 |
| review | text | Review of book |
Packaging
Notes to self, I forget how to do this stuff.
Libro is packaged as libro-book on PyPI.
Packaging is done with hatchling, see Guide
# install tools
py -m pip install --upgrade build twine
# build
py -m build
# upload
py -m twine upload dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file libro_book-0.1.0.tar.gz.
File metadata
- Download URL: libro_book-0.1.0.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79c800cac1e9156c60cbcbadf2798a63124ccef0444c3215e8add2144cf6f68c
|
|
| MD5 |
4fdb1ac72486cee67b485425350677f0
|
|
| BLAKE2b-256 |
b5cf6d9042c6b45a8a5324968b261d93ac7d697c765338218d4e902425951399
|
File details
Details for the file libro_book-0.1.0-py3-none-any.whl.
File metadata
- Download URL: libro_book-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c8ea0d7553901bf71f445361ae217853ad4d2422f2888444f83aa27997099ed
|
|
| MD5 |
283ab90a4282c63e5d5220238a82a9a9
|
|
| BLAKE2b-256 |
5a1e92b91382d3a881658c9958b52862aead38212de31598fd399475d180e2a5
|