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

See: libro --help for more information.

Examples

Books Read in Year

โฏ libro
                                 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 โ”‚
โ”‚ 584        โ”‚ Salem's Lot                  โ”‚ Stephen King         โ”‚ 3      โ”‚ Mar 12, 2025 โ”‚
โ”‚ 595        โ”‚ The Thursday Murder Club     โ”‚ Richard Osman        โ”‚ 3      โ”‚ 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 โ”‚
โ”‚ 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

Changelog

See GitHub Releases for the changelog.

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.2.1.tar.gz (12.6 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.2.1-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: libro_book-0.2.1.tar.gz
  • Upload date:
  • Size: 12.6 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.2.1.tar.gz
Algorithm Hash digest
SHA256 2cb71cac4a4256cf61d54dc95d74582aecf93285a5a83892f8577ca915362ad4
MD5 92a51064e367a1f8de9e929d53282d4b
BLAKE2b-256 80987660ae83dc6f6899ab5d80373d25d23ceb7371cdd034f1dff68b73799f2f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: libro_book-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 15.0 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.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 246613ac83baf7f82bc4b14041f43b598fdbfd0c56b065a3ba15487b4d3fcc6e
MD5 f67b7571075dc72138bf26d73cc84810
BLAKE2b-256 e21c25747f7182691caccb69f6a161ef0aef1e26b6ae4e7bec4173fc11ed8b82

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