Skip to content
Open
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
10 changes: 8 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
version: 2
updates:
- package-ecosystem: pip
- package-ecosystem: uv
directory: "/"
schedule:
interval: monthly
open-pull-requests-limit: 20
open-pull-requests-limit: 15
labels:
- 'dependencies'
groups:
python-packages:
patterns:
- "*"
42 changes: 25 additions & 17 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,31 @@ jobs:
TEST_DATABASE_URL: 'postgresql://postgres:postgres@localhost:5432/morpheus_test'

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: set up python
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '3.12'

- name: install uv
uses: astral-sh/setup-uv@v4
with:
version: "0.10.4"

- name: install dependencies
run: |
make install
pip freeze
run: make install-dev

- name: lint
run: make lint

- name: test
run: make test

- name: codecov
run: bash <(curl -s https://codecov.io/bash)
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: '1b5eacd0-b422-4654-970d-84acdb03cf53'
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

deploy:
needs:
Expand All @@ -64,7 +69,7 @@ jobs:
HEROKU_APP: tc-morpheus

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- run: git fetch --unshallow
- run: git switch master
- run: git remote add heroku https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP.git
Expand All @@ -75,20 +80,23 @@ jobs:
if: "success() && startsWith(github.ref, 'refs/tags/')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: set up python
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '3.12'

- name: install
run: |
make install
pip install -U wheel twine
- name: install uv
uses: astral-sh/setup-uv@v4
with:
version: "0.10.4"

- name: build
run: python setup.py sdist bdist_wheel
run: uv build

- name: install twine
run: uv pip install --system twine

- run: twine check dist/*

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.idea/
.DS_Store
env/
.venv/
*.py[cod]
*.egg-info/
build/
Expand Down
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
repos:
- repo: local
hooks:
- id: lint
name: Lint
entry: make lint
types: [python]
language: system
pass_filenames: false
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.9.14
3.12
33 changes: 20 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
black = black -S -l 120 --target-version py38
isort = isort -w 120

PHONY: install
.PHONY: install
install:
pip install -r requirements.txt
pip install -r tests/requirements.txt
uv sync

.PHONY: install-dev
install-dev:
uv sync --dev
uv run pre-commit install

.PHONY: format
format:
$(isort) src tests
$(black) src tests
uv run ruff check --fix src tests
uv run ruff format src tests

.PHONY: lint
lint:
flake8 src tests
$(isort) --check-only src tests
$(black) --check src tests
uv run ruff check src tests
uv run ruff format --check src tests

.PHONY: test
test:
pytest tests/ --cov=src
uv run pytest tests/ --cov=src

.PHONY: run-dev
run-dev:
uv run foxglove web

.PHONY: run-worker
run-worker:
uv run foxglove worker

.PHONY: reset-db
reset-db:
Expand All @@ -35,4 +43,3 @@ reset-db:
.PHONY: run_patch
run_patch:
foxglove patch $(PATCH) $(if $(LIVE),--live,) --patch-args ':'

3 changes: 3 additions & 0 deletions bin/post_compile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
set -e
uv sync --locked --no-default-groups --group app
132 changes: 132 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
[build-system]
requires = ["setuptools>=75.0"]
build-backend = "setuptools.build_meta"

[project]
name = "morpheus-mail"
version = "1.0.42"
description = "Email rendering engine from morpheus"
readme = {text = """
Note: this only installs the rendering logic for `morpheus <https://github.com/tutorcruncher/morpheus>` \
for testing and email preview.

Everything else is excluded to avoid installing unnecessary packages.
""", content-type = "text/plain"}
authors = [{name = "Samuel Colvin", email = "s@muelcolvin.com"}]
license = {text = "MIT"}
requires-python = ">=3.12"
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.12",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: MIT License",
"Operating System :: Unix",
"Operating System :: POSIX :: Linux",
"Topic :: Internet",
]
dependencies = [
"chevron>=0.11.1",
"libsass>=0.13.2",
"misaka>=2.1.1",
]

[project.urls]
Homepage = "https://github.com/tutorcruncher/morpheus"

[tool.setuptools.packages.find]
where = ["."]
include = ["morpheus.render"]

[tool.setuptools.package-dir]
"morpheus.render" = "src/render"

[tool.uv]
default-groups = ["app", "dev"]

[dependency-groups]
app = [
"aiofiles==23.1.0",
"aioredis==1.3.1",
"arq==0.22",
"buildpg==0.4",
"chevron==0.14.0",
"click==8.1.3",
"fastapi==0.68.1",
"foxglove-web==0.0.33",
"jinja2==3.1.2",
"libsass==0.22.0",
"misaka==2.1.1",
"MarkupSafe==2.1.2",
"phonenumbers==8.13.6",
"pydantic[email]==1.10.21",
"python-multipart==0.0.6",
"python-pdf==0.39",
"requests==2.28.2",
"starlette==0.14.2",
"logfire[fastapi,requests]==4.31.0",
"sentry-sdk==2.19.2",
"tqdm==4.64.1",
"ua-parser==0.16.1",
"uvicorn==0.20.0",
"ipython==8.11.0",
"setuptools==78.0.2",
"openai==1.85.0",
"python-dotenv==1.1.1",
]
dev = [
"aiohttp==3.9.5",
"coverage==7.6.1",
"docutils==0.19",
"pytest==8.3.5",
"pytest-cov==6.1.1",
"pytest-mock==3.10.0",
"pytest-sugar==0.9.6",
"pytest-timeout==2.1.0",
"pre-commit==4.5.1",
"ruff==0.15.8",
]

[tool.pytest.ini_options]
testpaths = ["tests"]
filterwarnings = [
"error",
"ignore::DeprecationWarning:asyncio.base_events",
"ignore::aiohttp.web_exceptions.NotAppKeyWarning",
"ignore::pytest.PytestUnraisableExceptionWarning",
]
timeout = 20
markers = [
"spam: Using this marker on a test will mark the emails that test as spam.",
"spam_service_error: Using this marker on a test will mark the emails that test as spam service error.",
]

[tool.coverage.run]
branch = true
omit = ["src/patches.py"]

[tool.coverage.report]
precision = 2
exclude_lines = [
"pragma: no cover",
"raise NotImplementedError",
"raise NotImplemented",
]

[tool.ruff]
line-length = 120

[tool.ruff.lint]
extend-select = ["I"]
ignore = ["E402"]

[tool.ruff.format]
quote-style = "single"

[tool.ruff.lint.isort]
combine-as-imports = true
27 changes: 0 additions & 27 deletions requirements.txt

This file was deleted.

1 change: 0 additions & 1 deletion runtime.txt

This file was deleted.

41 changes: 0 additions & 41 deletions setup.cfg

This file was deleted.

Loading
Loading