Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,22 @@ updates:
- dependency-name: "ty"
- dependency-name: "pre-commit"
- dependency-name: "pytest"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"
allow:
- dependency-name: "python"
- dependency-name: "ghcr.io/astral-sh/uv"
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "daily"
allow:
- dependency-name: "typer"
- dependency-name: "rich"
- dependency-name: "questionary"
- dependency-name: "pydantic"
- dependency-name: "cryptography"
- dependency-name: "beautifulsoup4"
- dependency-name: "html2text"
24 changes: 13 additions & 11 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

'service: cli':
- changed-files:
- any-glob-to-any-file: cli/*
- any-glob-to-any-file: relay/cli/*

'service: docs':
- changed-files:
Expand Down Expand Up @@ -46,6 +46,8 @@
- changed-files:
- any-glob-to-any-file:
- '**/pyproject.toml'
- '**/uv.lock'
- '**/Dockerfile'


########################################################
Expand All @@ -67,16 +69,6 @@
- any-glob-to-any-file:
- relay/providers/*

'module: client':
- changed-files:
- any-glob-to-any-file:
- relay/client.py

'module: config':
- changed-files:
- any-glob-to-any-file:
- relay/config.py

'module: exceptions':
- changed-files:
- any-glob-to-any-file:
Expand All @@ -91,3 +83,13 @@
########################################################
# CLI-specific
########################################################

'commands: account':
- changed-files:
- any-glob-to-any-file:
- relay/cli/commands/account/*

'commands: auth':
- changed-files:
- any-glob-to-any-file:
- relay/cli/commands/auth/*
7 changes: 7 additions & 0 deletions .github/verify_deps_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
# ///

import logging
import re
import sys
import tomllib
from pathlib import Path

import yaml

DOCKERFILES = ["./Dockerfile"]
PRECOMMIT_CONFIG = ".pre-commit-config.yaml"
PYPROJECT_PATH = "./pyproject.toml"

Expand All @@ -31,6 +33,11 @@
def main():
# Retrieve & parse all deps files
deps_dict = {"uv": [], "ruff": [], "ty": []}
# Parse dockerfiles
for dockerfile in DOCKERFILES:
dockerfile_content_ = Path(dockerfile).read_text(encoding="utf-8")
uv_version = re.search(r"ghcr\.io/astral-sh/uv:(\d+\.\d+\.\d+)", dockerfile_content_).group(1) # ty: ignore[possibly-unbound-attribute]
deps_dict["uv"].append({"file": dockerfile, "version": uv_version})
# Parse precommit
with Path(PRECOMMIT_CONFIG).open("r", encoding="utf-8") as f:
precommit = yaml.safe_load(f)
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/engine.yml → .github/workflows/core.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: engine
name: core

on:
push:
Expand All @@ -8,20 +8,20 @@ on:
- 'cli/**'
- 'pyproject.toml'
- 'Makefile'
- '.github/workflows/engine.yml'
- '.github/workflows/core.yml'
pull_request:
branches: main
paths:
- 'relay/**'
- 'cli/**'
- 'pyproject.toml'
- 'Makefile'
- '.github/workflows/engine.yml'
- '.github/workflows/core.yml'
release:
types: [published]

env:
UV_VERSION: "0.7.19"
UV_VERSION: "0.7.20"
PYTHON_VERSION: "3.11"


Expand Down
75 changes: 75 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: docker

on:
push:
branches: main
paths:
- '.github/workflows/docker.yml'
- 'relay/**'
- 'pyproject.toml'
- 'uv.lock'
- 'README.md'
- 'LICENSE'
- 'Dockerfile'
pull_request:
branches: main
paths:
- '.github/workflows/docker.yml'
- 'relay/**'
- 'pyproject.toml'
- 'uv.lock'
- 'README.md'
- 'LICENSE'
- 'Dockerfile'
release:
types: [published]

jobs:
build:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build & test the docker image
run: |
make docker
docker run -i ghcr.io/${{ github.repository }}:latest relay --help

publish:
if: github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Generate metadata
id: meta
run: |
echo "date=$(date -u +"%Y-%m-%dT%H-%M-%S")" >> $GITHUB_OUTPUT
echo "commit=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "version=$(grep -E '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')" >> $GITHUB_OUTPUT
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ steps.meta.outputs.date }}
ghcr.io/${{ github.repository }}:${{ steps.meta.outputs.commit }}
ghcr.io/${{ github.repository }}:${{ steps.meta.outputs.version }}
labels: |
org.opencontainers.image.created=${{ steps.meta.outputs.date }}
org.opencontainers.image.revision=${{ steps.meta.outputs.commit }}
org.opencontainers.image.version=${{ steps.meta.outputs.version }}
cache-from: type=gha
cache-to: type=gha,mode=max
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,8 @@ repos:
hooks:
- id: validate-pyproject
args: ["./pyproject.toml"]
- repo: https://github.com/astral-sh/uv-pre-commit
rev: '0.7.20'
hooks:
- id: uv-lock
args: ["--locked"]
32 changes: 32 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM python:3.11-slim

ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

LABEL maintainer="Relay team <[email protected]>"

# Enable bytecode compilation
ENV UV_COMPILE_BYTECODE=1
# Copy from the cache instead of linking since it's a mounted volume
ENV UV_LINK_MODE=copy
# cf. https://github.com/astral-sh/uv/issues/8085#issuecomment-2438256688
ENV UV_PROJECT_ENVIRONMENT="/usr/local/"

# Install uv
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#installing-uv
COPY --from=ghcr.io/astral-sh/uv:0.7.20 /uv /bin/uv

# Install the project's dependencies using the lockfile and settings
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --locked --no-install-project --no-dev

# Build the wheels and install the project
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
--mount=type=bind,source=README.md,target=README.md \
--mount=type=bind,source=LICENSE,target=LICENSE \
--mount=type=bind,source=relay,target=relay \
uv pip install --system .
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ PACKAGE_DIR = ${ENGINE_DIR}/relay
CLI_DIR = ./cli
DOCS_DIR = ./docs
PYPROJECT_CONFIG_FILE = ${ENGINE_DIR}/pyproject.toml
DOCKERFILE = ${ENGINE_DIR}/Dockerfile
PYTHON_REQ_FILE = /tmp/requirements.txt
REPO_OWNER ?= relaycli
REPO_NAME ?= relay
DOCKER_NAMESPACE ?= ghcr.io/${REPO_OWNER}
DOCKER_TAG ?= latest
DOCKER_PLATFORM ?= linux/amd64

.PHONY: help install install-quality lint-check lint-format precommit typing-check deps-check quality style init-gh-labels init-gh-settings install-mintlify start-mintlify

Expand Down Expand Up @@ -58,6 +62,20 @@ build: ${PYPROJECT_CONFIG_FILE} ## Build the package
publish: ${ENGINE_DIR} ## Publish the package to PyPI
uv publish

lock: ${PYPROJECT_CONFIG_FILE}
uv lock --project ${ENGINE_DIR}

docker: ${DOCKERFILE}
docker buildx build --platform ${DOCKER_PLATFORM} -f ${DOCKERFILE} -t ${DOCKER_NAMESPACE}/${REPO_NAME}:${DOCKER_TAG} ${ENGINE_DIR}

# Docker login
docker-login:
$(eval PAT := $(shell gh auth token))
echo "${PAT}" | docker login ghcr.io -u ${REPO_OWNER} --password-stdin

docker-push: docker
docker push ${DOCKER_NAMESPACE}/${REPO_NAME}:${DOCKER_TAG}

########################################################
# Tests
########################################################
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<h2 align="center"></h2>

<p align="center">
<a href="https://github.com/relaycli/relay/actions?query=workflow%3Aengine">
<img alt="CI Status" src="https://img.shields.io/github/actions/workflow/status/relaycli/relay/engine.yml?branch=main&label=CI&logo=github&style=flat-square">
<a href="https://github.com/relaycli/relay/actions?query=workflow%3Acore">
<img alt="CI Status" src="https://img.shields.io/github/actions/workflow/status/relaycli/relay/core.yml?branch=main&label=CI&logo=github&style=flat-square">
</a>
<a href="https://github.com/astral-sh/ruff">
<img src="https://img.shields.io/badge/Linter-Ruff-FCC21B?style=flat-square&logo=ruff&logoColor=white" alt="ruff">
Expand Down
2 changes: 1 addition & 1 deletion docs/documentation/getting-started/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ description: 'From zero to "Hello inbox" in under 5 minutes'
```shell
pip install uv
```

If you encounter issues, refer to the [official documentation](https://docs.astral.sh/uv/getting-started/installation).
</Tab>
<Tab title="pip">
Expand Down
18 changes: 9 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ authors = [{ name = "Relay team", email = "[email protected]" }]
readme = "README.md"
keywords = ["cli", "imap", "smtp", "gmail", "outlook", "email", "inbox"]
dependencies = [
"typer>=0.16.0,<1.0.0",
"rich>=13.0.0,<14.0.0",
"questionary>=2.0.0,<3.0.0",
"pydantic>=2.10.0,<3.0.0",
"email-validator>=2.0.0,<3.0.0",
"cryptography>=44.0.0,<46.0.0",
"beautifulsoup4>=4.12.3,<5.0.0",
"html2text>=2025.4.15",
"typer>=0.16.0,<1.0.0",
"rich>=13.0.0,<14.0.0",
"questionary>=2.0.0,<3.0.0",
]
classifiers = [
# https://pypi.org/classifiers/
Expand Down Expand Up @@ -57,14 +57,14 @@ quality = [
"pre-commit==4.2.0",
]
test = [
"pytest>=8.3.3,<9.0.0",
"pytest-cov>=6.0.0,<7.0.0",
"pytest-pretty>=1.0.0,<2.0.0",
"pytest-mock>=3.14.1,<4.0.0",
"pytest==8.4.1",
"pytest-cov==6.2.1",
"pytest-pretty==1.3.0",
"pytest-mock==3.14.1",
]

[project.scripts]
relay = "cli.main:app"
relay = "relay.cli.main:app"

[project.urls]
homepage = "https://relaycli.com"
Expand Down Expand Up @@ -170,7 +170,7 @@ known-third-party = ["typer", "aioimaplib", "pydantic"]
"**/version.py" = ["CPY001"]
".github/**.py" = ["D", "T201", "ANN"]
"tests/**.py" = ["D103", "CPY001", "S101", "T201", "ANN001", "ANN201", "ANN202", "ARG001", "RUF029", "RUF030", "DTZ003", "PT003", "DOC", "D", "SLF"]
"cli/**.py" = ["ANN", "BLE001", "DOC"]
"relay/cli/**.py" = ["ANN", "BLE001", "DOC"]
"relay/**.py" = ["PT028"]

[tool.ruff.format]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading