Skip to main content

Shortbox

PyPI - Python PyPI - Status PyPI - Version PyPI - License

prek Ruff ty

status-badge

An extensible library to manage comic archives and their embedded files and metadata.

Supported Formats

More can be added by extending the respective base class and adding to the registry.

Archives

Archive Extra Required
.cbz, .zip builtin
.cbt, .tar builtin
.cbr, .rar cbr
.cb7, .7z cb7
.pdf pdf

Compability Table

Format Read Update Create
cbz ✅ ✅ ✅
cbt ❌ ❌ ✅
cbr ✅ ❌ ❌
cb7 ✅ ❌ ✅
pdf ✅ ✅ ❌

If something is marked as in-compatible the library will try extracting and making the change via the local system and re-archive (if it has the create capability).

Metadata

Installation

pdm add shortbox

Optional extras can be added as needed:

pdm add shortbox[cbr,cb7,pdf]

Usage

from pathlib import Path

from shortbox import Comic
from shortbox.metadata import MetronInfo

my_comic = Path("MyComic.cbz")
with Comic.open(my_comic) as comic:
    print(comic.list_filenames())
    print(comic.read_file(filename="page-1.jpg").decode("UTF-8"))
    print(comic.metadata)  # Dict of registered metadata in archive

    metron_info = comic.get_metadata(metadata_type=MetronInfo)
    print(metron_info.series)

Writing files and metadata (support depends on the archive format, see table above):

with Comic.open(my_comic) as comic:
    comic.write_file(filename="page-99.jpg", data=b"...", override=True)
    comic.remove_file(filename="page-01.jpg")

    metron_info = comic.get_metadata(metadata_type=MetronInfo)
    metron_info.series.name = "Updated Title"
    comic.set_metadata(metron_info)

You can also convert between different archives (as long as the destination archive has create capability)

from shortbox.archives import ZipArchive

rar_comic = Path("MyComic.cbr")
with Comic.open(rar_comic) as comic:
    print(comic.file)  # MyComic.cbr
    comic.convert(
        ZipArchive, delete_original=True
    )  # All future comic interactions will be on the new archive
    print(comic.file)  # MyComic.cbz

Socials

Social - Matrix

Metadata

Release files for shortbox 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shortbox 0.5.0
File Size Uploaded
shortbox-0.5.0.tar.gz 203.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for shortbox 0.5.0
File Interpreter ABI Platform
shortbox-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 223.8 kB

Release files / shortbox-0.5.0.tar.gz

Download URL shortbox-0.5.0.tar.gz
Size 203.8 kB
Tags Source
SHA-256 checksum
How to use checksums
88b4d010e362354d83ef75c171e92d4bfe58ea7317b7439436976ce94d50909f
BLAKE2b-256 checksum
How to use checksums
5b3e171ab50a350ab410319d41ce76cbf00c6bdcb58bc83ffb50aeb71e83556a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / shortbox-0.5.0-py3-none-any.whl

Download URL shortbox-0.5.0-py3-none-any.whl
Size 20.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9664e7dda437c267e0d125577750f7de77e399da6fd5037e65a0788d85f0a46a
BLAKE2b-256 checksum
How to use checksums
09d0064b6eae502d6d9fa0c85a21b1b49a65c6ab943cd7f008aaadbd0d1911d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.1

2 release files

0.4.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page