-
-
Notifications
You must be signed in to change notification settings - Fork 460
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
2,549 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,26 +15,30 @@ jobs: | |
- name: Check out repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: "Install rye" | ||
id: setup-rye | ||
uses: eifinger/setup-rye@v4 | ||
- name: Install uv | ||
uses: astral-sh/setup-uv@v5 | ||
with: | ||
version: '0.43.0' | ||
checksum: 'ca702c3d93fd6ec76a1a0efaaa605e10736ee79a0674d241aad1bc0fe26f7d80' | ||
# Install a specific version of uv. | ||
version: "0.5.21" | ||
enable-cache: true | ||
|
||
- name: Install OS dependencies | ||
run: | | ||
sudo apt update | ||
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 | ||
if: steps.setup-rye.outputs.cache-hit != 'true' | ||
run: rye sync --no-lock | ||
if: steps.setup-uv.outputs.cache-hit != 'true' | ||
run: uv sync --locked --all-extras | ||
|
||
- name: Check formatting & linting | ||
run: | | ||
rye run pre-commit run --all-files | ||
uv run pre-commit run --all-files | ||
test: | ||
|
@@ -70,23 +74,27 @@ jobs: | |
- name: Check out repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install rye | ||
id: setup-rye | ||
uses: eifinger/setup-rye@v4 | ||
- name: Install uv | ||
uses: astral-sh/setup-uv@v5 | ||
with: | ||
version: '0.43.0' | ||
checksum: 'ca702c3d93fd6ec76a1a0efaaa605e10736ee79a0674d241aad1bc0fe26f7d80' | ||
# Install a specific version of uv. | ||
version: "0.5.21" | ||
enable-cache: true | ||
cache-prefix: 'rye-cache' | ||
|
||
- name: Install OS dependencies | ||
run: | | ||
sudo apt update | ||
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 | ||
if: steps.setup-rye.outputs.cache-hit != 'true' | ||
run: rye sync --no-lock | ||
if: steps.setup-uv.outputs.cache-hit != 'true' | ||
run: uv sync --locked --all-extras | ||
|
||
|
||
- name: Start Redis v6 | ||
uses: superchargejs/[email protected] | ||
|
@@ -95,8 +103,7 @@ jobs: | |
|
||
- name: Run db migration | ||
run: | | ||
rye install alembic | ||
CONFIG=tests/test.env rye run alembic upgrade head | ||
CONFIG=tests/test.env uv run alembic upgrade head | ||
- name: Prepare version file | ||
run: | | ||
|
@@ -105,7 +112,7 @@ jobs: | |
- name: Test with pytest | ||
run: | | ||
rye run pytest | ||
uv run pytest | ||
env: | ||
GITHUB_ACTIONS_TEST: true | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,15 +20,15 @@ SimpleLogin backend consists of 2 main components: | |
## Install dependencies | ||
|
||
The project requires: | ||
- Python 3.10 and rye to manage dependencies | ||
- Python 3.10 and uv to manage dependencies | ||
- Node v10 for front-end. | ||
- Postgres 13+ | ||
|
||
First, install all dependencies by running the following command. | ||
Feel free to use `virtualenv` or similar tools to isolate development environment. | ||
|
||
```bash | ||
rye sync | ||
uv sync | ||
``` | ||
|
||
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 | ||
|
||
```bash | ||
rye run pre-commit install | ||
uv run pre-commit install | ||
``` | ||
|
||
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 | ||
|
||
``` | ||
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 | ||
|
||
```bash | ||
rye run flake8 | ||
uv run flake8 | ||
``` | ||
|
||
For HTML templates, we use `djlint`. Before creating a pull request, please run | ||
|
||
```bash | ||
rye run djlint --check templates | ||
uv run djlint --check templates | ||
``` | ||
|
||
If some files aren't properly formatted, you can format all files with | ||
|
||
```bash | ||
rye run djlint --reformat . | ||
uv run djlint --reformat . | ||
``` | ||
|
||
## 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 | ||
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/[email protected]/libexec/bin:$PATH" to .zprofile | ||
|
||
# Install the dependencies | ||
rye sync | ||
# Although pipx is the recommended way to install uv, | ||
# 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! | ||
source .venv/bin/activate | ||
``` | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,10 +12,10 @@ docker run -p 25432:5432 --name ${container_name} -e POSTGRES_PASSWORD=postgres | |
sleep 3 | ||
|
||
# upgrade the DB to the latest stage and | ||
env DB_URI=postgresql://postgres:[email protected]:25432/sl rye run alembic upgrade head | ||
env DB_URI=postgresql://postgres:[email protected]:25432/sl uv run alembic upgrade head | ||
|
||
# generate the migration script. | ||
env DB_URI=postgresql://postgres:[email protected]:25432/sl rye run alembic revision --autogenerate $@ | ||
env DB_URI=postgresql://postgres:[email protected]:25432/sl uv run alembic revision --autogenerate $@ | ||
|
||
# remove the db | ||
docker rm -f ${container_name} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.