Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,12 @@ jobs:
- uses: docker/setup-compose-action@v1
with:
version: latest
- run: pip install poetry
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Patch $PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- run: poetry install
- run: poetry run python -m unittest -v tests
- run: uv install
- run: uv run python -m unittest -v tests

test:
if: github.event_name != 'pull_request'
Expand Down Expand Up @@ -228,11 +229,12 @@ jobs:
- uses: docker/setup-compose-action@v1
with:
version: latest
- run: pip install poetry
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Patch $PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- run: poetry install
- run: poetry run python -m unittest -v tests
- run: uv install
- run: uv run python -m unittest -v tests

build-push-official:
# Only publish final images from master after tests pass
Expand Down
2 changes: 1 addition & 1 deletion .isort.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ line_length=88
known_odoo=odoo
known_odoo_addons=odoo.addons
sections=FUTURE,STDLIB,THIRDPARTY,ODOO,ODOO_ADDONS,FIRSTPARTY,LOCALFOLDER
known_third_party=click,click_odoo,doodbalib,yaml
known_third_party=click,click_odoo,doodbalib,invoke,yaml
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ repos:
- id: markdown-toc
args: [--bullets=-, -i]
exclude: .github/
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.8.11
hooks:
- id: uv-lock
21 changes: 14 additions & 7 deletions 15.0.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,17 @@ ENV DB_FILTER=.* \
PUDB_RDB_PORT=6899 \
PYTHONOPTIMIZE="" \
UNACCENT=true \
UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy \
UV_NO_MANAGED_PYTHON=1 \
WAIT_DB=true \
WDB_NO_BROWSER_AUTO_OPEN=True \
WDB_SOCKET_SERVER=wdb \
WDB_WEB_PORT=1984 \
WDB_WEB_SERVER=localhost

COPY --from=ghcr.io/astral-sh/uv /uv /uvx /bin/

# Other requirements and recommendations
# See https://github.com/$ODOO_SOURCE/blob/$ODOO_VERSION/debian/control
RUN apt-get -qq update \
Expand Down Expand Up @@ -102,9 +107,10 @@ RUN mkdir -p auto/addons auto/geoip custom/src/private \

# Doodba-QA dependencies in a separate virtualenv
COPY qa /qa
RUN python -m venv --system-site-packages /qa/venv \
RUN --mount=type=cache,target=/root/.cache/uv \
uv venv --system-site-packages /qa/venv \
&& . /qa/venv/bin/activate \
&& pip install \
&& uv pip install \
click \
coverage \
&& deactivate \
Expand All @@ -115,7 +121,8 @@ ARG ODOO_VERSION=15.0
ENV ODOO_VERSION="$ODOO_VERSION"

# Install Odoo hard & soft dependencies, and Doodba utilities
RUN build_deps=" \
RUN --mount=type=cache,target=/root/.cache/uv \
build_deps=" \
build-essential \
libfreetype6-dev \
libfribidi-dev \
Expand All @@ -142,7 +149,7 @@ RUN build_deps=" \
&& sed -i -E "s/(gevent==)[0-9\.]+/\121.12.0/; \
s/(greenlet==)[0-9\.]+/\11.1.0/; \
s/(reportlab==)[0-9\.]+/reportlab==3.6.13/" requirements.txt \
&& pip install -r requirements.txt \
&& uv pip install --system -r requirements.txt \
'websocket-client~=0.56' \
astor \
click-odoo-contrib \
Expand All @@ -166,8 +173,7 @@ RUN build_deps=" \
# https://github.com/Tecnativa/doodba/issues/486
&& python3 -c 'from flanker.addresslib import address' >/dev/null 2>&1 \
&& apt-get purge -yqq $build_deps \
&& apt-get autopurge -yqq \
&& rm -Rf /var/lib/apt/lists/* /tmp/*
&& apt-get autopurge -yqq

# Metadata
ARG VCS_REF
Expand Down Expand Up @@ -252,6 +258,7 @@ ONBUILD RUN mkdir -p /opt/odoo/custom/ssh \
&& chmod -R u=rwX,go= /opt/odoo/custom/ssh \
&& sync
ONBUILD ARG DB_VERSION=latest
ONBUILD RUN /opt/odoo/common/build && sync
ONBUILD RUN --mount=type=cache,target=/root/.cache/uv \
/opt/odoo/common/build && sync
ONBUILD VOLUME ["/var/lib/odoo"]
ONBUILD USER odoo
19 changes: 13 additions & 6 deletions 16.0.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,16 @@ ENV DB_FILTER=.* \
PUDB_RDB_PORT=6899 \
PYTHONOPTIMIZE="" \
UNACCENT=true \
UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy \
UV_NO_MANAGED_PYTHON=1 \
WAIT_DB=true \
WDB_NO_BROWSER_AUTO_OPEN=True \
WDB_SOCKET_SERVER=wdb \
WDB_WEB_PORT=1984 \
WDB_WEB_SERVER=localhost

COPY --from=ghcr.io/astral-sh/uv /uv /uvx /bin/

# Other requirements and recommendations
# See https://github.com/$ODOO_SOURCE/blob/$ODOO_VERSION/debian/control
Expand Down Expand Up @@ -106,9 +110,10 @@ RUN mkdir -p auto/addons auto/geoip custom/src/private \

# Doodba-QA dependencies in a separate virtualenv
COPY qa /qa
RUN python -m venv --system-site-packages /qa/venv \
RUN --mount=type=cache,target=/root/.cache/uv \
uv venv --system-site-packages /qa/venv \
&& . /qa/venv/bin/activate \
&& pip install \
&& uv pip install \
click \
coverage \
&& deactivate \
Expand All @@ -119,7 +124,8 @@ ARG ODOO_VERSION=16.0
ENV ODOO_VERSION="$ODOO_VERSION"

# Install Odoo hard & soft dependencies, and Doodba utilities
RUN build_deps=" \
RUN --mount=type=cache,target=/root/.cache/uv \
build_deps=" \
build-essential \
libfreetype6-dev \
libfribidi-dev \
Expand All @@ -145,8 +151,8 @@ RUN build_deps=" \
# disable gevent version recommendation from odoo and use 22.10.2 used in debian bookworm as python3-gevent
&& sed -i -E "s/(gevent==)21\.8\.0( ; sys_platform != 'win32' and python_version > '3.9' and python_version <= '3.10')/\122.10.2\2/;s/(greenlet==)1.1.2( ; sys_platform != 'win32' and python_version > '3.9' and python_version <= '3.10')/\12.0.2\2/" requirements.txt \
# need to upgrade setuptools, since the fixes for CVE-2024-6345 rolled out in base images we get errors "error: invalid command 'bdist_wheel'"
&& pip install --upgrade setuptools \
&& pip install -r requirements.txt \
&& uv pip install --system --upgrade setuptools \
&& uv pip install --system -r requirements.txt \
'websocket-client~=0.56' \
astor \
click-odoo-contrib \
Expand Down Expand Up @@ -257,6 +263,7 @@ ONBUILD RUN [ -d ~root/.ssh ] && rm -r ~root/.ssh; \
&& chmod -R u=rwX,go= /opt/odoo/custom/ssh \
&& sync
ONBUILD ARG DB_VERSION=latest
ONBUILD RUN /opt/odoo/common/build && sync
ONBUILD RUN --mount=type=cache,target=/root/.cache/uv \
/opt/odoo/common/build && sync
ONBUILD VOLUME ["/var/lib/odoo"]
ONBUILD USER odoo
20 changes: 14 additions & 6 deletions 17.0.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,17 @@ ENV DB_FILTER=.* \
PUDB_RDB_PORT=6899 \
PYTHONOPTIMIZE="" \
UNACCENT=true \
UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy \
UV_NO_MANAGED_PYTHON=1 \
WAIT_DB=true \
WDB_NO_BROWSER_AUTO_OPEN=True \
WDB_SOCKET_SERVER=wdb \
WDB_WEB_PORT=1984 \
WDB_WEB_SERVER=localhost

COPY --from=ghcr.io/astral-sh/uv /uv /uvx /bin/

# Other requirements and recommendations
# See https://github.com/$ODOO_SOURCE/blob/$ODOO_VERSION/debian/control
RUN echo "LAST_SYSTEM_UID=$LAST_SYSTEM_UID\nLAST_SYSTEM_GID=$LAST_SYSTEM_GID\nFIRST_UID=$FIRST_UID\nFIRST_GID=$FIRST_GID" >> /etc/adduser.conf \
Expand Down Expand Up @@ -105,9 +110,10 @@ RUN mkdir -p auto/addons auto/geoip custom/src/private \

# Doodba-QA dependencies in a separate virtualenv
COPY qa /qa
RUN python -m venv --system-site-packages /qa/venv \
RUN --mount=type=cache,target=/root/.cache/uv \
uv venv --system-site-packages /qa/venv \
&& . /qa/venv/bin/activate \
&& pip install \
&& uv pip install \
click \
coverage \
&& deactivate \
Expand All @@ -118,7 +124,8 @@ ARG ODOO_VERSION=17.0
ENV ODOO_VERSION="$ODOO_VERSION"

# Install Odoo hard & soft dependencies, and Doodba utilities
RUN build_deps=" \
RUN --mount=type=cache,target=/root/.cache/uv \
build_deps=" \
build-essential \
libfreetype6-dev \
libfribidi-dev \
Expand All @@ -144,8 +151,8 @@ RUN build_deps=" \
# disable gevent version recommendation from odoo and use 22.10.2 used in debian bookworm as python3-gevent
&& sed -i -E "s/(gevent==)21\.8\.0( ; sys_platform != 'win32' and python_version == '3.10')/\122.10.2\2/;s/(greenlet==)1.1.2( ; sys_platform != 'win32' and python_version == '3.10')/\12.0.2\2/" requirements.txt \
# need to upgrade setuptools, since the fixes for CVE-2024-6345 rolled out in base images we get errors "error: invalid command 'bdist_wheel'"
&& pip install --upgrade setuptools \
&& pip install -r requirements.txt \
&& uv pip install --system --upgrade setuptools \
&& uv pip install --system -r requirements.txt \
'websocket-client~=0.56' \
astor \
click-odoo-contrib \
Expand Down Expand Up @@ -256,6 +263,7 @@ ONBUILD RUN [ -d ~root/.ssh ] && rm -r ~root/.ssh; \
&& chmod -R u=rwX,go= /opt/odoo/custom/ssh \
&& sync
ONBUILD ARG DB_VERSION=latest
ONBUILD RUN /opt/odoo/common/build && sync
ONBUILD RUN --mount=type=cache,target=/root/.cache/uv \
/opt/odoo/common/build && sync
ONBUILD VOLUME ["/var/lib/odoo"]
ONBUILD USER odoo
21 changes: 15 additions & 6 deletions 18.0.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,17 @@ ENV DB_FILTER=.* \
PUDB_RDB_PORT=6899 \
PYTHONOPTIMIZE="" \
UNACCENT=true \
UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy \
UV_NO_MANAGED_PYTHON=1 \
WAIT_DB=true \
WDB_NO_BROWSER_AUTO_OPEN=True \
WDB_SOCKET_SERVER=wdb \
WDB_WEB_PORT=1984 \
WDB_WEB_SERVER=localhost

COPY --from=ghcr.io/astral-sh/uv /uv /uvx /bin/

# Other requirements and recommendations
# See https://github.com/$ODOO_SOURCE/blob/$ODOO_VERSION/debian/control
RUN echo "LAST_SYSTEM_UID=$LAST_SYSTEM_UID\nLAST_SYSTEM_GID=$LAST_SYSTEM_GID\nFIRST_UID=$FIRST_UID\nFIRST_GID=$FIRST_GID" >> /etc/adduser.conf \
Expand Down Expand Up @@ -105,9 +110,10 @@ RUN mkdir -p auto/addons auto/geoip custom/src/private \

# Doodba-QA dependencies in a separate virtualenv
COPY qa /qa
RUN python -m venv --system-site-packages /qa/venv \
RUN --mount=type=cache,target=/root/.cache/uv \
uv venv --system-site-packages /qa/venv \
&& . /qa/venv/bin/activate \
&& pip install \
&& uv pip install \
click \
coverage \
&& deactivate \
Expand All @@ -118,7 +124,9 @@ ARG ODOO_VERSION=18.0
ENV ODOO_VERSION="$ODOO_VERSION"

# Install Odoo hard & soft dependencies, and Doodba utilities
RUN build_deps=" \
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=tmpfs,target=/tmp \
build_deps=" \
build-essential \
libfreetype6-dev \
libfribidi-dev \
Expand All @@ -144,8 +152,8 @@ RUN build_deps=" \
# disable gevent version recommendation from odoo and use 22.10.2 used in debian bookworm as python3-gevent
&& sed -i -E "s/(gevent==)21\.8\.0( ; sys_platform != 'win32' and python_version == '3.10')/\122.10.2\2/;s/(greenlet==)1.1.2( ; sys_platform != 'win32' and python_version == '3.10')/\12.0.2\2/" requirements.txt \
# need to upgrade setuptools, since the fixes for CVE-2024-6345 rolled out in base images we get errors "error: invalid command 'bdist_wheel'"
&& pip install --upgrade setuptools \
&& pip install -r requirements.txt \
&& uv pip install --system --upgrade setuptools \
&& uv pip install --system -r requirements.txt \
'websocket-client~=0.56' \
astor \
click-odoo-contrib \
Expand Down Expand Up @@ -256,6 +264,7 @@ ONBUILD RUN [ -d ~root/.ssh ] && rm -r ~root/.ssh; \
&& chmod -R u=rwX,go= /opt/odoo/custom/ssh \
&& sync
ONBUILD ARG DB_VERSION=latest
ONBUILD RUN /opt/odoo/common/build && sync
ONBUILD RUN --mount=type=cache,target=/root/.cache/uv \
/opt/odoo/common/build && sync
ONBUILD VOLUME ["/var/lib/odoo"]
ONBUILD USER odoo
20 changes: 14 additions & 6 deletions 19.0.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@ ENV DB_FILTER=.* \
PUDB_RDB_PORT=6899 \
PYTHONOPTIMIZE="" \
UNACCENT=true \
UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy \
UV_NO_MANAGED_PYTHON=1 \
WAIT_DB=true \
WDB_NO_BROWSER_AUTO_OPEN=True \
WDB_SOCKET_SERVER=wdb \
WDB_WEB_PORT=1984 \
WDB_WEB_SERVER=localhost

COPY --from=ghcr.io/astral-sh/uv /uv /uvx /bin/
# Other requirements and recommendations
# See https://github.com/$ODOO_SOURCE/blob/$ODOO_VERSION/debian/control
RUN echo "LAST_SYSTEM_UID=$LAST_SYSTEM_UID\nLAST_SYSTEM_GID=$LAST_SYSTEM_GID\nFIRST_UID=$FIRST_UID\nFIRST_GID=$FIRST_GID" >> /etc/adduser.conf \
Expand Down Expand Up @@ -105,9 +109,10 @@ RUN mkdir -p auto/addons auto/geoip custom/src/private \

# Doodba-QA dependencies in a separate virtualenv
COPY qa /qa
RUN python -m venv --system-site-packages /qa/venv \
RUN --mount=type=cache,target=/root/.cache/uv \
uv venv --system-site-packages /qa/venv \
&& . /qa/venv/bin/activate \
&& pip install \
&& uv pip install \
click \
coverage \
&& deactivate \
Expand All @@ -118,7 +123,9 @@ ARG ODOO_VERSION=19.0
ENV ODOO_VERSION="$ODOO_VERSION"

# Install Odoo hard & soft dependencies, and Doodba utilities
RUN build_deps=" \
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=tmpfs,target=/tmp \
build_deps=" \
build-essential \
libfreetype6-dev \
libfribidi-dev \
Expand All @@ -142,8 +149,8 @@ RUN build_deps=" \
&& apt-get install -yqq --no-install-recommends $build_deps \
&& curl -o requirements.txt https://raw.githubusercontent.com/$ODOO_SOURCE/$ODOO_VERSION/requirements.txt \
# need to upgrade setuptools, since the fixes for CVE-2024-6345 rolled out in base images we get errors "error: invalid command 'bdist_wheel'"
&& pip install --upgrade setuptools \
&& pip install -r requirements.txt \
&& uv pip install --system --upgrade setuptools \
&& uv pip install --system -r requirements.txt \
'websocket-client~=0.56' \
astor \
click-odoo-contrib \
Expand Down Expand Up @@ -254,6 +261,7 @@ ONBUILD RUN [ -d ~root/.ssh ] && rm -r ~root/.ssh; \
&& chmod -R u=rwX,go= /opt/odoo/custom/ssh \
&& sync
ONBUILD ARG DB_VERSION=latest
ONBUILD RUN /opt/odoo/common/build && sync
ONBUILD RUN --mount=type=cache,target=/root/.cache/uv \
/opt/odoo/common/build && sync
ONBUILD VOLUME ["/var/lib/odoo"]
ONBUILD USER odoo
6 changes: 5 additions & 1 deletion build.d/700-odoo-install
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ log INFO Installing Odoo from $src
# For development you could want to avoid installing Odoo to speed up build
if [ "$PIP_INSTALL_ODOO" == true ]; then
args="--no-cache-dir"
pip install $args --editable $src
if command -v uv >/dev/null 2>&1; then
uv pip install --system $args --editable $src
else
pip install $args --editable $src
fi
else
log WARNING Blindly symlinking odoo executable
bin=$src/odoo-bin
Expand Down
8 changes: 7 additions & 1 deletion lib/doodbalib/installer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
import shutil
from collections import OrderedDict
from os.path import exists
from subprocess import check_call
Expand Down Expand Up @@ -97,7 +98,12 @@ class NpmInstaller(Installer):


class PipInstaller(Installer):
_install_command = ["pip", "install", "--no-cache-dir", "-r"]
@property
def _install_command(self):
if shutil.which("uv"):
return ["uv", "pip", "install", "--system", "--no-cache-dir", "-r"]
else:
return ["pip", "install", "--no-cache-dir", "-r"]

def requirements(self):
"""Pip will use its ``--requirements`` feature."""
Expand Down
Loading
Loading