-
-
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.
feat: use rye as project manager (#2359)
* feat: use rye as project manager * chore: change poetry to rye for scripts * ci: avoid duplicate executions * Remove unused check and rename check * removed unused parallel tasks * Remove strategy altogether --------- Co-authored-by: Adrià Casajús <[email protected]>
- Loading branch information
1 parent
864b5d1
commit 20056a1
Showing
11 changed files
with
1,038 additions
and
175 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 |
---|---|---|
@@ -1,6 +1,12 @@ | ||
name: Test and lint | ||
name: SimpleLogin actions | ||
|
||
on: [push, pull_request] | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
lint: | ||
|
@@ -9,35 +15,30 @@ jobs: | |
- name: Check out repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install poetry | ||
run: pipx install poetry | ||
|
||
- uses: actions/setup-python@v4 | ||
- name: "Install rye" | ||
id: setup-rye | ||
uses: eifinger/setup-rye@v4 | ||
with: | ||
python-version: '3.10' | ||
cache: 'poetry' | ||
version: '0.43.0' | ||
checksum: 'ca702c3d93fd6ec76a1a0efaaa605e10736ee79a0674d241aad1bc0fe26f7d80' | ||
enable-cache: true | ||
|
||
- name: Install OS dependencies | ||
if: ${{ matrix.python-version }} == '3.10' | ||
run: | | ||
sudo apt update | ||
sudo apt install -y libre2-dev libpq-dev | ||
- name: Install dependencies | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: poetry install --no-interaction | ||
if: steps.setup-rye.outputs.cache-hit != 'true' | ||
run: rye sync --no-lock | ||
|
||
- name: Check formatting & linting | ||
run: | | ||
poetry run pre-commit run --all-files | ||
rye run pre-commit run --all-files | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
max-parallel: 4 | ||
matrix: | ||
python-version: ["3.10"] | ||
|
||
# service containers to run with `postgres-job` | ||
services: | ||
|
@@ -69,24 +70,23 @@ jobs: | |
- name: Check out repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install poetry | ||
run: pipx install poetry | ||
|
||
- uses: actions/setup-python@v4 | ||
- name: Install rye | ||
id: setup-rye | ||
uses: eifinger/setup-rye@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'poetry' | ||
version: '0.43.0' | ||
checksum: 'ca702c3d93fd6ec76a1a0efaaa605e10736ee79a0674d241aad1bc0fe26f7d80' | ||
enable-cache: true | ||
cache-prefix: 'rye-cache' | ||
|
||
- name: Install OS dependencies | ||
if: ${{ matrix.python-version }} == '3.10' | ||
run: | | ||
sudo apt update | ||
sudo apt install -y libre2-dev libpq-dev | ||
- name: Install dependencies | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: poetry install --no-interaction | ||
|
||
if: steps.setup-rye.outputs.cache-hit != 'true' | ||
run: rye sync --no-lock | ||
|
||
- name: Start Redis v6 | ||
uses: superchargejs/[email protected] | ||
|
@@ -95,7 +95,8 @@ jobs: | |
|
||
- name: Run db migration | ||
run: | | ||
CONFIG=tests/test.env poetry run alembic upgrade head | ||
rye install alembic | ||
CONFIG=tests/test.env rye run alembic upgrade head | ||
- name: Prepare version file | ||
run: | | ||
|
@@ -104,7 +105,7 @@ jobs: | |
- name: Test with pytest | ||
run: | | ||
poetry run pytest | ||
rye 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
3.10.16 |
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 poetry to manage dependencies | ||
- Python 3.10 and rye 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 | ||
poetry sync | ||
rye 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 | ||
poetry run pre-commit install | ||
rye 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 | ||
|
||
``` | ||
poetry run ruff format . | ||
rye run ruff format . | ||
``` | ||
|
||
The code is also checked with `flake8`, make sure to run `flake8` before creating the pull request by | ||
|
||
```bash | ||
poetry run flake8 | ||
rye run flake8 | ||
``` | ||
|
||
For HTML templates, we use `djlint`. Before creating a pull request, please run | ||
|
||
```bash | ||
poetry run djlint --check templates | ||
rye run djlint --check templates | ||
``` | ||
|
||
If some files aren't properly formatted, you can format all files with | ||
|
||
```bash | ||
poetry run djlint --reformat . | ||
rye run djlint --reformat . | ||
``` | ||
|
||
## Test sending email | ||
|
@@ -236,18 +236,11 @@ 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 | ||
|
||
# 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 rye using the official installation script, found on https://rye.astral.sh/guide/installation/ | ||
|
||
# Although pipx is the recommended way to install poetry, | ||
# install pipx via brew will automatically install python 3.12 | ||
# and poetry will then use python 3.12 | ||
# so we recommend using poetry this way instead | ||
curl -sSL https://install.python-poetry.org | python3 - | ||
|
||
poetry install | ||
# Install the dependencies | ||
rye sync | ||
|
||
# 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
Oops, something went wrong.