Skip to main content

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

Examples

Books Read in Year

                                              Books Read in 2025
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ id         โ”ƒ Title                                           โ”ƒ Author               โ”ƒ Rating โ”ƒ Date Read    โ”ƒ
โ”กโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
โ”‚ Fiction    โ”‚                                                 โ”‚                      โ”‚        โ”‚              โ”‚
โ”‚ 1          โ”‚ Cujo                                            โ”‚ Stephen King         โ”‚ 3      โ”‚ Jan 05, 2025 โ”‚
โ”‚ 585        โ”‚ The Midnight Library                            โ”‚ Matt Haig            โ”‚ 5      โ”‚ Jan 13, 2025 โ”‚
โ”‚ 587        โ”‚ The Maid                                        โ”‚ Nita Prose           โ”‚ 4      โ”‚ Jan 20, 2025 โ”‚
โ”‚ 589        โ”‚ Into the Water                                  โ”‚ Paula Hawkins        โ”‚ 2      โ”‚ Feb 02, 2025 โ”‚
โ”‚ 591        โ”‚ My Grandmother Asked Me to Tell You She's Sorry โ”‚ Fredrik Backman      โ”‚ 3      โ”‚ Feb 15, 2025 โ”‚
โ”‚ 584        โ”‚ Salem's Lot                                     โ”‚ Stephen King         โ”‚ 3      โ”‚ Mar 12, 2025 โ”‚
โ”‚ 595        โ”‚ The Thursday Murder Club                        โ”‚ Richard Osman        โ”‚ 3.5    โ”‚ Mar 20, 2025 โ”‚
โ”‚ 596        โ”‚ Remarkably Bright Creatures                     โ”‚ Shelby Van Pelt      โ”‚ 5      โ”‚ Mar 27, 2025 โ”‚
โ”‚ 598        โ”‚ Colorless Tsukuru Tazaki                        โ”‚ Haruki Murakami      โ”‚ 3      โ”‚ Apr 09, 2025 โ”‚
โ”‚ 599        โ”‚ Ten                                             โ”‚ Gretchen McNeil      โ”‚ 3      โ”‚ Apr 16, 2025 โ”‚
โ”‚            โ”‚                                                 โ”‚                      โ”‚        โ”‚              โ”‚
โ”‚ Nonfiction โ”‚                                                 โ”‚                      โ”‚        โ”‚              โ”‚
โ”‚ 586        โ”‚ The Art Thief                                   โ”‚ Michael Finkel       โ”‚ 4      โ”‚ Jan 14, 2025 โ”‚
โ”‚ 588        โ”‚ All the Pieces Matter                           โ”‚ Jonathan Abrams      โ”‚ 3      โ”‚ Jan 27, 2025 โ”‚
โ”‚ 590        โ”‚ Supercommunicators                              โ”‚ Charles Duhigg       โ”‚ 4      โ”‚ Feb 04, 2025 โ”‚
โ”‚ 592        โ”‚ HBR Guide to Generative AI for Managers         โ”‚ Elisa Farri          โ”‚ 4      โ”‚ Feb 16, 2025 โ”‚
โ”‚ 593        โ”‚ Leonardo da Vinci                               โ”‚ Walter Isaacson      โ”‚ 3      โ”‚ Mar 02, 2025 โ”‚
โ”‚ 594        โ”‚ The Leap to Leader                              โ”‚ Adam Bryant          โ”‚ 3      โ”‚ Mar 08, 2025 โ”‚
โ”‚ 597        โ”‚ Team of Rivals                                  โ”‚ Doris Kearns Goodwin โ”‚ 3      โ”‚ Apr 06, 2025 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Books by Year

โฏ libro report

                         Books Read by Year

  Year   Count   Bar
 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  2013   3       โ–„โ–„โ–„โ–„
  2014   4       โ–„โ–„โ–„โ–„โ–„โ–„
  2015   11      โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„
  2016   30      โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„
  2017   21      โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„
  2018   27      โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„
  2019   29      โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„
  2020   27      โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„
  2021   28      โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„
  2022   27      โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„
  2023   32      โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„
  2024   30      โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„
  2025   17      โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„

Author Report

โฏ libro report --author

         Most Read Authors

  Author                Books Read
 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  Stephen King          15
  George R.R. Martin    5
  Timothy Zahn          4
  Grady Hendrix         4
  Andy Weir             4
  William Zinsser       3
  Roald Dahl            3
  Riley Sager           3
  Philip K. Dick        3
  Neil Gaiman           3
  Natalie D. Richards   3
  Lucy Foley            3
  Cory Doctorow         3

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:

  1. Using the --db flag on command-line.

  2. libro.db in current directory

  3. Environment variable LIBRO_DB to specify custom file/location

  4. 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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

libro_book-0.1.1.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

libro_book-0.1.1-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file libro_book-0.1.1.tar.gz.

File metadata

  • Download URL: libro_book-0.1.1.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for libro_book-0.1.1.tar.gz
Algorithm Hash digest
SHA256 59776a786f0bcf37fcfaeca2fb7b6fe41000d2c9ce51c25bb92be9d67e010438
MD5 9c105ab4cd15bab8afbdf588c28a92d0
BLAKE2b-256 e05bfaca8f7ad954876c3892bdf2f27aedfc9d7ecea4d1a7e72d6cb1f3d55cb5

See more details on using hashes here.

File details

Details for the file libro_book-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: libro_book-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for libro_book-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4a66b6cbd7ae43ee73922719a17d5cf2302c9a23bea728f4036f8ffbc8434b5b
MD5 0cbe2eca8445492b8796ecce6f78db34
BLAKE2b-256 e41aed9f6f1dad94d0b3bdacf2e31e112228d1d71cdd0be5df6380d44fa78aed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page