Skip to main content

chives

chives is a collection of personal helper utilities for managing, validating, and maintaining local media archives.

I store my local media archives as static websites and use Python scripts to keep everything running smoothly. This package bundles the common, reusable code I share across multiple archives and sites.

Features

This repo is a dual-language toolkit with utilities for managing the metadata and rendering the front-end.

The Python library handles:

  • Media inspection and processing: get information like image dimensions and video duration, and convert subtitle files.
  • Metadata validation: ensure high-quality metadata by verifying that files in metadata actually exist on disk, and enforcing consistent timestamp formats.
  • Static site testing: pytest fixtures to check that static sites can be loaded without console or network errors.
  • HTTP and date utilities: standardised helpers for downloading web pages (for bookmarking/archiving) and handling common date patterns.

The JavaScript components handle front-end UI, including:

  • Image rendering: render the image entities created by the Python library.

Design goals

My media archives are saved on my personal computer and I want them to last for years (ideally decades), which influences the design of this library:

  1. Human comprehensibility: I want to understand every line of code, so everything is written by hand. I understood it once, which gives me a decent chance of understanding it later.

  2. Minimal dependencies: I keep third-party dependencies to a minimum. This is to reduce my exposure to supply-chain attacks and reduce the risk of dependency rot.

  3. Rock-solid reliable: Everything is fully type-checked and throughly tested. I want this to be a reliable foundation for my media archive.

Versioning and stability

This library is monotonically versioned (releases simply go up sequentially).

I make breaking changes regularly, and I make no promise of compatibility between versions. When I make a breaking change, I update all my local media archives to the latest version immediately and fix the breakage at the same time.

I've made this repository public because it's convenient for my deployment and to contribute to the public corpus of open-source code for everybody to learn from, but expect things to shift around without warning.

Installation and usage

Because this is a personal utility library, I recommend you copy the code: duplicate the relevant functions and tests into your codebase (with a link back to this repo for attribution!). Having your own copy will protect you from disruption caused by my breaking changes.

  • If you want the Python package, you can install it from PyPI (but pin the version):

    $ pip install alexwlchan-chives==42
    
  • If you want the JavaScript files, you have to add them as files in your project.

    If you have the Python package installed, you can see a list of available files and install them with the Chives CLI:

    $ chives-list-js
    available 'chives-*.js' files:
    chives-image.js
    
    $ chives-write-js chives-image.js
    chives-image.js
    

    This saves the chives-image.js to your current directory.

    You can get the latest JS versions by running:

    $ chives-update-js
    Updating chives-image.js
    Updating static/chives-image.js
    Successfully updated 1 JavaScript component file(s)!
    

    The JavaScript files are not available in npm or other package repositories.

For detailed usage instructions, check the docstrings inside the individual functions.

Development and feedback

Want to contribute or tweak something? Check out CONTRIBUTING.md for local setup instructions.

License

This project is shared under the MIT license.

Metadata

Release files for alexwlchan-chives 50

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

Source distribution (sdist)

Source distribution for alexwlchan-chives 50
File Size Uploaded
alexwlchan_chives-50.tar.gz 7.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for alexwlchan-chives 50
File Interpreter ABI Platform
alexwlchan_chives-50-py3-none-any.whl Python 3 none any Details

Total release size: 7.1 MB

Release files / alexwlchan_chives-50.tar.gz

Download URL alexwlchan_chives-50.tar.gz
Size 7.1 MB
Tags Source
SHA-256 checksum
How to use checksums
f4d65c37bbbcf0a16bd2ad5f561f99508352d1af0b2d4b23bfe73468e0ed6466
BLAKE2b-256 checksum
How to use checksums
517806cce32f5ccc8fc78a8ac7d50d365809cd9cf272141890b4fcfdd136f4d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / alexwlchan_chives-50-py3-none-any.whl

Download URL alexwlchan_chives-50-py3-none-any.whl
Size 29.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e7f765ead94485ad1dbc1db9b0985354598dc6d855cfd33b6d46b83eb5351cb6
BLAKE2b-256 checksum
How to use checksums
767adde4e5aff69b412e148325abf609e1607d25c70d828bba761b50e044db37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

53

2 release files

52

2 release files

51

2 release files

This release

50 This release

2 release files

49

2 release files

48

2 release files

47

2 release files

46

2 release files

45

2 release files

44

2 release files

43

2 release files

42

2 release files

41

2 release files

40

2 release files

39

2 release files

38

2 release files

37

2 release files

36

2 release files

35

2 release files

34

2 release files

33

2 release files

32

2 release files

31

2 release files

30

2 release files

29

2 release files

28

2 release files

27

2 release files

26

2 release files

25

2 release files

24

2 release files

23

2 release files

22

2 release files

21

2 release files

20

2 release files

19

2 release files

18

2 release files

17

2 release files

16

2 release files

15

2 release files

14

2 release files

13

2 release files

12

2 release files

11

2 release files

10

2 release files

9

2 release files

8

2 release files

7

2 release files

6

2 release files

5

2 release files

4

2 release files

3

2 release files

2

2 release files

1

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