Skip to content

Commit fb2c5cb

Browse files
committed
build: support uv.lock
1 parent 7b02e76 commit fb2c5cb

File tree

9 files changed

+210
-361
lines changed

9 files changed

+210
-361
lines changed

.github/workflows/wheels.yml

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,23 @@ jobs:
1515
UV_EXTRA_INDEX_URL: ${{vars.PIP_EXTRA_INDEX_URL}}
1616
strategy:
1717
matrix:
18-
os: [
19-
ubuntu-20.04,
20-
windows-2019, macos-13]
21-
include:
22-
- os: macos-13
23-
compiler_version: 13
24-
- os: ubuntu-20.04
25-
compiler_version: 10.2
26-
- os: windows-2019
27-
compiler_version: 16
18+
os: [ubuntu-latest, windows-latest, macos-13]
2819

2920
steps:
3021
- uses: actions/checkout@v3
3122

3223
# Used to host cibuildwheel
3324
- uses: actions/setup-python@v3
3425
- name: Install cibuildwheel
35-
run: python -m pip install -r requirements/requirements-cibuildwheel.txt
26+
run: python -m pip install uv
3627

3728
- name: Build wheels
3829
if: contains(matrix.os, 'windows')
3930
shell: cmd
4031
run: |
4132
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
42-
python -m cibuildwheel --output-dir wheelhouse
43-
env:
44-
CONAN_COMPILER_VERSION: ${{ matrix.compiler_version }}
33+
uv run --only-group=cibuildwheel -m cibuildwheel --output-dir wheelhouse
4534
- name: Build wheels
4635
if: "!contains(matrix.os, 'windows')"
47-
run: python -m cibuildwheel --output-dir wheelhouse
48-
env:
49-
CONAN_COMPILER_VERSION: ${{ matrix.compiler_version }}
36+
run: uv run --only-group=cibuildwheel -m cibuildwheel --output-dir wheelhouse
5037
# CIBW_SOME_OPTION: value

ci/docker/linux/jenkins/Dockerfile

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ ARG PIP_DOWNLOAD_CACHE=/.cache/pip
1212
ARG UV_CACHE_DIR=/.cache/uv
1313
# UV Cache directory. Change this only if you need to override the default location.
1414

15+
FROM ghcr.io/astral-sh/uv:latest AS uv_builder
1516

1617
FROM ubuntu:22.04 AS base_image
1718
RUN rm -f /etc/apt/apt.conf.d/docker-clean
@@ -37,7 +38,7 @@ RUN --mount=type=cache,target=/var/cache/apt \
3738
rm -rf /var/lib/apt/lists/*
3839

3940
#==============================================================================
40-
FROM base_image AS DR_MEMORY_BUILDER
41+
FROM base_image AS dr_memory_builder
4142
RUN apt-get update && \
4243
apt-get install -y --no-install-recommends wget
4344

@@ -48,7 +49,7 @@ RUN wget --no-verbose https://github.com/DynamoRIO/drmemory/releases/download/re
4849
drmemory -version
4950

5051

51-
FROM base_image AS SONAR_BUILDER
52+
FROM base_image AS sonar_builder
5253

5354
RUN case $(uname -m) in \
5455
x86_64) URL=https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip ;; \
@@ -70,30 +71,30 @@ ARG PIP_INDEX_URL
7071
ARG UV_EXTRA_INDEX_URL
7172
ARG UV_INDEX_URL
7273

73-
COPY conanfile.py /tmp/conanfile.py
74+
COPY --from=uv_builder /uv /uvx /bin/
7475
COPY ci/docker/linux/shared/ensure_compiler_support_by_conan.py /tmp/ensure_compiler_support_by_conan.py
75-
COPY requirements-dev.txt /tmp/requirements-dev.txt
7676
ARG UV_CACHE_DIR
7777
ARG PIP_DOWNLOAD_CACHE
7878
ARG CONAN_CENTER_PROXY_V2_URL
7979
ARG CONAN_HOME
80-
ENV UV_CONSTRAINT=/tmp/requirements-dev.txt
81-
80+
ENV UV_PROJECT=/tmp/uv
81+
ENV UV_FROZEN=1
8282
COPY ci/docker/linux/jenkins/conan/profile.ini ${CONAN_HOME}/profiles/default
8383
COPY ci/docker/shared/conan/remotes.json ${CONAN_HOME}/remotes.json
8484
RUN --mount=type=cache,target=${PIP_DOWNLOAD_CACHE} \
8585
--mount=type=cache,target=${UV_CACHE_DIR} \
86-
python3 -m venv venv && \
87-
venv/bin/pip install --no-cache --disable-pip-version-check uv && \
88-
venv/bin/uvx --with cmake conan profile detect --exist-ok && \
89-
python3 /tmp/ensure_compiler_support_by_conan.py $(venv/bin/uvx --with cmake conan config home)/settings.yml 11.4 && \
86+
--mount=type=bind,source=pyproject.toml,target=${UV_PROJECT}/pyproject.toml \
87+
--mount=type=bind,source=uv.lock,target=${UV_PROJECT}/uv.lock \
88+
--mount=type=bind,source=conanfile.py,target=/tmp/conanfile.py \
89+
uv run --only-group=conan conan profile detect --exist-ok && \
90+
python3 /tmp/ensure_compiler_support_by_conan.py $(uv run --only-group=conan conan config home)/settings.yml 11.4 && \
9091
if [ "$(jq -r '.remotes[0].url' ${CONAN_HOME}/remotes.json )" != "${CONAN_CENTER_PROXY_V2_URL}" ]; then \
9192
echo "Setting the conan center url for building cache: ${CONAN_CENTER_PROXY_V2_URL}" && \
9293
cp ${CONAN_HOME}/remotes.json /tmp/remotes.json && \
93-
./venv/bin/uvx --with cmake conan remote update conan-center --url ${CONAN_CENTER_PROXY_V2_URL}; \
94+
uv run --only-group=conan conan remote update conan-center --url ${CONAN_CENTER_PROXY_V2_URL}; \
9495
fi && \
95-
venv/bin/uvx --with cmake conan install /tmp --build missing -pr:b=default && \
96-
venv/bin/uvx --with cmake conan cache clean "*" -b --source --build --temp && \
96+
uv run --only-group=conan conan install /tmp --build missing -pr:b=default && \
97+
uv run --only-group=conan conan cache clean "*" -b --source --build --temp && \
9798
rm -rf venv && \
9899
if [ "$(jq -r '.remotes[0].url' ${CONAN_HOME}/remotes.json )" != "${CONAN_CENTER_PROXY_V2_URL}" ]; then \
99100
mv -f /tmp/remotes.json ${CONAN_HOME}/remotes.json; \
@@ -108,7 +109,7 @@ FROM base_image
108109
# Install sonar build-wrapper
109110
# -----------------------------------------------------------------------------
110111

111-
COPY --from=SONAR_BUILDER /opt/build-wrapper-linux /opt/build-wrapper-linux/
112+
COPY --from=sonar_builder /opt/build-wrapper-linux /opt/build-wrapper-linux/
112113

113114
RUN case $(uname -m) in \
114115
x86_64) ln -s /opt/build-wrapper-linux/build-wrapper-linux-x86/build-wrapper-linux-x86-64 /usr/local/bin/build-wrapper-linux ;; \
@@ -120,7 +121,7 @@ ENV SONAR_SCANNER_OPTS="-server"
120121
# -----------------------------------------------------------------------------
121122
# Install Doctor memory
122123
# -----------------------------------------------------------------------------
123-
COPY --from=DR_MEMORY_BUILDER /opt/drmemory /opt/drmemory/
124+
COPY --from=dr_memory_builder /opt/drmemory /opt/drmemory/
124125
RUN ln -s /opt/drmemory/bin64/drmemory /usr/local/bin/drmemory && \
125126
drmemory -version
126127

@@ -132,6 +133,5 @@ ARG CONAN_USER_HOME
132133
ENV CONAN_USER_HOME=${CONAN_USER_HOME}
133134
ARG CONAN_HOME
134135
ENV CONAN_HOME=${CONAN_HOME}
135-
COPY --from=conan_builder ${CONAN_HOME} ${CONAN_HOME}
136-
RUN chmod -R 777 ${CONAN_HOME}
136+
COPY --from=conan_builder --chmod=777 ${CONAN_HOME} ${CONAN_HOME}
137137
ENV TZ=UTC

ci/docker/linux/tox/Dockerfile

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ ARG CONAN_CENTER_PROXY_V2_URL=https://center2.conan.io
1010
ARG PIP_DOWNLOAD_CACHE=/.cache/pip
1111
ARG UV_CACHE_DIR=/.cache/uv
1212
ARG UV_EXTRA_INDEX_URL
13+
14+
FROM ghcr.io/astral-sh/uv:latest AS uv_builder
15+
1316
FROM ubuntu:22.04 AS wheel_builder_base
1417
COPY ci/docker/linux/tox/apt-packages.txt /tmp/apt-packages.txt
1518
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
@@ -27,36 +30,36 @@ ARG CONAN_USER_HOME
2730
RUN mkdir -p ${CONAN_USER_HOME}
2831

2932
FROM wheel_builder_base AS conan_builder
30-
COPY requirements-dev.txt /tmp/requirements-dev.txt
33+
COPY --from=uv_builder /uv /uvx /bin/
3134
ARG CONAN_USER_HOME
3235
ARG CONAN_HOME
3336
COPY ci/docker/linux/shared/ensure_compiler_support_by_conan.py /tmp/ensure_compiler_support_by_conan.py
3437
COPY ci/docker/shared/conan/remotes.json ${CONAN_HOME}/remotes.json
35-
3638
COPY conanfile.py /tmp/conanfile.py
3739
ARG CONAN_CENTER_PROXY_V2_URL
3840
ARG PIP_EXTRA_INDEX_URL
3941
ARG PIP_INDEX_URL
4042
ARG UV_EXTRA_INDEX_URL
4143
ARG UV_INDEX_URL
42-
ENV UV_CONSTRAINT=/tmp/requirements-dev.txt
4344
ARG PIP_DOWNLOAD_CACHE
4445
ARG UV_CACHE_DIR
46+
ENV UV_PROJECT=/tmp/uv
47+
ENV UV_FROZEN=1
4548
RUN --mount=type=cache,target=${PIP_DOWNLOAD_CACHE} \
4649
--mount=type=cache,target=${UV_CACHE_DIR} \
47-
python3 -m venv venv && \
48-
./venv/bin/pip install --no-cache --disable-pip-version-check uv && \
49-
./venv/bin/uvx --with cmake conan profile detect --exist-ok && \
50-
./venv/bin/uv run /tmp/ensure_compiler_support_by_conan.py ${CONAN_HOME}/settings.yml 11.4 && \
51-
cat $(./venv/bin/uvx --with cmake conan config home)/settings.yml && \
52-
./venv/bin/uvx --with cmake conan config home && \
50+
--mount=type=bind,source=pyproject.toml,target=${UV_PROJECT}/pyproject.toml \
51+
--mount=type=bind,source=uv.lock,target=${UV_PROJECT}/uv.lock \
52+
--mount=type=bind,source=conanfile.py,target=/tmp/conanfile.py \
53+
uv run --only-group=conan conan profile detect --exist-ok && \
54+
cat $(uv run --only-group=conan conan config home)/settings.yml && \
55+
uv run --only-group=conan conan config home && \
5356
if [ "$(jq -r '.remotes[0].url' ${CONAN_HOME}/remotes.json )" != "${CONAN_CENTER_PROXY_V2_URL}" ]; then \
5457
echo "Setting the conan center url for building cache: ${CONAN_CENTER_PROXY_V2_URL}" && \
5558
cp ${CONAN_HOME}/remotes.json /tmp/remotes.json && \
56-
./venv/bin/uvx --with cmake conan remote update conan-center --url ${CONAN_CENTER_PROXY_V2_URL}; \
59+
uv run --only-group=conan conan remote update conan-center --url ${CONAN_CENTER_PROXY_V2_URL}; \
5760
fi && \
58-
./venv/bin/uvx --with cmake conan install /tmp --build missing --build=openjpeg && \
59-
./venv/bin/uvx --with cmake conan cache clean "*" -b --source --build --temp && \
61+
uv run --only-group=conan conan install /tmp --build missing --build=openjpeg && \
62+
uv run --only-group=conan conan cache clean "*" -b --source --build --temp && \
6063
rm -rf venv && \
6164
if [ "$(jq -r '.remotes[0].url' ${CONAN_HOME}/remotes.json )" != "${CONAN_CENTER_PROXY_V2_URL}" ]; then \
6265
mv -f /tmp/remotes.json ${CONAN_HOME}/remotes.json; \
@@ -68,14 +71,13 @@ FROM wheel_builder_base
6871

6972
ARG CONAN_USER_HOME
7073
ARG CONAN_HOME
71-
COPY --from=conan_builder ${CONAN_HOME} ${CONAN_HOME}
74+
COPY --from=conan_builder --chmod=777 ${CONAN_HOME} ${CONAN_HOME}
7275
ENV CONAN_HOME=${CONAN_HOME}
7376
ENV CONAN_USER_HOME=${CONAN_USER_HOME}
7477

7578
ARG UV_CACHE_DIR
7679
ARG PIP_DOWNLOAD_CACHE
77-
RUN chmod -R 777 ${CONAN_HOME} && \
78-
mkdir -p ${PIP_DOWNLOAD_CACHE} && \
80+
RUN mkdir -p ${PIP_DOWNLOAD_CACHE} && \
7981
chmod -R 777 ${PIP_DOWNLOAD_CACHE} && \
8082
mkdir -p ${UV_CACHE_DIR} && \
8183
chmod -R 777 ${UV_CACHE_DIR}

pyproject.toml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ ci = [
6565
"pysonar",
6666
]
6767
package = ["delocate ; sys_platform == 'darwin'"]
68+
cibuildwheel = ['cibuildwheel']
69+
6870
[tool.setuptools]
6971
packages = [
7072
"uiucprescon.imagevalidate",
@@ -110,21 +112,21 @@ environment-pass = ["CONAN_COMPILER_LIBCXX", "CONAN_COMPILER_VERSION", "CONAN_US
110112

111113
[tool.cibuildwheel.windows]
112114
before-all = [
113-
"pip install wheel",
114-
"pip install -r requirements-dev.txt uv",
115-
"conan profile new default --detect --force",
116-
"conan profile update settings.compiler.version=%CONAN_COMPILER_VERSION% default",
117-
"conan install ./ --build missing",
115+
'echo Conan user home: %CONAN_USER_HOME%',
116+
'echo Conan home: %CONAN_HOME%',
117+
'uv run --only-group=conan --isolated conan profile detect --exist-ok',
118+
'uv run --only-group=conan --isolated conan profile new default --detect --force',
119+
'uv run --only-group=conan --isolated conan install ./ --build missing',
118120
]
119121
[tool.cibuildwheel.windows.environment]
120122
CONAN_USER_HOME="$TEMP/conan"
121123

122124
[tool.cibuildwheel.macos]
123125
before-all = [
124-
"pip3 install -r requirements-dev.txt uv",
125-
"conan profile new $ENVTMPDIR/.conan/profiles/default --detect --force",
126-
"if [ -z \"$CONAN_COMPILER_VERSION\" ]; then : ; else conan profile update settings.compiler.version=$CONAN_COMPILER_VERSION default; fi",
127-
"conan install ./ --build missing --install-folder=$CONAN_BUILD_INFO_DIR"
126+
'echo "Conan user home: $CONAN_USER_HOME"',
127+
'echo "Conan home: $CONAN_HOME"',
128+
'uv run --only-group=conan --isolated conan profile detect --exist-ok',
129+
"uv run --only-group=conan --isolated conan install ./ --build missing --install-folder=$CONAN_BUILD_INFO_DIR"
128130
]
129131
environment-pass = ["CONAN_COMPILER_VERSION", "CONAN_USER_HOME"]
130132
repair-wheel-command = [
@@ -143,11 +145,11 @@ CONAN_BUILD_INFO_DIR="/tmp/conan/build/"
143145
repair-wheel-command = "auditwheel repair -w {dest_dir} {wheel}"
144146
before-all = [
145147
"cc --version", "cc -dumpfullversion -dumpversion",
146-
"uvx --index-strategy=unsafe-first-match --with $(grep ^conan requirements-dev.txt) conan profile new /tmp/conan/.conan/profiles/default --detect",
147-
"if [ -z \"$CONAN_COMPILER_LIBCXX\" ]; then : ; else uvx --index-strategy=unsafe-first-match --with $(grep ^conan requirements-dev.txt) conan profile update settings.compiler.libcxx=$CONAN_COMPILER_LIBCXX default; fi",
148-
"if [ -z \"$CONAN_COMPILER_VERSION\" ]; then : ; else uvx --index-strategy=unsafe-first-match --with $(grep ^conan requirements-dev.txt) conan profile update settings.compiler.version=$CONAN_COMPILER_VERSION default; fi",
149-
"uvx --index-strategy=unsafe-first-match --with $(grep ^conan requirements-dev.txt) conan profile show default",
150-
"uvx --index-strategy=unsafe-first-match --with $(grep ^conan requirements-dev.txt) conan install ./ --build missing -pr:b=default",
148+
'echo "Conan user home: $CONAN_USER_HOME"',
149+
'echo "Conan home: $CONAN_HOME"',
150+
'uv run --only-group=conan --isolated conan profile detect --exist-ok',
151+
'uv run --only-group=conan conan profile show default',
152+
'uv run --only-group=conan conan install ./ --build missing -pr:b=default',
151153

152154
]
153155
[tool.cibuildwheel.linux.environment]
@@ -157,7 +159,7 @@ CONAN_BUILD_INFO_DIR="/tmp/conan/build/"
157159
PYTHONFAULTHANDLER="True"
158160

159161
[tool.uv]
160-
cache-keys = [{ file = "pyproject.toml" }, { file = "requirements-dev.txt" }, { file = "setup.py" }, { dir = "/Users/hborcher/CLionProjects/henryborchers/uiucprescon_build" }]
162+
cache-keys = [{ file = "pyproject.toml" }, { file = "conanfile.py" }, { file = "setup.py" }]
161163

162164
[tool.uv.sources]
163165
py3exiv2bind = {index = "uiuc_prescon_python"}

0 commit comments

Comments
 (0)