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.2.tar.gz (11.4 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.2-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: libro_book-0.1.2.tar.gz
  • Upload date:
  • Size: 11.4 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.2.tar.gz
Algorithm Hash digest
SHA256 1bf70f5cfb192a88de3e896352801d4060527fefe02f72c6c6a4a753e8744eb8
MD5 de45f7b46ce9e2116699b7683eeaa15e
BLAKE2b-256 21569615a44d530f68cf28dbe29b60b41aa628567b51fb6c0ae4aff59a8ad77d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: libro_book-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 13.5 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b4c4524f63b499f8e3f9b2663a8d1dbee535215d6d70381c4b939a9f57218ce9
MD5 6f6d62a1ac7f3c58d769434f0de23ebd
BLAKE2b-256 21b0f6ebf28efe6bbfbdb27f0d8576557e28abc182ae5347141b0ec901d8568d

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