Both sides previous revisionPrevious revisionNext revision | Previous revision |
lacre:ideas [2023/12/02 22:33] – add Alembic pfm | lacre:ideas [2024/04/14 20:34] (current) – add: rewrite in Rust pfm |
---|
| |
See [[https://packaging.python.org/en/latest/|Python Packaging User Guide]]. | See [[https://packaging.python.org/en/latest/|Python Packaging User Guide]]. |
| |
| There's a [[https://github.com/pypa/sampleproject/blob/db5806e0a3204034c51b1c00dde7d5eb3fa2532e/setup.py|very well documented setup.py example]]. |
| |
===== Use database migration framework ===== | ===== Use database migration framework ===== |
| |
See [[https://alembic.sqlalchemy.org/en/latest/|Alembic]] | See [[https://alembic.sqlalchemy.org/en/latest/|Alembic]] |
| |
| ===== Replace custom GnuPG wrapper ===== |
| |
| Instead of using our own wrapper for GnuPG we should consider using something more thorough, like [[https://pypi.org/project/pretty-bad-protocol/|pretty-bad-protocol]]. (However, this project seems to be inactive since 2018...) |
| |
| ===== Use advanced logging features ===== |
| |
| We could use context variables and ''logging.LoggerAdapter'' or ''logging.Filter'' to log more contextual information, like Message-Id of the message processed. That would make it easier to debug if something went wrong. |
| |
| Read more in [[https://docs.python.org/3/howto/logging-cookbook.html#use-of-contextvars|Logging Cookbook - Use of contextvars]] and documentation of [[https://docs.python.org/3/library/contextvars.html|contextvars]] module. |
| |
| ===== Provide a Milter ===== |
| |
| Instead of using after-queue mail filters, we could use Sendmail 8's [[https://www.postfix.org/MILTER_README.html|Milter API]]. They can be written in Python too (see [[https://pymilter.org/|Python milters]]). |
| |
| With Lacre being a Milter, it would become available for a wider audience (i.e. for Postfix //and// Sendmail admins). |
| |
| ===== Rewrite in Rust ===== |
| |
| Since Python has some limitations (e.g. its ''email'' module makes it hard to process messages without modifying their contents), I'm considering rewriting Lacre in Rust. |
| |
| Crates I consider using: |
| |
| * [[https://crates.io/crates/actix-server|actix-server]], a generic TCP server --- I assume it's something like Python's ''asyncio''; |
| * [[https://github.com/rpgp/rpgp|rpgp]], a Rust crate to work with Open PGP; |
| * [[https://crates.io/crates/email-address-parser|email-address-parser]], an RFC-compliant address parser; |
| * [[https://crates.io/crates/mime|mime]], a strongly typed MIME-Type support; |
| * something to parse MIME--compliant messages; |
| |