deps: Switch from uv to plain venv and pip-tools

uv installs to ~/.local/bin which is not in PATH for systemd services,
and keeping uv updated on Ubuntu requires manual steps outside of apt.
Switch to a plain Python venv with pip-tools for dependency locking.

- Replace uv venv/sync with python3 -m venv --system-site-packages
- Generate requirements.txt with pip-compile from pyproject.toml
- Update service ExecStart to use .venv/bin/python directly
- Remove uv.lock and [tool.uv] from pyproject.toml
- Update README to document venv+pip-tools workflow
This commit is contained in:
Jeena 2026-03-11 22:57:41 +00:00
parent b2646222f8
commit 025228b83c
5 changed files with 109 additions and 1100 deletions

View file

@ -11,7 +11,6 @@ Designed for rooms bridged from WhatsApp via mautrix-whatsapp.
## Requirements
- Python 3.11+
- [uv](https://docs.astral.sh/uv/) (`curl -LsSf https://astral.sh/uv/install.sh | sh`)
- `libolm` + `python-olm` — must be installed via the system package manager
because `python-olm`'s build system is incompatible with modern CMake
@ -32,8 +31,8 @@ sudo apt install libolm3 python3-olm
```bash
git clone <repo>
cd matrix-paperless-ingest
uv venv --system-site-packages
uv sync --no-install-package python-olm
python3 -m venv .venv --system-site-packages
.venv/bin/pip install -r requirements.txt
```
### 2. Create a Matrix bot account
@ -96,7 +95,7 @@ PAPERLESS_INBOX_TAG_ID=1
### 7. Test
```bash
uv run --no-sync python ingest.py
.venv/bin/python ingest.py
```
Watch the logs. It will process all historical messages, then listen for new ones.
@ -118,6 +117,17 @@ systemctl --user enable --now matrix-paperless-ingest
journalctl --user -u matrix-paperless-ingest -f
```
## Updating dependencies
If you need to add or update a dependency, edit `pyproject.toml` and regenerate
the locked `requirements.txt`:
```bash
.venv/bin/pip install pip-tools
.venv/bin/pip-compile pyproject.toml
.venv/bin/pip install -r requirements.txt
```
## Viewing retry queue
```bash
@ -127,6 +137,6 @@ sqlite3 state.db "SELECT filename, status, retry_count, datetime(next_retry, 'un
## Moving to a new server
1. Copy the project directory to `~/matrix-paperless-ingest` (including `.env` and `state.db`)
2. Install `uv`, `libolm3`, and `python3-olm` on the new server
3. Run `uv venv --system-site-packages && uv sync --no-install-package python-olm`
2. Install `libolm3` and `python3-olm` via the system package manager
3. Run `python3 -m venv .venv --system-site-packages && .venv/bin/pip install -r requirements.txt`
4. Install the systemd user service as above

View file

@ -7,7 +7,7 @@ Wants=network-online.target
Type=simple
WorkingDirectory=%h/matrix-paperless-ingest
EnvironmentFile=%h/matrix-paperless-ingest/.env
ExecStart=%h/.local/bin/uv run --no-sync python ingest.py
ExecStart=%h/matrix-paperless-ingest/.venv/bin/python ingest.py
Restart=on-failure
RestartSec=10
StandardOutput=journal

View file

@ -10,6 +10,3 @@ dependencies = [
"aiosqlite>=0.20",
]
[tool.uv]
package = false

92
requirements.txt Normal file
View file

@ -0,0 +1,92 @@
aiofiles==24.1.0
# via matrix-nio
aiohappyeyeballs==2.6.1
# via aiohttp
aiohttp==3.13.3
# via
# aiohttp-socks
# matrix-nio
aiohttp-socks==0.11.0
# via matrix-nio
aiosignal==1.4.0
# via aiohttp
aiosqlite==0.22.1
# via matrix-paperless-ingest (pyproject.toml)
anyio==4.12.1
# via httpx
atomicwrites==1.4.1
# via matrix-nio
attrs==25.4.0
# via
# aiohttp
# jsonschema
# referencing
cachetools==5.5.2
# via matrix-nio
certifi==2026.2.25
# via
# httpcore
# httpx
cffi==2.0.0
# via python-olm
frozenlist==1.8.0
# via
# aiohttp
# aiosignal
h11==0.16.0
# via
# httpcore
# matrix-nio
h2==4.3.0
# via matrix-nio
hpack==4.1.0
# via h2
httpcore==1.0.9
# via httpx
httpx==0.28.1
# via matrix-paperless-ingest (pyproject.toml)
hyperframe==6.1.0
# via h2
idna==3.11
# via
# anyio
# httpx
# yarl
jsonschema==4.26.0
# via matrix-nio
jsonschema-specifications==2025.9.1
# via jsonschema
matrix-nio[e2e]==0.25.2
# via matrix-paperless-ingest (pyproject.toml)
multidict==6.7.1
# via
# aiohttp
# yarl
peewee==3.19.0
# via matrix-nio
propcache==0.4.1
# via
# aiohttp
# yarl
pycparser==3.0
# via cffi
pycryptodome==3.23.0
# via matrix-nio
python-dotenv==1.2.2
# via matrix-paperless-ingest (pyproject.toml)
python-olm==3.2.16
# via matrix-nio
python-socks[asyncio]==2.8.1
# via aiohttp-socks
referencing==0.37.0
# via
# jsonschema
# jsonschema-specifications
rpds-py==0.30.0
# via
# jsonschema
# referencing
unpaddedbase64==2.1.0
# via matrix-nio
yarl==1.23.0
# via aiohttp

1090
uv.lock generated

File diff suppressed because it is too large Load diff