Merge pull request #808 from ae-utbm/update

Update Python and dependencies
This commit is contained in:
thomas girod 2024-09-02 13:59:23 +02:00 committed by GitHub
commit 6380fb193c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 374 additions and 377 deletions

View File

@ -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'

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
@ -265,12 +267,11 @@ class Club(models.Model):
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
@ -279,7 +280,6 @@ class MembershipQuerySet(models.QuerySet):
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):

View File

@ -362,7 +362,6 @@ class CounterQuerySet(models.QuerySet):
```
"""
subquery = user.counters.filter(pk=OuterRef("pk"))
# noinspection PyTypeChecker
return self.annotate(has_annotated_barman=Exists(subquery))

713
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -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"
@ -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"

View File

@ -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
@ -61,7 +62,7 @@ class SasFile(SithFile):
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:
@ -173,7 +174,7 @@ class Picture(SasFile):
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: