Skip to main content

Generate printable Accelerated Reader book labels from an Excel spreadsheet.

Project description

ar-book-labels

English | 简体中文

Generate printable Accelerated Reader book labels from an Excel spreadsheet. Labels include book title, author, AR level (with standard color coding), points, and quiz number — formatted for sticker-style printing and sticking on books.

Features

  • Standard AR color coding: 12 color ranges from yellow (0.1–1.5) to brown (6.6+)
  • Print-ready HTML output: 4 columns x 9 rows = 36 labels per page, A4 size, @page CSS for direct printing
  • Smart text truncation: Titles wrap to 2 lines with ellipsis; authors on 1 line
  • Author-first layout: Author name appears above title for easy shelf sorting
  • Screen preview: SVG viewBox scaling for crisp browser preview
  • Template included: Reference Excel template with sample data and column documentation

Installation

pip install ar-book-labels

Or install from source:

git clone https://github.com/TonyBlur/ar-book-labels.git
cd ar-book-labels
pip install -e .

Quick Start

  1. Get the template (optional — if you don't have an Excel file yet):
ar-book-labels --template

This copies ar_template.xlsx to your current directory. Fill it with your book data.

  1. Generate labels:
ar-book-labels books.xlsx -o labels.html
  1. Open labels.html in a browser to preview, then print (Ctrl/Cmd+P).

    Print tip: In the browser print dialog, choose "Actual size" (or "No margins" / "None" for margins) to prevent the browser from auto-adding page margins that shift label positions. The HTML already declares @page { margin: 0 }; adding browser margins on top causes misalignment.

CLI Usage

ar-book-labels <excel> [options]

Arguments

Argument Description
excel Path to the Excel file (.xlsx)

Options

Option Default Description
-o, --output AR_Book_Labels.html Output HTML file path
-s, --sheet first sheet Sheet name to read (defaults to first sheet)
--col-title AR Title Excel column name for book title
--col-author AR Author Excel column name for author
--col-level Book Level Excel column name for book level
--col-points AR Points Excel column name for AR points
--col-quiz Quiz Number Excel column name for quiz number
--start-row 2 1-indexed row where data begins (1 = header row)
--scale 1 Display scale factor for screen preview
--bw Black-and-white mode: white circle with thin black outline, black level number
--template Copy the reference Excel template to cwd and exit
-V, --version Show version and exit

Examples

# Basic usage
ar-book-labels my_books.xlsx

# Custom output path and sheet name
ar-book-labels my_books.xlsx -o output/labels.html -s "Book Data"

# Custom column names (if your Excel uses different headers)
ar-book-labels my_books.xlsx --col-title "Title" --col-author "Author Name" --col-level "Level"

# Custom start row (e.g. data starts on row 3)
ar-book-labels my_books.xlsx --start-row 3

# Copy the template for reference
ar-book-labels --template

# Black-and-white mode for economical printing
ar-book-labels my_books.xlsx --bw

Excel Format

The spreadsheet must contain these columns (default names shown; use --col-* options to map custom names):

Internal Key Default Column Type Description
title AR Title text Book title
author AR Author text Author name
level Book Level number AR ATOS level (e.g. 5.1)
points AR Points number Points value
quiz Quiz Number number/text Quiz ID

Rows with missing required fields are skipped with a warning printed to stderr.

Use ar-book-labels --template to get a pre-formatted template with sample data.

AR Level Color Chart

Level Range Color Hex
0.1 – 1.5 Yellow #FFD700
1.6 – 2.0 Green #2E8B57
2.1 – 2.5 Dark Blue #00008B
2.6 – 3.0 Red #DC143C
3.1 – 3.5 Pink #FF69B4
3.6 – 4.0 Purple #800080
4.1 – 4.5 Orange #FF8C00
4.6 – 5.0 Light Blue #00BFFF
5.1 – 5.5 Neon Orange #FF6600
5.6 – 6.0 Neon Green #39FF14
6.1 – 6.5 Black #1C1C1C
6.6+ Brown #8B4513

Development

Setup

git clone https://github.com/TonyBlur/ar-book-labels.git
cd ar-book-labels
python -m venv .venv
source .venv/bin/activate  # or .venv\Scripts\activate on Windows
pip install -e ".[dev]"

Project Structure

ar-book-labels/
  ar_book_labels/
    __init__.py        # Package metadata and public API
    generator.py       # Core label generation logic
    cli.py             # CLI entry point (argparse)
    __main__.py        # python -m ar_book_labels support
    templates/
      ar_template.xlsx # Reference Excel template
  tests/
    test_generator.py  # Unit tests
  pyproject.toml       # Build configuration (setuptools)
  LICENSE              # MIT License
  README.md            # This file (English)
  README.zh.md         # 中文文档

Running Tests

python -m pytest tests/ -v

Building & Publishing

pip install build twine
python -m build
twine check dist/*
twine upload dist/*

Automated Publishing (GitHub Actions)

This project uses a GitHub Actions workflow to automatically publish to PyPI when a new release is created:

  1. Bump the version in pyproject.toml
  2. Create a new release on GitHub (via the web UI or gh release create)
  3. The publish.yml workflow will automatically build the package and publish it to PyPI using trusted publishing (OIDC — no API token needed)

Prerequisites: Configure a Trusted Publisher on PyPI for the ar-book-labels project, linking it to the TonyBlur/ar-book-labels repository and the pypi environment.

Code Style

  • Python 3.8+
  • No external dependencies beyond openpyxl
  • Keep the generator logic self-contained and testable

License

MIT — see LICENSE for details.

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

ar_book_labels-0.1.0.tar.gz (21.2 kB view details)

Uploaded Source

Built Distribution

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

ar_book_labels-0.1.0-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file ar_book_labels-0.1.0.tar.gz.

File metadata

  • Download URL: ar_book_labels-0.1.0.tar.gz
  • Upload date:
  • Size: 21.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ar_book_labels-0.1.0.tar.gz
Algorithm Hash digest
SHA256 11d2320815717f3b8268a80029309e5c7221da8d2b42455b1c2adc8c23414996
MD5 f24a4962973ad89b44026c6878157064
BLAKE2b-256 11b801d66f7b67a51915a2a6daf9d9cd4bde316c2d5bd49050935aefd2d8929d

See more details on using hashes here.

Provenance

The following attestation bundles were made for ar_book_labels-0.1.0.tar.gz:

Publisher: publish.yml on TonyBlur/ar-book-labels

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ar_book_labels-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ar_book_labels-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ar_book_labels-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c89eaa22e0fcd6756eb13cd0aa66024bcb37732cd3e2857bc57427b232c70b3b
MD5 9190d3b869509fa81b5068fc82de4cb2
BLAKE2b-256 7a6432fb37b61cab0a6bfb939d9f14353c6aafa03523e57565c469b044680f69

See more details on using hashes here.

Provenance

The following attestation bundles were made for ar_book_labels-0.1.0-py3-none-any.whl:

Publisher: publish.yml on TonyBlur/ar-book-labels

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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