Skip to content

Commit

Permalink
Merge pull request #1033 from betagouv/feature/uv-deps
Browse files Browse the repository at this point in the history
[chore] Utilisation de UV pour la gestion des dépendances
  • Loading branch information
glibersat authored Feb 11, 2025
2 parents c15f200 + 4cadd1b commit d212170
Show file tree
Hide file tree
Showing 7 changed files with 6,025 additions and 134 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,14 @@ jobs:
# Maps tcp port 5432 on service container to the host
- 5432:5432

strategy:
matrix:
python-version: ['3.11']

steps:
- name: Check out repository code
uses: actions/[email protected]

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5.1.0
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version-file: "pyproject.toml"

- name: Setup Node.js
uses: actions/setup-node@v4
Expand All @@ -62,6 +58,12 @@ jobs:
sudo apt-get update
sudo apt-get install python3-gdal pandoc
- name: Install uv and python
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Compile JS
working-directory: ./recoco/frontend
run: |
Expand All @@ -70,10 +72,8 @@ jobs:
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install wheel
pip install -r requirements.txt
pip install -r requirements-dev.txt
uv sync --no-dev
uv sync --only-dev
- name: Configure
run: |
Expand All @@ -90,4 +90,4 @@ jobs:
DJANGO_DB_PORT: 5432
DJANGO_DB_ENGINE: django.db.backends.postgresql
run: |
pytest --create-db
uv run pytest --create-db
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ repos:
hooks:
- id: django-upgrade
args: [--target-version, "5.0"]

- repo: https://github.com/astral-sh/uv-pre-commit
# uv version.
rev: 0.5.30
hooks:
- id: uv-lock
- id: uv-export
117 changes: 117 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,70 @@
[project]
name = "recoco"
version = "6.2.2"
description = "Recommandations Collaboratives"
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"beautifulsoup4==4.12.3",
"celery==5.4.0",
"django>4,<5.0",
"django-activity-stream",
"django-admin-csvexport==2.2",
"django-allauth[openid,socialaccount]==0.63.6",
"django-autoslug==1.9.9",
"django-celery-results==2.5.1",
"django-clone==5.3.3",
"django-compressor==4.4",
"django-cookie-consent",
"django-crispy-forms==2.0",
"django-dbtemplates",
"django-filter>=24.3",
"django-gravatar2>=1.4.5",
"django-guardian==2.4.0",
"django-hijack==3.4.5",
"django-json-widget==2.0.1",
"django-leaflet>=0.31.0",
"django-magicauth",
"django-markdownx==4.0.7",
"django-multisite",
"django-notifications-hq",
"django-ordered-model==3.7.4",
"django-otp==1.3.0",
"django-phonenumber-field[phonenumbers]==6.3.0",
"django-recaptcha==3.0.0",
"django-reversion==5.0.2",
"django-reversion-compare==0.17.0",
"django-sass-processor==1.4",
"django-sesame[ua]==3.2.2",
"django-tagging",
"django-taggit==5.0.1",
"django-vite==3.0.3",
"django-waffle==4.1.0",
"django-watson==1.6.3",
"django-webhook",
"djangorestframework==3.15.2",
"djangorestframework-simplejwt>=5.4.0",
"djangorestframework-xml>=2.0.0",
"drf-spectacular[sidecar]>=0.28.0",
"dynamic-django-forms>=0.1.11",
"ipython>=8.32.0",
"libsass>=0.23.0",
"lxml[html-clean]>=5.3.1",
"markdown-link-attr-modifier==0.2.1",
"metabase-api==3.4",
"multimethod==1.7",
"mwclient==0.11.0",
"pandoc==2.4",
"psycopg[binary]>3",
"redis==5.0.4",
"requests-html==0.10.0",
"rest-framework-generic-relations>=2.2.0",
"sentry-sdk>=2.20.0",
"setuptools==70.2.0",
"sib-api-v3-sdk>=7.6.0",
"wagtail==6.2.2",
]

[tool.djlint]
# ignore = "W013"
extension = "html"
Expand Down Expand Up @@ -91,3 +158,53 @@ section-order = [

[tool.ruff.lint.flake8-bandit]
check-typed-exception = true

[tool.uv.sources]
django-magicauth = { git = "https://github.com/glibersat/django-magicauth", rev = "55eab0b91c95012944933b342748540b2c1b31bf" }
django-notifications-hq = { git = "https://github.com/glibersat/django-notifications.git", rev = "feature/sites-framework" }
django-activity-stream = { git = "https://github.com/glibersat/django-activity-stream.git", rev = "django4" }
django-multisite = { git = "https://github.com/protoroto/django-multisite.git", rev = "feature/add-django4-support" }
django-dbtemplates = { git = "https://github.com/jazzband/django-dbtemplates.git", rev = "master" }
django-cookie-consent = { git = "https://github.com/jazzband/django-cookie-consent", rev = "master" }
django-tagging = { git = "https://github.com/nextories/django-tagging.git", rev = "bug/usage_for_model_with_filters_none" }
django-webhook = { git = "https://github.com/etchegom/django-webhook.git", rev = "recoco" }

[dependency-groups]
dev = [
"black>=25.1.0",
"coverage==7.4.1",
"django-coverage-plugin>=3.1.0",
"django-debug-toolbar==4.3.0",
"django-extensions==3.2.1",
"fabric==3.2.2",
"freezegun>=1.5.1",
"graphviz==0.20.1",
"ipykernel==6.20.1",
"ipython>=8.32.0",
"jupyter==1.0.0",
"jupytext==1.16.1",
"model-bakery==1.17.0",
"notebook==6.4.12",
"pre-commit==3.6.0",
"pylint>=3.3.4",
"pylint-django>=2.6.1",
"pytest==8.0.1",
"pytest-cov==4.1.0",
"pytest-django==4.8.0",
"pytest-icdiff==0.9",
"pytest-mock==3.12.0",
"pytest-subtests==0.11.0",
"pytest-sugar==1.0.0",
"pytest-xdist==3.5.0",
"python-dotenv>=1.0.1",
"pytz>=2025.1",
"requests-mock==1.12.1",
"responses==0.25.3",
"rich>=13.9.4",
"semgrep==1.61.1",
"sphinx-autodoc-annotation>=1.0.post1",
"sphinx-js>=4.0.0",
"sphinx-toolbox>=3.8.2",
"sphinxcontrib-django>=2.5",
"sphinxcontrib-django-urls>=0.3",
]
14 changes: 9 additions & 5 deletions recoco/rest_api/tests/test_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,15 @@ def test_is_staff_for_site_or_is_authenticated_read_only(
):
std_request.method = request_method

with patch(
"django.contrib.auth.models.User.is_authenticated", new_callable=PropertyMock
) as mock_is_authenticated, patch(
"recoco.rest_api.permissions.is_staff_for_site"
) as mock_is_staff_for_site:
with (
patch(
"django.contrib.auth.models.User.is_authenticated",
new_callable=PropertyMock,
) as mock_is_authenticated,
patch(
"recoco.rest_api.permissions.is_staff_for_site"
) as mock_is_staff_for_site,
):
mock_is_authenticated.return_value = user_is_authenticated
mock_is_staff_for_site.return_value = is_staff_return_value

Expand Down
37 changes: 0 additions & 37 deletions requirements-dev.txt

This file was deleted.

Loading

0 comments on commit d212170

Please sign in to comment.