Skip to main content

A PDF book generator for structured ritual and ceremonial texts

Project description

bookcraft

PyPI version Python versions Downloads codecov type checked: ty

A Python library for generating PDF books from structured text content.

Installation

pip install bookcraft

Usage

from bookcraft import generate

generate(
    books_path="./books/",
    settings_path="./c-settings.yaml",
    fonts_path="./fonts.yaml",
    keywords_path="./c-keywords.yaml",
    output_path="./output/craft.pdf",
    mode="craft",
)

Modes

Mode Description
craft Craft, light theme
craft-dark Craft, dark theme
ra Royal Arch, light theme
ra-dark Royal Arch, dark theme

Page format

Pages are plain .txt files named page-1.txt, page-2.txt, etc. inside each book directory.

Headings

A line starting with # is rendered as a heading.

#Opening the Lodge in the First Degree

Roles

A line starting with $ highlights the speaker's role name.

$W. M. Brethren, assist me to open the Lodge.

Line breaks

= at the end of a line inserts a line break. Multiple = insert multiple breaks.

$W. M. What is the first care of every Freemason?=
$J. W. To see that the Lodge is properly tyled.=

Italic text

Text wrapped in > and < is rendered in italic.

$I. G. (to J. W., by name) >I. G. gives k....s and is answered by Tyler.<

Keywords

Words and abbreviations listed in keywords.yaml are automatically rendered in bold wherever they appear in the text.

$W. M. The candidate is an E. A.

Development setup

After cloning, install the pre-commit hooks (one-time):

uv run pre-commit install

This runs type checking and tests automatically before every commit.

Releasing a new version

  1. Bump the version in pyproject.toml
  2. Add an entry to CHANGELOG.md
  3. Commit and tag:
git add pyproject.toml CHANGELOG.md
git commit -m "Release v0.2.0"
git tag v0.2.0
git push && git push --tags

GitHub Actions will build and publish to PyPI automatically.

Content layout

Your content project should provide:

your-project/
├── books/          # directories of page-N.txt files
├── fonts/          # font files referenced in fonts.yaml
├── config/
│   ├── fonts.yaml
│   ├── c-settings.yaml
│   ├── c-keywords.yaml
│   ├── ra-settings.yaml
│   └── ra-keywords.yaml
└── output/         # generated PDFs written here

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

bookcraft-1.2.0.tar.gz (50.8 kB view details)

Uploaded Source

Built Distribution

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

bookcraft-1.2.0-py3-none-any.whl (24.2 kB view details)

Uploaded Python 3

File details

Details for the file bookcraft-1.2.0.tar.gz.

File metadata

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

File hashes

Hashes for bookcraft-1.2.0.tar.gz
Algorithm Hash digest
SHA256 44374baea6b5fac30d35a586cb8285ddfde1ce02aa278a15884657f356b93b8b
MD5 c8486c2e8c26ffa29999cfebcbae6b26
BLAKE2b-256 8a33bb88a4e373ef9b9b8adac84f61c375c7f6c5eb714f7c05f3d02de2755b4a

See more details on using hashes here.

Provenance

The following attestation bundles were made for bookcraft-1.2.0.tar.gz:

Publisher: publish.yml on albertkol/bookcraft

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

File details

Details for the file bookcraft-1.2.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for bookcraft-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 48d75de198c7fefa564a5e93a3a138adbf5820a94e8eb15fcdf947e883819a06
MD5 9fdc6e5c3cdbab6f2f823d8d311379e3
BLAKE2b-256 e92a4a9c9d0fbc146548b58bf7861a3568a97962610fe30a1eea9b8674448bab

See more details on using hashes here.

Provenance

The following attestation bundles were made for bookcraft-1.2.0-py3-none-any.whl:

Publisher: publish.yml on albertkol/bookcraft

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