Skip to content
Merged
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
5 changes: 1 addition & 4 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ jobs:
- name: Install dependencies
run: |
pip install uv
uv venv
. ./.venv/bin/activate
uv pip install -e .
uv pip install --constraints=requirements-dev.txt sphinx
uv sync --group docs
- name: Sphinx build
run: |
. ./.venv/bin/activate
Expand Down
128 changes: 62 additions & 66 deletions Jenkinsfile

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions ci/docker/linux/jenkins/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ ARG CONAN_USER_HOME=/conan
ARG CONAN_HOME=${CONAN_USER_HOME}/.conan2

FROM ubuntu:24.04 AS base
COPY ci/docker/linux/jenkins/apt-packages.txt /tmp/apt-packages.txt
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
--mount=type=bind,source=ci/docker/linux/jenkins/apt-packages.txt,target=/tmp/apt-packages.txt \
rm -f /etc/apt/apt.conf.d/docker-clean && \
apt-get update -y && \
< /tmp/apt-packages.txt xargs apt-get install -y && \
Expand All @@ -29,10 +29,7 @@ RUN --mount=type=cache,target=/var/cache/apt \
apt-get install -y --no-install-recommends jq && \
rm -rf /var/lib/apt/lists/*
ARG CONAN_HOME
COPY requirements-dev.txt /tmp/requirements-dev.txt
COPY ci/docker/shared/conan/remotes.json ${CONAN_HOME}/remotes.json
COPY conanfile.py /tmp/conanfile.py
ARG PIP_EXTRA_INDEX_URL
ARG PIP_INDEX_URL
ARG CONAN_CENTER_PROXY_V2_URL
ARG UV_CACHE_DIR
Expand All @@ -42,8 +39,12 @@ ARG CONAN_DOWNLOAD_CACHE=/tmp/conan_download_cache
RUN --mount=type=cache,target=${PIP_CACHE_DIR} \
--mount=type=cache,target=${UV_CACHE_DIR} \
--mount=type=cache,target=${CONAN_DOWNLOAD_CACHE} \
--mount=type=bind,source=uv.lock,target=/tmp/project/uv.lock \
--mount=type=bind,source=pyproject.toml,target=/tmp/project/pyproject.toml \
--mount=type=bind,source=conanfile.py,target=/tmp/conanfile.py \
python3 -m venv venv && \
./venv/bin/pip --disable-pip-version-check install uv && \
./venv/bin/uv export --frozen --only-dev --no-hashes --directory /tmp/project/ > ${UV_CONSTRAINT} && \
./venv/bin/uvx --with cmake conan profile detect --exist-ok && \
cp ${CONAN_HOME}/global.conf /tmp/global.conf.original && \
echo "core.sources:download_cache = $CONAN_DOWNLOAD_CACHE" >> ${CONAN_HOME}/global.conf && \
Expand Down
6 changes: 4 additions & 2 deletions ci/docker/linux/tox/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \


ARG UV_INDEX_URL
COPY requirements-dev.txt /tmp/requirements/requirements-dev.txt
ARG CONAN_HOME
ARG PIP_CACHE_DIR
ARG UV_CACHE_DIR
Expand All @@ -49,12 +48,15 @@ ARG CONAN_DOWNLOAD_CACHE=/tmp/conan_download_cache
COPY ci/docker/shared/conan/remotes.json ${CONAN_HOME}/remotes.json
COPY ci/docker/linux/tox/conan/profile.ini ${CONAN_HOME}/profiles/default
COPY conanfile.py /tmp/conanfile.py
ENV UV_CONSTRAINT=/tmp/requirements/requirements-dev.txt
ENV UV_CONSTRAINT=/tmp/constrainsts.txt
RUN --mount=type=cache,target=${PIP_CACHE_DIR} \
--mount=type=cache,target=${UV_CACHE_DIR} \
--mount=type=cache,target=${CONAN_DOWNLOAD_CACHE} \
--mount=type=bind,source=uv.lock,target=/tmp/project/uv.lock \
--mount=type=bind,source=pyproject.toml,target=/tmp/project/pyproject.toml \
python3 -m venv venv --upgrade-deps && \
./venv/bin/pip install --disable-pip-version-check uv && \
./venv/bin/uv export --frozen --only-dev --no-hashes --directory /tmp/project/ > ${UV_CONSTRAINT} && \
./venv/bin/uvx --with cmake conan profile detect --exist-ok && \
cp ${CONAN_HOME}/global.conf /tmp/global.conf.original && \
echo "core.sources:download_cache = $CONAN_DOWNLOAD_CACHE" >> ${CONAN_HOME}/global.conf && \
Expand Down
21 changes: 17 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,27 @@ authors = [
]
readme = {file = "README.md", content-type = "text/markdown"}

[dependency-groups]
test = ["coverage", "pytest",]
docs = ["sphinx", 'tomli;python_version<"3.11"']
dev = [
{include-group = "docs"},
{include-group = "test"},
"cmake<4.0",
"lxml",
"mypy",
"pybind11>=2.13.0",
"pybind11_stubgen",
"setuptools",
"tox",
"uiucprescon.build @ https://github.com/UIUCLibrary/uiucprescon_build/releases/download/v0.3.0/uiucprescon_build-0.3.0-py3-none-any.whl"
]


[tool.setuptools]
packages = ["uiucprescon.pymediaconch"]
package-dir = {"" = "src"}

[tool.pytest.ini_options]
pythonpath = [
"src"
]
[tool.commitizen]
name = "cz_conventional_commits"
tag_format = "v$major.$minor.$patch${prerelease}"
Expand Down
136 changes: 0 additions & 136 deletions requirements-dev.txt

This file was deleted.

10 changes: 0 additions & 10 deletions requirements/requirements-dev.txt

This file was deleted.

85 changes: 40 additions & 45 deletions scripts/build_linux_wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ DEFAULT_PYTHON_VERSION="3.13"
DOCKERFILE=$(realpath "$scriptDir/resources/package_for_linux/Dockerfile")
DEFAULT_DOCKER_IMAGE_NAME="pymediaconch_builder"
OUTPUT_PATH="$PROJECT_ROOT/dist"
DEFAULT_BUILD_CONSTRAINTS="requirements-dev.txt"


arch=$(uname -m)

Expand All @@ -28,7 +26,7 @@ esac
generate_wheel(){
platform=$1
local docker_image_name_to_use=$2
local constraints_file=$3
local output_path=$3
local python_versions_to_use=("${@:4}")

docker build \
Expand All @@ -40,20 +38,33 @@ generate_wheel(){
--build-arg PIP_INDEX_URL \
--build-arg UV_EXTRA_INDEX_URL \
--build-arg UV_INDEX_URL \
--build-arg UV_CONSTRAINT="$constraints_file" \
"$PROJECT_ROOT"

mkdir -p "$OUTPUT_PATH"
echo "Building wheels for Python versions: ${python_versions_to_use[*]}"

mkdir -p "$output_path"
docker run --rm \
--platform="$platform" \
-v "$PROJECT_ROOT":/project:ro \
-v "$OUTPUT_PATH":/dist \
--mount type=bind,src="$(realpath "$output_path")",dst=/dist \
"$docker_image_name_to_use" \
build-wheel /project /dist "$constraints_file" "${python_versions_to_use[@]}"
echo "Built wheel can be found in '$OUTPUT_PATH'"
build-wheel /project /dist "${python_versions_to_use[@]}"
}

test_wheels(){
local manifest_tsv=$1
local wheel_path=$2
local source_path=$3
awk -F'\t' '
{
if($1 && $2){
print "Testing "$1 " with tox"
wheel_outside = wheel_path "/" $1
wheel_inside = "/test_env/dist/" $1
system("docker run --user $(id -u):$(id -g) --rm -v " source_path "/tox.ini:/test_env/tox.ini -v " source_path "/pyproject.toml:/test_env/pyproject.toml -v " source_path "/tests/:/test_env/tests/ -v " wheel_outside ":" wheel_inside " --workdir /test_env/ --entrypoint=\"/bin/bash\" python -c \"python -m venv /venv && /venv/bin/pip install --disable-pip-version-check uv && /venv/bin/uvx --with tox-uv tox run -e " $2 " --installpkg " wheel_inside " \" ")
}
}
' wheel_path="$(realpath "$wheel_path")" source_path="$(realpath "$source_path")" "$manifest_tsv"
}


print_usage(){
echo "Usage: $0 [--project-root[=PROJECT_ROOT]] [--python-version[=PYTHON_VERSION]] [--help]"
}
Expand All @@ -72,10 +83,6 @@ show_help() {
echo " --docker-image-name "
echo " : Name of the Docker image to use for building the wheel. "
echo " Defaults to \"$DEFAULT_DOCKER_IMAGE_NAME\". "
echo " --build-constraints-file "
echo " : File to use for build constraints. This must be within the "
echo " root of the repository. "
echo " Defaults to \"$DEFAULT_BUILD_CONSTRAINTS\" "
echo " --help, -h : Display this help message. "
}

Expand All @@ -91,23 +98,6 @@ check_args(){
exit 1
fi

if [[ "$build_constraints_file" = /* ]]; then
echo "The build constraints file '$build_constraints_file' cannot be an absolute path."
exit 1
fi

if [[ ! -f "$build_constraints_file" ]]; then
echo "No valid file found at $build_constraints_file"
exit 1
fi

# Check if the resolved path is within the source repository
if [[ ! $(realpath "$build_constraints_file") == "$PROJECT_ROOT"* ]]; then
echo "Error: The path '$build_constraints_file' is not within the source repository."
exit 1
fi


}
# === Main script starts here ===

Expand All @@ -121,6 +111,8 @@ for arg in "$@"; do
fi
done

verify=0

# Parse optional arguments
while [[ "$#" -gt 0 ]]; do
case "$1" in
Expand All @@ -132,13 +124,9 @@ while [[ "$#" -gt 0 ]]; do
PROJECT_ROOT="$2"
shift 2
;;
--build-constraints-file=*)
build_constraints_file="${1#*=}"
shift
;;
--build-constraints-file)
build_constraints_file="${2}"
shift 2
--verify)
verify=1
shift 1
;;
--docker-image-name=*)
docker_image_name="${1#*=}"
Expand Down Expand Up @@ -198,10 +186,17 @@ if [[ ! -v docker_image_name ]]; then
else
echo "Using '$docker_image_name' for the name of the Docker Image generated to build."
fi
if [[ -z "$build_constraints_file" ]]; then
build_constraints_file=$DEFAULT_BUILD_CONSTRAINTS
else
echo "Using '$build_constraints_file' for constraints file."
fi
check_args
generate_wheel "$PLATFORM" "$docker_image_name" "$build_constraints_file" "${python_versions[@]}"
mkdir -p build
temp_dir="$(mktemp -d build/pymediaconch_wheels_XXXXXX)"
trap 'rm -rf $temp_dir' EXIT

generate_wheel "$PLATFORM" "$docker_image_name" "$temp_dir" "${python_versions[@]}"

if (( verify )); then
test_wheels "${temp_dir}/output.tsv" "$temp_dir" "$PROJECT_ROOT"
fi

mkdir -p "$OUTPUT_PATH"
mv "${temp_dir}"/*.whl "${OUTPUT_PATH}/"
echo "Built wheel can be found in '$OUTPUT_PATH'"
Loading
Loading