EZPI: a simple library to write to public-inbox repos
=====================================================
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:
- https://public-inbox.org/public-inbox-v2-format.html
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:
.. code-block:: python
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.)
Raw data
{
"_id": null,
"home_page": "https://sr.ht/~monsieuricon/ezpi/",
"name": "ezpi",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "git,lore.kernel.org,public-inbox",
"author": "Konstantin Ryabitsev",
"author_email": "mricon@kernel.org",
"download_url": "https://files.pythonhosted.org/packages/39/d1/37936392229f7516449bbaa06c9d3a442113aa64165b7712f8d47c0a3a6a/ezpi-0.4.0.tar.gz",
"platform": null,
"description": "EZPI: a simple library to write to public-inbox repos\n=====================================================\nThis is a very simple library that allows writing to public-inbox v2\nrepositories. Note, that this is not a suitable replacement for\npublic-inbox in itself -- the goal is merely to provide a way to write\npublic-inbox repositories that can be cloned, indexed and served from an\nactual public-inbox server running elsewhere.\n\nWhat it does:\n\n- provides a way to add RFC2822 messages to a git repository in a way\n that is compatible with public-inbox\n\nWhat it doesn't do:\n\n- anything else\n\nWhat it may do in the future:\n\n- epoch support (optionally, since we want to allow people to publish these to\n places that only do single-level repos, like GitHub\n\nFor the public-inbox v2 format, see:\n\n- https://public-inbox.org/public-inbox-v2-format.html\n\nRequirements\n------------\nThe ``git`` command must exist and be in your path.\n\nInstalling\n----------\nInstall from pypi::\n\n pip install ezpi\n\nLibrary usage\n-------------\nThis is the simplest usage example:\n\n.. code-block:: python\n\n from email.message import EmailMessage\n from ezpi import add_rfc822\n\n msg = EmailMessage()\n msg.set_content('Hello world!')\n # We must have a Subject: and From: headers at least, in order\n # to make a useful git commit with that data\n msg['Subject'] = 'My excellent subject'\n msg['From'] = 'E.X. Ample <example@example.com'>\n # We won't create the repo for you, so run \"git init --bare\" first\n add_rfc822('example.git', msg)\n\nYou can also pass bytes instead of an EmailMessage object, but we must\nbe able to run message_from_bytes() on it.\n\nezpi command\n------------\nWe also provide an ezpi command::\n\n usage: main.py [-h] [-r REPO] [-d] [-q] [-v] [--rfc822] [-f HDR_FROM] [-s HDR_SUBJ] [-p]\n [--domain DOMAIN]\n\n optional arguments:\n -h, --help show this help message and exit\n -r REPO, --repo REPO Bare git repository where to write the commit (must exist) (default: None)\n -d, --dry-run Do not write the commit, just show the commit that would be written. (default:\n False)\n -q, --quiet Only output errors to the stdout (default: False)\n -v, --verbose Show debugging output (default: False)\n --rfc822 Treat stdin as an rfc822 message (default: False)\n -f HDR_FROM, --from HDR_FROM\n From header for the message, if not using --rfc822 (default: None)\n -s HDR_SUBJ, --subject HDR_SUBJ\n Subject header for the message, if not using --rfc822 (default: None)\n -p, --run-post-commit-hook\n Run hooks/post-commit after a successful commit (if present) (default: False)\n --domain DOMAIN Domain to use when creating message-ids (default: None)\n\nExample::\n\n ezpi -r path/to/example/git/0.git --rfc822 < valid.eml\n\nHow to delete messages?\n-----------------------\nSince every message is a separate commit to the git repository, deleting\nrequires a git history rewrite. You will need to find the commit with\nthe message you want to delete and perform operations directly on the\ngit repository in order to delete that commit and rebase the ones that\nfollow. Once it's done, you will need to force-push the repository to\nwherever it is hosted.\n\nCaution: if anyone is replicating your repository without --mirror, the\nhistory rewrite will result in an error the next time they do \"git\nremote update\". Needless to say, they will be very interested in finding\nout what it is you just tried to delete, so use this as the last resort\nsolution.\n\nProblems? Patches?\n------------------\nEmail ~monsieuricon/public-inbox@lists.sr.ht\n\n(That's a different kind of public-inbox. Unfortunately, there's a name\ncollision, but I believe public-inbox.org had that claimed earlier.)\n",
"bugtrack_url": null,
"license": "MIT-0",
"summary": "A simple library to write content to public-inbox repositories",
"version": "0.4.0",
"split_keywords": [
"git",
"lore.kernel.org",
"public-inbox"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "869029945a4b633cebf589952316894f",
"sha256": "2a87574f07dcc27097bcf3e664ddefa709c325fc8fa30823b240ead29d260c12"
},
"downloads": -1,
"filename": "ezpi-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "869029945a4b633cebf589952316894f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 7111,
"upload_time": "2022-11-30T19:11:10",
"upload_time_iso_8601": "2022-11-30T19:11:10.676625Z",
"url": "https://files.pythonhosted.org/packages/10/52/f0573d1f78641b4c911a851b7a9c2c210199d0c2ab6236321bf17985adf8/ezpi-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "1922883db2a181c5891f73b05f63dcc1",
"sha256": "0f5c046db1442238fecfaee215f9672be4ee5832f491b27aa844032b7946cce5"
},
"downloads": -1,
"filename": "ezpi-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "1922883db2a181c5891f73b05f63dcc1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 6976,
"upload_time": "2022-11-30T19:11:12",
"upload_time_iso_8601": "2022-11-30T19:11:12.505911Z",
"url": "https://files.pythonhosted.org/packages/39/d1/37936392229f7516449bbaa06c9d3a442113aa64165b7712f8d47c0a3a6a/ezpi-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-11-30 19:11:12",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "ezpi"
}