4.64.0
Some checks failed
Build-Release-Image / Build-Image (linux/amd64) (push) Successful in 3m25s
Build-Release-Image / Build-Image (linux/arm64) (push) Failing after 14m51s
Build-Release-Image / Merge-Images (push) Has been skipped
Build-Release-Image / Create-Release (push) Has been skipped
Build-Release-Image / Notify (push) Has been skipped

This commit is contained in:
MrMeeb 2025-01-21 12:00:08 +00:00
parent 664cd32f81
commit dd6005ffdf
9 changed files with 2549 additions and 51 deletions

View File

@ -15,12 +15,11 @@ jobs:
- name: Check out repo - name: Check out repo
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: "Install rye" - name: Install uv
id: setup-rye uses: astral-sh/setup-uv@v5
uses: eifinger/setup-rye@v4
with: with:
version: '0.43.0' # Install a specific version of uv.
checksum: 'ca702c3d93fd6ec76a1a0efaaa605e10736ee79a0674d241aad1bc0fe26f7d80' version: "0.5.21"
enable-cache: true enable-cache: true
- name: Install OS dependencies - name: Install OS dependencies
@ -28,13 +27,18 @@ jobs:
sudo apt update sudo apt update
sudo apt install -y libre2-dev libpq-dev sudo apt install -y libre2-dev libpq-dev
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: Install dependencies - name: Install dependencies
if: steps.setup-rye.outputs.cache-hit != 'true' if: steps.setup-uv.outputs.cache-hit != 'true'
run: rye sync --no-lock run: uv sync --locked --all-extras
- name: Check formatting & linting - name: Check formatting & linting
run: | run: |
rye run pre-commit run --all-files uv run pre-commit run --all-files
test: test:
@ -70,23 +74,27 @@ jobs:
- name: Check out repo - name: Check out repo
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Install rye - name: Install uv
id: setup-rye uses: astral-sh/setup-uv@v5
uses: eifinger/setup-rye@v4
with: with:
version: '0.43.0' # Install a specific version of uv.
checksum: 'ca702c3d93fd6ec76a1a0efaaa605e10736ee79a0674d241aad1bc0fe26f7d80' version: "0.5.21"
enable-cache: true enable-cache: true
cache-prefix: 'rye-cache'
- name: Install OS dependencies - name: Install OS dependencies
run: | run: |
sudo apt update sudo apt update
sudo apt install -y libre2-dev libpq-dev sudo apt install -y libre2-dev libpq-dev
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: Install dependencies - name: Install dependencies
if: steps.setup-rye.outputs.cache-hit != 'true' if: steps.setup-uv.outputs.cache-hit != 'true'
run: rye sync --no-lock run: uv sync --locked --all-extras
- name: Start Redis v6 - name: Start Redis v6
uses: superchargejs/redis-github-action@1.1.0 uses: superchargejs/redis-github-action@1.1.0
@ -95,8 +103,7 @@ jobs:
- name: Run db migration - name: Run db migration
run: | run: |
rye install alembic CONFIG=tests/test.env uv run alembic upgrade head
CONFIG=tests/test.env rye run alembic upgrade head
- name: Prepare version file - name: Prepare version file
run: | run: |
@ -105,7 +112,7 @@ jobs:
- name: Test with pytest - name: Test with pytest
run: | run: |
rye run pytest uv run pytest
env: env:
GITHUB_ACTIONS_TEST: true GITHUB_ACTIONS_TEST: true

View File

@ -20,7 +20,7 @@ SimpleLogin backend consists of 2 main components:
## Install dependencies ## Install dependencies
The project requires: The project requires:
- Python 3.10 and rye to manage dependencies - Python 3.10 and uv to manage dependencies
- Node v10 for front-end. - Node v10 for front-end.
- Postgres 13+ - Postgres 13+
@ -28,7 +28,7 @@ First, install all dependencies by running the following command.
Feel free to use `virtualenv` or similar tools to isolate development environment. Feel free to use `virtualenv` or similar tools to isolate development environment.
```bash ```bash
rye sync uv sync
``` ```
On Mac, sometimes you might need to install some other packages via `brew`: On Mac, sometimes you might need to install some other packages via `brew`:
@ -55,7 +55,7 @@ brew install -s re2 pybind11
We use pre-commit to run all our linting and static analysis checks. Please run We use pre-commit to run all our linting and static analysis checks. Please run
```bash ```bash
rye run pre-commit install uv run pre-commit install
``` ```
To install it in your development environment. To install it in your development environment.
@ -160,25 +160,25 @@ Here are the small sum-ups of the directory structures and their roles:
The code is formatted using [ruff](https://github.com/astral-sh/ruff), to format the code, simply run The code is formatted using [ruff](https://github.com/astral-sh/ruff), to format the code, simply run
``` ```
rye run ruff format . uv run ruff format .
``` ```
The code is also checked with `flake8`, make sure to run `flake8` before creating the pull request by The code is also checked with `flake8`, make sure to run `flake8` before creating the pull request by
```bash ```bash
rye run flake8 uv run flake8
``` ```
For HTML templates, we use `djlint`. Before creating a pull request, please run For HTML templates, we use `djlint`. Before creating a pull request, please run
```bash ```bash
rye run djlint --check templates uv run djlint --check templates
``` ```
If some files aren't properly formatted, you can format all files with If some files aren't properly formatted, you can format all files with
```bash ```bash
rye run djlint --reformat . uv run djlint --reformat .
``` ```
## Test sending email ## Test sending email
@ -236,11 +236,18 @@ There are several ways to setup Python and manage the project dependencies on Ma
# we haven't managed to make python 3.12 work # we haven't managed to make python 3.12 work
brew install python3.10 brew install python3.10
# Install rye using the official installation script, found on https://rye.astral.sh/guide/installation/ # make sure to update the PATH so python, pip point to Python3
# for us it can be done by adding "export PATH=/opt/homebrew/opt/python@3.10/libexec/bin:$PATH" to .zprofile
# Install the dependencies # Although pipx is the recommended way to install uv,
rye sync # install pipx via brew will automatically install python 3.12
# and uv will then use python 3.12
# so we recommend using uv this way instead
curl -sSL https://install.python-uv.org | python3 -
uv install
# activate the virtualenv and you should be good to go! # activate the virtualenv and you should be good to go!
source .venv/bin/activate source .venv/bin/activate
```
```

View File

@ -6,8 +6,8 @@ RUN cd /code/static && npm ci
FROM --platform=linux/amd64 ubuntu:22.04 FROM --platform=linux/amd64 ubuntu:22.04
ARG RYE_VERSION="0.43.0" ARG UV_VERSION="0.5.21"
ARG RYE_HASH="ca702c3d93fd6ec76a1a0efaaa605e10736ee79a0674d241aad1bc0fe26f7d80" ARG UV_HASH="e108c300eafae22ad8e6d94519605530f18f8762eb58d2b98a617edfb5d088fc"
# Keeps Python from generating .pyc files in the container # Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONDONTWRITEBYTECODE=1
@ -18,18 +18,20 @@ ENV PYTHONUNBUFFERED=1
WORKDIR /code WORKDIR /code
# Copy dependency files # Copy dependency files
COPY pyproject.toml requirements.lock requirements-dev.lock .python-version ./ COPY pyproject.toml uv.lock .python-version ./
# Install deps # Install deps
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y curl netcat-traditional gcc python3-dev gnupg git libre2-dev build-essential pkg-config cmake ninja-build bash clang \ && apt-get install -y curl netcat-traditional gcc python3-dev gnupg git libre2-dev build-essential pkg-config cmake ninja-build bash clang \
&& curl -sSL "https://github.com/astral-sh/rye/releases/download/${RYE_VERSION}/rye-x86_64-linux.gz" > rye.gz \ && curl -sSL "https://github.com/astral-sh/uv/releases/download/${UV_VERSION}/uv-x86_64-unknown-linux-gnu.tar.gz" > uv.tar.gz \
&& echo "${RYE_HASH} rye.gz" | sha256sum -c - \ && echo "${UV_HASH} uv.tar.gz" | sha256sum -c - \
&& gunzip rye.gz \ && tar xf uv.tar.gz -C /tmp/ \
&& chmod +x rye \ && mv /tmp/uv-x86_64-unknown-linux-gnu/uv /usr/bin/uv \
&& mv rye /usr/bin/rye \ && mv /tmp/uv-x86_64-unknown-linux-gnu/uvx /usr/bin/uvx \
&& rye toolchain fetch `cat .python-version` \ && rm -rf /tmp/uv* \
&& rye sync --no-lock --no-dev \ && rm -f uv.tar.gz \
&& uv python install `cat .python-version` \
&& uv sync --locked \
&& apt-get autoremove -y \ && apt-get autoremove -y \
&& apt-get purge -y curl netcat-traditional build-essential pkg-config cmake ninja-build python3-dev clang\ && apt-get purge -y curl netcat-traditional build-essential pkg-config cmake ninja-build python3-dev clang\
&& apt-get autoremove -y \ && apt-get autoremove -y \

View File

@ -36,12 +36,12 @@ dependencies = [
"watchtower ~= 0.8.0", "watchtower ~= 0.8.0",
"sqlalchemy-utils == 0.36.8", "sqlalchemy-utils == 0.36.8",
"jwcrypto ~= 0.8", "jwcrypto ~= 0.8",
"yacron>=0.19.0", "yacron~=0.11.2",
"flask-debugtoolbar ~= 0.11.0", "flask-debugtoolbar ~= 0.11.0",
"requests_oauthlib ~= 1.3.0", "requests_oauthlib ~= 1.3.0",
"pyopenssl ~= 19.1.0", "pyopenssl ~= 19.1.0",
"aiosmtpd ~= 1.2", "aiosmtpd ~= 1.2",
"dnspython == 2.6.1", "dnspython==2.0.0",
"coloredlogs ~= 14.0", "coloredlogs ~= 14.0",
"pycryptodome ~= 3.9.8", "pycryptodome ~= 3.9.8",
"phpserialize ~= 1.3", "phpserialize ~= 1.3",
@ -71,11 +71,12 @@ dependencies = [
"MarkupSafe~=1.1.1", "MarkupSafe~=1.1.1",
"cryptography ~= 37.0.1", "cryptography ~= 37.0.1",
"SQLAlchemy ~= 1.3.24", "SQLAlchemy ~= 1.3.24",
"redis ~= 4.5.3", "redis==4.6.0",
"newrelic-telemetry-sdk ~= 0.5.0", "newrelic-telemetry-sdk ~= 0.5.0",
"aiospamc == 0.10", "aiospamc == 0.10",
"itsdangerous ~= 1.1.0", "itsdangerous ~= 1.1.0",
"werkzeug ~= 1.0.1", "werkzeug ~= 1.0.1",
"alembic ~= 1.4.3",
] ]
[tool.black] [tool.black]
@ -128,7 +129,7 @@ dev-dependencies = [
"pytest-cov ~= 3.0.0", "pytest-cov ~= 3.0.0",
"pre-commit ~= 2.17.0", "pre-commit ~= 2.17.0",
"black ~= 22.1.0", "black ~= 22.1.0",
"djlint ~= 1.3.0", "djlint==1.34.1",
"pylint ~= 2.14.4", "pylint ~= 2.14.4",
"ruff ~= 0.1.5", "ruff ~= 0.1.5",
] ]

View File

@ -12,10 +12,10 @@ docker run -p 25432:5432 --name ${container_name} -e POSTGRES_PASSWORD=postgres
sleep 3 sleep 3
# upgrade the DB to the latest stage and # upgrade the DB to the latest stage and
env DB_URI=postgresql://postgres:postgres@127.0.0.1:25432/sl rye run alembic upgrade head env DB_URI=postgresql://postgres:postgres@127.0.0.1:25432/sl uv run alembic upgrade head
# generate the migration script. # generate the migration script.
env DB_URI=postgresql://postgres:postgres@127.0.0.1:25432/sl rye run alembic revision --autogenerate $@ env DB_URI=postgresql://postgres:postgres@127.0.0.1:25432/sl uv run alembic revision --autogenerate $@
# remove the db # remove the db
docker rm -f ${container_name} docker rm -f ${container_name}

View File

@ -3,5 +3,5 @@
export DB_URI=postgresql://myuser:mypassword@localhost:15432/simplelogin export DB_URI=postgresql://myuser:mypassword@localhost:15432/simplelogin
echo 'drop schema public cascade; create schema public;' | psql $DB_URI echo 'drop schema public cascade; create schema public;' | psql $DB_URI
rye run alembic upgrade head uv run alembic upgrade head
rye run flask dummy-data uv run flask dummy-data

View File

@ -3,4 +3,4 @@
export DB_URI=postgresql://myuser:mypassword@localhost:15432/test export DB_URI=postgresql://myuser:mypassword@localhost:15432/test
echo 'drop schema public cascade; create schema public;' | psql $DB_URI echo 'drop schema public cascade; create schema public;' | psql $DB_URI
rye run alembic upgrade head uv run alembic upgrade head

View File

@ -10,10 +10,10 @@ docker run -d --name sl-test-db -e POSTGRES_PASSWORD=test -e POSTGRES_USER=test
sleep 3 sleep 3
# migrate the DB to the latest version # migrate the DB to the latest version
CONFIG=tests/test.env rye run alembic upgrade head CONFIG=tests/test.env uv run alembic upgrade head
# run test # run test
rye run pytest -c pytest.ci.ini uv run pytest -c pytest.ci.ini
# Delete the test DB # Delete the test DB
docker rm -f sl-test-db docker rm -f sl-test-db

2481
app/uv.lock generated Normal file

File diff suppressed because it is too large Load Diff