mirror of
https://github.com/suitenumerique/meet
synced 2026-04-25 17:25:22 +02:00
🔨(python-env) migrate meet main app to UV
Migrate main meet app to use UV for dependancy management. Also optimized the backend image build sequence for faster rebuilds when dependencies don't change. Also removed compiled django translations files are they are done in the build process now. Changes inspired by drive repo.
This commit is contained in:
@@ -4,7 +4,7 @@ __pycache__
|
|||||||
**/__pycache__
|
**/__pycache__
|
||||||
**/*.pyc
|
**/*.pyc
|
||||||
venv
|
venv
|
||||||
.venv
|
**/.venv
|
||||||
|
|
||||||
# System-specific files
|
# System-specific files
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|||||||
26
.github/workflows/meet.yml
vendored
26
.github/workflows/meet.yml
vendored
@@ -124,15 +124,17 @@ jobs:
|
|||||||
uses: actions/setup-python@v6
|
uses: actions/setup-python@v6
|
||||||
with:
|
with:
|
||||||
python-version: "3.13"
|
python-version: "3.13"
|
||||||
cache: "pip"
|
- name: Install uv
|
||||||
- name: Install development dependencies
|
uses: astral-sh/setup-uv@v7
|
||||||
run: pip install --user .[dev]
|
- name: Install the project
|
||||||
|
run: uv sync --locked --all-extras
|
||||||
|
|
||||||
- name: Check code formatting with ruff
|
- name: Check code formatting with ruff
|
||||||
run: ~/.local/bin/ruff format . --diff
|
run: uv run ruff format . --diff
|
||||||
- name: Lint code with ruff
|
- name: Lint code with ruff
|
||||||
run: ~/.local/bin/ruff check .
|
run: uv run ruff check .
|
||||||
- name: Lint code with pylint
|
- name: Lint code with pylint
|
||||||
run: ~/.local/bin/pylint meet demo core
|
run: uv run pylint meet demo core
|
||||||
|
|
||||||
lint-agents:
|
lint-agents:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -279,10 +281,10 @@ jobs:
|
|||||||
uses: actions/setup-python@v6
|
uses: actions/setup-python@v6
|
||||||
with:
|
with:
|
||||||
python-version: "3.13"
|
python-version: "3.13"
|
||||||
cache: "pip"
|
- name: Install uv
|
||||||
|
uses: astral-sh/setup-uv@v7
|
||||||
- name: Install development dependencies
|
- name: Install the dependencies
|
||||||
run: pip install --user .[dev]
|
run: uv sync --locked --all-extras
|
||||||
|
|
||||||
- name: Install gettext (required to compile messages)
|
- name: Install gettext (required to compile messages)
|
||||||
run: |
|
run: |
|
||||||
@@ -290,10 +292,10 @@ jobs:
|
|||||||
sudo apt-get install -y gettext
|
sudo apt-get install -y gettext
|
||||||
|
|
||||||
- name: Generate a MO file from strings extracted from the project
|
- name: Generate a MO file from strings extracted from the project
|
||||||
run: python manage.py compilemessages
|
run: uv run python manage.py compilemessages
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: ~/.local/bin/pytest -n 2
|
run: uv run pytest -n 2
|
||||||
|
|
||||||
lint-front:
|
lint-front:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -31,6 +31,7 @@ MANIFEST
|
|||||||
|
|
||||||
# Translations # Translations
|
# Translations # Translations
|
||||||
*.pot
|
*.pot
|
||||||
|
*.mo
|
||||||
|
|
||||||
# Environments
|
# Environments
|
||||||
.env
|
.env
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ and this project adheres to
|
|||||||
- ♿(frontend) improve chat toast a11y for screen readers #1109
|
- ♿(frontend) improve chat toast a11y for screen readers #1109
|
||||||
- ♿(frontend) improve ui and aria labels for help article links #1108
|
- ♿(frontend) improve ui and aria labels for help article links #1108
|
||||||
- 🌐(frontend) improve German translation #1125
|
- 🌐(frontend) improve German translation #1125
|
||||||
|
- 🔨(python-env) migrate meet main app to UV #1120
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|||||||
62
Dockerfile
62
Dockerfile
@@ -13,14 +13,28 @@ RUN apk update && \
|
|||||||
# ---- Back-end builder image ----
|
# ---- Back-end builder image ----
|
||||||
FROM base AS back-builder
|
FROM base AS back-builder
|
||||||
|
|
||||||
WORKDIR /builder
|
|
||||||
|
|
||||||
# Copy required python dependencies
|
ENV UV_COMPILE_BYTECODE=1
|
||||||
COPY ./src/backend /builder
|
ENV UV_LINK_MODE=copy
|
||||||
|
|
||||||
RUN mkdir /install && \
|
# Disable Python downloads, because we want to use the system interpreter
|
||||||
pip install --prefix=/install .
|
# across both images. If using a managed Python version, it needs to be
|
||||||
|
# copied from the build image into the final image;
|
||||||
|
ENV UV_PYTHON_DOWNLOADS=0
|
||||||
|
|
||||||
|
# install uv
|
||||||
|
COPY --from=ghcr.io/astral-sh/uv:0.10.9 /uv /uvx /bin/
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
|
||||||
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||||
|
--mount=type=bind,source=src/backend/uv.lock,target=uv.lock \
|
||||||
|
--mount=type=bind,source=src/backend/pyproject.toml,target=pyproject.toml \
|
||||||
|
uv sync --locked --no-install-project --no-dev
|
||||||
|
COPY src/backend /app
|
||||||
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||||
|
uv sync --locked --no-dev
|
||||||
|
|
||||||
# ---- mails ----
|
# ---- mails ----
|
||||||
FROM node:20 AS mail-builder
|
FROM node:20 AS mail-builder
|
||||||
@@ -30,7 +44,7 @@ COPY ./src/mail /mail/app
|
|||||||
WORKDIR /mail/app
|
WORKDIR /mail/app
|
||||||
|
|
||||||
RUN yarn install --frozen-lockfile && \
|
RUN yarn install --frozen-lockfile && \
|
||||||
yarn build
|
yarn build
|
||||||
|
|
||||||
|
|
||||||
# ---- static link collector ----
|
# ---- static link collector ----
|
||||||
@@ -42,17 +56,17 @@ RUN apk add \
|
|||||||
libmagic \
|
libmagic \
|
||||||
rdfind
|
rdfind
|
||||||
|
|
||||||
# Copy installed python dependencies
|
|
||||||
COPY --from=back-builder /install /usr/local
|
|
||||||
|
|
||||||
# Copy Meet application (see .dockerignore)
|
|
||||||
COPY ./src/backend /app/
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy the application from the builder
|
||||||
|
COPY --from=back-builder /app /app
|
||||||
|
|
||||||
|
ENV PATH="/app/.venv/bin:$PATH"
|
||||||
|
|
||||||
|
|
||||||
# collectstatic
|
# collectstatic
|
||||||
RUN DJANGO_CONFIGURATION=Build DJANGO_JWT_PRIVATE_SIGNING_KEY=Dummy \
|
RUN DJANGO_CONFIGURATION=Build DJANGO_JWT_PRIVATE_SIGNING_KEY=Dummy \
|
||||||
python manage.py collectstatic --noinput
|
python manage.py collectstatic --noinput
|
||||||
|
|
||||||
# Replace duplicated file by a symlink to decrease the overall size of the
|
# Replace duplicated file by a symlink to decrease the overall size of the
|
||||||
# final image
|
# final image
|
||||||
@@ -81,14 +95,17 @@ COPY ./docker/files/usr/local/bin/entrypoint /usr/local/bin/entrypoint
|
|||||||
# docker user (see entrypoint).
|
# docker user (see entrypoint).
|
||||||
RUN chmod g=u /etc/passwd
|
RUN chmod g=u /etc/passwd
|
||||||
|
|
||||||
# Copy installed python dependencies
|
# Copy the application from the builder
|
||||||
COPY --from=back-builder /install /usr/local
|
COPY --from=back-builder /app /app
|
||||||
|
|
||||||
# Copy Meet application (see .dockerignore)
|
|
||||||
COPY ./src/backend /app/
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
ENV PATH="/app/.venv/bin:$PATH"
|
||||||
|
|
||||||
|
# Generate compiled translation messages
|
||||||
|
RUN DJANGO_CONFIGURATION=Build \
|
||||||
|
python manage.py compilemessages --ignore=".venv/**/*"
|
||||||
|
|
||||||
# We wrap commands run in this container by the following entrypoint that
|
# We wrap commands run in this container by the following entrypoint that
|
||||||
# creates a user on-the-fly with the container user ID (see USER) and root group
|
# creates a user on-the-fly with the container user ID (see USER) and root group
|
||||||
# ID.
|
# ID.
|
||||||
@@ -103,10 +120,9 @@ USER root:root
|
|||||||
# Install psql
|
# Install psql
|
||||||
RUN apk add postgresql-client
|
RUN apk add postgresql-client
|
||||||
|
|
||||||
# Uninstall Meet and re-install it in editable mode along with development
|
# Install development dependencies
|
||||||
# dependencies
|
RUN --mount=from=ghcr.io/astral-sh/uv:0.10.9,source=/uv,target=/bin/uv \
|
||||||
RUN pip uninstall -y meet
|
uv sync --all-extras --locked
|
||||||
RUN pip install -e .[dev]
|
|
||||||
|
|
||||||
# Restore the un-privileged user running the application
|
# Restore the un-privileged user running the application
|
||||||
ARG DOCKER_USER
|
ARG DOCKER_USER
|
||||||
@@ -115,7 +131,7 @@ USER ${DOCKER_USER}
|
|||||||
# Target database host (e.g. database engine following docker compose services
|
# Target database host (e.g. database engine following docker compose services
|
||||||
# name) & port
|
# name) & port
|
||||||
ENV DB_HOST=postgresql \
|
ENV DB_HOST=postgresql \
|
||||||
DB_PORT=5432
|
DB_PORT=5432
|
||||||
|
|
||||||
# Run django development server
|
# Run django development server
|
||||||
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
|
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -223,7 +223,7 @@ superuser: ## Create an admin superuser with password "admin"
|
|||||||
.PHONY: superuser
|
.PHONY: superuser
|
||||||
|
|
||||||
back-i18n-compile: ## compile the gettext files
|
back-i18n-compile: ## compile the gettext files
|
||||||
@$(MANAGE) compilemessages --ignore="venv/**/*"
|
@$(MANAGE) compilemessages --ignore=".venv/**/*"
|
||||||
.PHONY: back-i18n-compile
|
.PHONY: back-i18n-compile
|
||||||
|
|
||||||
back-i18n-generate: ## create the .pot files used for i18n
|
back-i18n-generate: ## create the .pot files used for i18n
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ./src/backend:/app
|
- ./src/backend:/app
|
||||||
- ./data/static:/data/static
|
- ./data/static:/data/static
|
||||||
|
- /app/.venv
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgresql
|
- postgresql
|
||||||
- mailcatcher
|
- mailcatcher
|
||||||
@@ -105,6 +106,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ./src/backend:/app
|
- ./src/backend:/app
|
||||||
- ./data/static:/data/static
|
- ./data/static:/data/static
|
||||||
|
- /app/.venv
|
||||||
depends_on:
|
depends_on:
|
||||||
- app-dev
|
- app-dev
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ backend:
|
|||||||
# Extra volume to manage our local custom CA and avoid to set ssl_verify: false
|
# Extra volume to manage our local custom CA and avoid to set ssl_verify: false
|
||||||
extraVolumeMounts:
|
extraVolumeMounts:
|
||||||
- name: certs
|
- name: certs
|
||||||
mountPath: /usr/local/lib/python3.12/site-packages/certifi/cacert.pem
|
mountPath: /app/.venv/lib/python3.13/site-packages/certifi/cacert.pem
|
||||||
subPath: cacert.pem
|
subPath: cacert.pem
|
||||||
|
|
||||||
# Extra volume to manage our local custom CA and avoid to set ssl_verify: false
|
# Extra volume to manage our local custom CA and avoid to set ssl_verify: false
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2,8 +2,8 @@
|
|||||||
# Meet package
|
# Meet package
|
||||||
#
|
#
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["setuptools"]
|
requires = ["uv_build>=0.10.9,<0.11.0"]
|
||||||
build-backend = "setuptools.build_meta"
|
build-backend = "uv_build"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "meet"
|
name = "meet"
|
||||||
@@ -21,8 +21,7 @@ classifiers = [
|
|||||||
]
|
]
|
||||||
description = "A simple video and phone conferencing tool, powered by LiveKit"
|
description = "A simple video and phone conferencing tool, powered by LiveKit"
|
||||||
keywords = ["Django", "Contacts", "Templates", "RBAC"]
|
keywords = ["Django", "Contacts", "Templates", "RBAC"]
|
||||||
license = { file = "LICENSE" }
|
license = "MIT"
|
||||||
readme = "README.md"
|
|
||||||
requires-python = ">=3.13"
|
requires-python = ">=3.13"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"boto3==1.42.49",
|
"boto3==1.42.49",
|
||||||
@@ -70,7 +69,7 @@ dependencies = [
|
|||||||
"Homepage" = "https://github.com/suitenumerique/meet"
|
"Homepage" = "https://github.com/suitenumerique/meet"
|
||||||
"Repository" = "https://github.com/suitenumerique/meet"
|
"Repository" = "https://github.com/suitenumerique/meet"
|
||||||
|
|
||||||
[project.optional-dependencies]
|
[dependency-groups]
|
||||||
dev = [
|
dev = [
|
||||||
"django-extensions==4.1",
|
"django-extensions==4.1",
|
||||||
"drf-spectacular-sidecar==2026.1.1",
|
"drf-spectacular-sidecar==2026.1.1",
|
||||||
@@ -90,12 +89,13 @@ dev = [
|
|||||||
"types-requests==2.32.4.20260107",
|
"types-requests==2.32.4.20260107",
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.setuptools]
|
[tool.uv.build-backend]
|
||||||
packages = { find = { where = ["."], exclude = ["tests"] } }
|
module-root = ""
|
||||||
zip-safe = true
|
source-exclude = [
|
||||||
|
"**/tests/**",
|
||||||
[tool.distutils.bdist_wheel]
|
"**/test_*.py",
|
||||||
universal = true
|
"**/tests.py",
|
||||||
|
]
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
exclude = [
|
exclude = [
|
||||||
|
|||||||
2365
src/backend/uv.lock
generated
Normal file
2365
src/backend/uv.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -71,7 +71,7 @@ backend:
|
|||||||
SUMMARY_SERVICE_API_TOKEN: password
|
SUMMARY_SERVICE_API_TOKEN: password
|
||||||
RECORDING_DOWNLOAD_BASE_URL: https://meet.127.0.0.1.nip.io/recording
|
RECORDING_DOWNLOAD_BASE_URL: https://meet.127.0.0.1.nip.io/recording
|
||||||
ROOM_TELEPHONY_ENABLED: True
|
ROOM_TELEPHONY_ENABLED: True
|
||||||
SSL_CERT_FILE: /usr/local/lib/python3.12/site-packages/certifi/cacert.pem
|
SSL_CERT_FILE: /app/.venv/lib/python3.13/site-packages/certifi/cacert.pem
|
||||||
|
|
||||||
|
|
||||||
migrate:
|
migrate:
|
||||||
@@ -100,7 +100,7 @@ backend:
|
|||||||
# Extra volume mounts to manage our local custom CA and avoid to set ssl_verify: false
|
# Extra volume mounts to manage our local custom CA and avoid to set ssl_verify: false
|
||||||
extraVolumeMounts:
|
extraVolumeMounts:
|
||||||
- name: certs
|
- name: certs
|
||||||
mountPath: /usr/local/lib/python3.13/site-packages/certifi/cacert.pem
|
mountPath: /app/.venv/lib/python3.13/site-packages/certifi/cacert.pem
|
||||||
subPath: cacert.pem
|
subPath: cacert.pem
|
||||||
|
|
||||||
# Extra volumes to manage our local custom CA and avoid to set ssl_verify: false
|
# Extra volumes to manage our local custom CA and avoid to set ssl_verify: false
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ backend:
|
|||||||
ROOM_TELEPHONY_ENABLED: True
|
ROOM_TELEPHONY_ENABLED: True
|
||||||
ROOM_TELEPHONY_DEFAULT_COUNTRY: 'FR'
|
ROOM_TELEPHONY_DEFAULT_COUNTRY: 'FR'
|
||||||
ROOM_TELEPHONY_PHONE_NUMBER: '+33901020304'
|
ROOM_TELEPHONY_PHONE_NUMBER: '+33901020304'
|
||||||
SSL_CERT_FILE: /usr/local/lib/python3.13/site-packages/certifi/cacert.pem
|
SSL_CERT_FILE: /app/.venv/lib/python3.13/site-packages/certifi/cacert.pem
|
||||||
ROOM_SUBTITLE_ENABLED: True
|
ROOM_SUBTITLE_ENABLED: True
|
||||||
EXTERNAL_API_ENABLED: True
|
EXTERNAL_API_ENABLED: True
|
||||||
APPLICATION_JWT_AUDIENCE: https://meet.127.0.0.1.nip.io/external-api/v1.0/
|
APPLICATION_JWT_AUDIENCE: https://meet.127.0.0.1.nip.io/external-api/v1.0/
|
||||||
@@ -113,7 +113,7 @@ backend:
|
|||||||
# Extra volume mounts to manage our local custom CA and avoid to set ssl_verify: false
|
# Extra volume mounts to manage our local custom CA and avoid to set ssl_verify: false
|
||||||
extraVolumeMounts:
|
extraVolumeMounts:
|
||||||
- name: certs
|
- name: certs
|
||||||
mountPath: /usr/local/lib/python3.13/site-packages/certifi/cacert.pem
|
mountPath: /app/.venv/lib/python3.13/site-packages/certifi/cacert.pem
|
||||||
subPath: cacert.pem
|
subPath: cacert.pem
|
||||||
|
|
||||||
# Extra volumes to manage our local custom CA and avoid to set ssl_verify: false
|
# Extra volumes to manage our local custom CA and avoid to set ssl_verify: false
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ backend:
|
|||||||
key: BREVO_API_KEY
|
key: BREVO_API_KEY
|
||||||
BREVO_API_CONTACT_LIST_IDS: 8
|
BREVO_API_CONTACT_LIST_IDS: 8
|
||||||
ROOM_TELEPHONY_ENABLED: True
|
ROOM_TELEPHONY_ENABLED: True
|
||||||
SSL_CERT_FILE: /usr/local/lib/python3.13/site-packages/certifi/cacert.pem
|
SSL_CERT_FILE: /app/.venv/lib/python3.13/site-packages/certifi/cacert.pem
|
||||||
|
|
||||||
|
|
||||||
migrate:
|
migrate:
|
||||||
@@ -123,7 +123,7 @@ backend:
|
|||||||
# Extra volume mounts to manage our local custom CA and avoid to set ssl_verify: false
|
# Extra volume mounts to manage our local custom CA and avoid to set ssl_verify: false
|
||||||
extraVolumeMounts:
|
extraVolumeMounts:
|
||||||
- name: certs
|
- name: certs
|
||||||
mountPath: /usr/local/lib/python3.13/site-packages/certifi/cacert.pem
|
mountPath: /app/.venv/lib/python3.13/site-packages/certifi/cacert.pem
|
||||||
subPath: cacert.pem
|
subPath: cacert.pem
|
||||||
|
|
||||||
# Extra volumes to manage our local custom CA and avoid to set ssl_verify: false
|
# Extra volumes to manage our local custom CA and avoid to set ssl_verify: false
|
||||||
|
|||||||
Reference in New Issue
Block a user