Skip to main content

This is a very simple library that allows writing to public-inbox v2 repositories. Note, that this is not a suitable replacement for public-inbox in itself – the goal is merely to provide a way to write public-inbox repositories that can be cloned, indexed and served from an actual public-inbox server running elsewhere.

What it does:

  • provides a way to add RFC2822 messages to a git repository in a way that is compatible with public-inbox

What it doesn’t do:

  • anything else

What it may do in the future:

  • epoch support (optionally, since we want to allow people to publish these to places that only do single-level repos, like GitHub

For the public-inbox v2 format, see:

Requirements

The git command must exist and be in your path.

Installing

Install from pypi:

pip install ezpi

Library usage

This is the simplest usage example:

from email.message import EmailMessage
from ezpi import add_rfc822

msg = EmailMessage()
msg.set_content('Hello world!')
# We must have a Subject: and From: headers at least, in order
# to make a useful git commit with that data
msg['Subject'] = 'My excellent subject'
msg['From'] = 'E.X. Ample <example@example.com'>
# We won't create the repo for you, so run "git init --bare" first
add_rfc822('example.git', msg)

You can also pass bytes instead of an EmailMessage object, but we must be able to run message_from_bytes() on it.

ezpi command

We also provide an ezpi command:

usage: main.py [-h] [-r REPO] [-d] [-q] [-v] [--rfc822] [-f HDR_FROM] [-s HDR_SUBJ] [-p]
               [--domain DOMAIN]

optional arguments:
  -h, --help            show this help message and exit
  -r REPO, --repo REPO  Bare git repository where to write the commit (must exist) (default: None)
  -d, --dry-run         Do not write the commit, just show the commit that would be written. (default:
                        False)
  -q, --quiet           Only output errors to the stdout (default: False)
  -v, --verbose         Show debugging output (default: False)
  --rfc822              Treat stdin as an rfc822 message (default: False)
  -f HDR_FROM, --from HDR_FROM
                        From header for the message, if not using --rfc822 (default: None)
  -s HDR_SUBJ, --subject HDR_SUBJ
                        Subject header for the message, if not using --rfc822 (default: None)
  -p, --run-post-commit-hook
                        Run hooks/post-commit after a successful commit (if present) (default: False)
  --domain DOMAIN       Domain to use when creating message-ids (default: None)

Example:

ezpi -r path/to/example/git/0.git --rfc822 < valid.eml

How to delete messages?

Since every message is a separate commit to the git repository, deleting requires a git history rewrite. You will need to find the commit with the message you want to delete and perform operations directly on the git repository in order to delete that commit and rebase the ones that follow. Once it’s done, you will need to force-push the repository to wherever it is hosted.

Caution: if anyone is replicating your repository without –mirror, the history rewrite will result in an error the next time they do “git remote update”. Needless to say, they will be very interested in finding out what it is you just tried to delete, so use this as the last resort solution.

Problems? Patches?

Email ~monsieuricon/public-inbox@lists.sr.ht

(That’s a different kind of public-inbox. Unfortunately, there’s a name collision, but I believe public-inbox.org had that claimed earlier.)

Metadata

Release files for ezpi 0.2.1

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

Source distribution (sdist)

Source distribution for ezpi 0.2.1
File Size Uploaded
ezpi-0.2.1.tar.gz 6.9 kB Details

Built distribution (wheel)

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

Total release size: 13.8 kB

Release files / ezpi-0.2.1.tar.gz

Download URL ezpi-0.2.1.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1e3841d4ac2be69015ab98830876bbcca6b98b34c90a1866acefb63c17801938
BLAKE2b-256 checksum
How to use checksums
bbb0ac0caf0f0ab6f27f1df83fbb3a08f6df4cde873008ad63b7378b62613c72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.6

Release files / ezpi-0.2.1-py3-none-any.whl

Download URL ezpi-0.2.1-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8806985754f23b3f6e1aae74275852834ee361b284e34ecf1682aaf0dde6188a
BLAKE2b-256 checksum
How to use checksums
f11d8b2af2a0c062925782b5799ec054ae53dfa9683dee137654988f78e076da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.6

Release history Release notifications | RSS feed

0.6

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.2

2 release files

This release

0.2.1 This release

2 release files

0.2

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