Skip to content

Commit

Permalink
Merge pull request #808 from ae-utbm/update
Browse files Browse the repository at this point in the history
Update Python and dependencies
  • Loading branch information
imperosol authored Sep 2, 2024
2 parents 6918e30 + 341ffc9 commit 6380fb1
Show file tree
Hide file tree
Showing 10 changed files with 374 additions and 377 deletions.
6 changes: 3 additions & 3 deletions .github/actions/setup_project/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ runs:
shell: bash

- name: Set up python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"

- name: Load cached Poetry installation
id: cached-poetry
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-0 # increment to reset cache
key: poetry-1 # increment to reset cache

- name: Install Poetry
if: steps.cached-poetry.outputs.cache-hit != 'true'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ jobs:
export PATH="/home/sith/.local/bin:$PATH"
pushd ${{secrets.SITH_PATH}}
git pull
git fetch
git reset --hard origin/master
poetry install --with prod --without docs,tests
poetry run ./manage.py install_xapian
poetry run ./manage.py migrate
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ./.github/actions/setup_project
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v3
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/taiste.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ jobs:
export PATH="$HOME/.poetry/bin:$PATH"
pushd ${{secrets.SITH_PATH}}
git pull
git fetch
git reset --hard origin/taiste
poetry install --with prod --without docs,tests
poetry run ./manage.py install_xapian
poetry run ./manage.py migrate
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.5.5
rev: v0.5.7
hooks:
- id: ruff # just check the code, and print the errors
- id: ruff # actually fix the fixable errors, but print nothing
Expand Down
8 changes: 4 additions & 4 deletions club/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#
from __future__ import annotations

from typing import Self

from django.conf import settings
from django.core import validators
from django.core.cache import cache
Expand Down Expand Up @@ -265,12 +267,11 @@ def has_rights_in_club(self, user):


class MembershipQuerySet(models.QuerySet):
def ongoing(self) -> "MembershipQuerySet":
def ongoing(self) -> Self:
"""Filter all memberships which are not finished yet."""
# noinspection PyTypeChecker
return self.filter(Q(end_date=None) | Q(end_date__gte=timezone.now()))

def board(self) -> "MembershipQuerySet":
def board(self) -> Self:
"""Filter all memberships where the user is/was in the board.
Be aware that users who were in the board in the past
Expand All @@ -279,7 +280,6 @@ def board(self) -> "MembershipQuerySet":
If you want to get the users who are currently in the board,
mind combining this with the :meth:`ongoing` queryset method
"""
# noinspection PyTypeChecker
return self.filter(role__gt=settings.SITH_MAXIMUM_FREE_ROLE)

def update(self, **kwargs):
Expand Down
1 change: 0 additions & 1 deletion counter/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,6 @@ def annotate_has_barman(self, user: User) -> CounterQuerySet:
```
"""
subquery = user.counters.filter(pk=OuterRef("pk"))
# noinspection PyTypeChecker
return self.annotate(has_annotated_barman=Exists(subquery))


Expand Down
713 changes: 354 additions & 359 deletions poetry.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ homepage = "https://ae.utbm.fr/"
license = "GPL-3.0-only"

[tool.poetry.dependencies]
python = "^3.10"
python = "^3.12"
Django = "^4.2.14"
django-ninja = "^1.2.2"
django-ninja-extra = "^0.21.2"
django-ninja = "^1.3.0"
django-ninja-extra = "^0.21.4"
Pillow = "^10.4.0"
mistune = "^3.0.2"
django-jinja = "^2.11"
Expand Down Expand Up @@ -63,7 +63,7 @@ optional = true
django-debug-toolbar = "^4.4.6"
ipython = "^8.26.0"
pre-commit = "^3.8.0"
ruff = "^0.5.5" # Version used in pipeline is controlled by pre-commit hooks in .pre-commit.config.yaml
ruff = "^0.5.7" # Version used in pipeline is controlled by pre-commit hooks in .pre-commit.config.yaml
djhtml = "^3.0.6"
faker = "^26.1.0"
rjsmin = "^1.2.2"
Expand Down
5 changes: 3 additions & 2 deletions sas/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from __future__ import annotations

from io import BytesIO
from typing import Self

from django.conf import settings
from django.core.cache import cache
Expand Down Expand Up @@ -61,7 +62,7 @@ def can_be_edited_by(self, user):


class PictureQuerySet(models.QuerySet):
def viewable_by(self, user: User) -> PictureQuerySet:
def viewable_by(self, user: User) -> Self:
"""Filter the pictures that this user can view.
Warnings:
Expand Down Expand Up @@ -173,7 +174,7 @@ def get_previous(self):


class AlbumQuerySet(models.QuerySet):
def viewable_by(self, user: User) -> PictureQuerySet:
def viewable_by(self, user: User) -> Self:
"""Filter the albums that this user can view.
Warnings:
Expand Down

0 comments on commit 6380fb1

Please sign in to comment.