Skip to content

Commit

Permalink
⚗️ Use uv to replace pip (ITISFoundation#5350)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderegg authored Feb 27, 2024
1 parent 347ccc6 commit 5156f45
Show file tree
Hide file tree
Showing 213 changed files with 1,405 additions and 1,567 deletions.
294 changes: 294 additions & 0 deletions .github/workflows/ci-testing-deploy.yml

Large diffs are not rendered by default.

29 changes: 21 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -451,18 +451,31 @@ push-version: tag-version

.PHONY: devenv devenv-all node-env

.venv:
@python3 --version
python3 -m venv $@
.check-uv-installed:
@echo "Checking if 'uv' is installed..."
@if ! command -v uv >/dev/null 2>&1; then \
printf "\033[31mError: 'uv' is not installed.\033[0m\n"; \
printf "To install 'uv', run the following command:\n"; \
printf "\033[34mcurl -LsSf https://astral.sh/uv/install.sh | sh\033[0m\n"; \
exit 1; \
else \
printf "\033[32m'uv' is installed. Version: \033[0m"; \
uv --version; \
fi


.venv: .check-uv-installed
@uv venv $@
## upgrading tools to latest version in $(shell python3 --version)
$@/bin/pip3 --quiet install --upgrade \
@uv pip --quiet install --upgrade \
pip~=24.0 \
wheel \
setuptools
@$@/bin/pip3 list --verbose
setuptools \
uv
@$@/bin/pip list --verbose

devenv: .venv .vscode/settings.json .vscode/launch.json ## create a development environment (configs, virtual-env, hooks, ...)
$</bin/pip3 --quiet install -r requirements/devenv.txt
@uv pip --quiet install -r requirements/devenv.txt
# Installing pre-commit hooks in current .git repo
@$</bin/pre-commit install
@echo "To activate the venv, execute 'source .venv/bin/activate'"
Expand Down Expand Up @@ -730,7 +743,7 @@ _running_containers = $(shell docker ps -aq)

clean-venv: devenv ## Purges .venv into original configuration
# Cleaning your venv
.venv/bin/pip-sync --quiet $(CURDIR)/requirements/devenv.txt
@uv pip sync --quiet $(CURDIR)/requirements/devenv.txt
@pip list

clean-hooks: ## Uninstalls git pre-commit hooks
Expand Down
2 changes: 1 addition & 1 deletion api/specs/storage/scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ _check_venv_active:
.PHONY: install
install: _check_venv_active
@cd ./../../../../services/storage && make install-dev && cd -
pip install -r requirements.txt
@uv pip install -r requirements.txt


.PHONY: all
Expand Down
2 changes: 1 addition & 1 deletion api/specs/web-server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _check_venv_active:
install-dev install: _check_venv_active
# installing webserver and requirements.txt
@cd ./../../../services/web/server && make install-dev && cd -
@pip install -r requirements.txt
@uv pip install -r requirements.txt


.PHONY: all
Expand Down
7 changes: 2 additions & 5 deletions api/tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,15 @@ all: install test-dev
.PHONY: reqs
requirements.txt: requirements.in
# pip compiling $<
pip-compile $(UPGRADE_OPTION) \
--build-isolation \
--strip-extras \
--resolver=backtracking \
uv pip compile $(UPGRADE_OPTION) \
--output-file $@ $<
reqs: requirements.txt ## alias to compile requirements.txt


.PHONY: install
install: _check_venv_active requirements.txt ## installs dependencies
# installing requirements
pip-sync requirements.txt
@uv pip sync requirements.txt


.PHONY: test-dev
Expand Down
3 changes: 1 addition & 2 deletions ci/github/integration-testing/director-v2.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ set -o pipefail # don't hide errors within pipes
IFS=$'\n\t'

install() {
bash ci/helpers/ensure_python_pip.bash
make devenv
# shellcheck source=/dev/null
source .venv/bin/activate
pushd services/director-v2
make install-ci
popd
.venv/bin/pip list --verbose
pip list --verbose
make info-images
}

Expand Down
3 changes: 1 addition & 2 deletions ci/github/integration-testing/dynamic-sidecar.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ set -o pipefail # don't hide errors within pipes
IFS=$'\n\t'

install() {
bash ci/helpers/ensure_python_pip.bash
make devenv
# shellcheck source=/dev/null
source .venv/bin/activate
pushd services/dynamic-sidecar
make install-ci
popd
.venv/bin/pip list --verbose
pip list --verbose
make info-images
}

Expand Down
3 changes: 1 addition & 2 deletions ci/github/integration-testing/simcore-sdk.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ set -o pipefail # don't hide errors within pipes
IFS=$'\n\t'

install() {
bash ci/helpers/ensure_python_pip.bash
make devenv
# shellcheck source=/dev/null
source .venv/bin/activate
pushd packages/simcore-sdk
make install-ci
popd
.venv/bin/pip list --verbose
pip list --verbose
make info-images
}

Expand Down
3 changes: 1 addition & 2 deletions ci/github/integration-testing/webserver.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ set -o pipefail # don't hide errors within pipes
IFS=$'\n\t'

install() {
bash ci/helpers/ensure_python_pip.bash
make devenv
# shellcheck source=/dev/null
source .venv/bin/activate
pushd services/web/server
make install-ci
popd
.venv/bin/pip list --verbose
pip list --verbose
make info-images
}

Expand Down
2 changes: 2 additions & 0 deletions ci/github/system-testing/e2e-playwright.bash
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ export DOCKER_IMAGE_TAG

install() {
make devenv
# shellcheck source=/dev/null
source .venv/bin/activate
pushd tests/e2e-playwright
make install-ci-up-simcore
popd
}

test() {
# shellcheck source=/dev/null
source .venv/bin/activate
pushd tests/e2e-playwright
make test-sleepers
Expand Down
16 changes: 10 additions & 6 deletions ci/github/system-testing/environment-setup.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,24 @@
#

# http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -o errexit # abort on nonzero exitstatus
set -o nounset # abort on unbound variable
set -o pipefail # don't hide errors within pipes
set -o errexit # abort on nonzero exitstatus
set -o nounset # abort on unbound variable
set -o pipefail # don't hide errors within pipes
IFS=$'\n\t'

install() {
bash ci/helpers/ensure_python_pip.bash
make devenv
# shellcheck source=/dev/null
source .venv/bin/activate
pushd tests/environment-setup
pip3 install -r requirements/ci.txt
make install-ci
popd
make .env
pip list --verbose
}

test() {
# shellcheck source=/dev/null
source .venv/bin/activate
pytest --color=yes -v tests/environment-setup --log-level=DEBUG --asyncio-mode=auto
}

Expand Down
20 changes: 8 additions & 12 deletions ci/github/system-testing/public-api.bash
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,23 @@ set -o nounset # abort on unbound variable
set -o pipefail # don't hide errors within pipes
IFS=$'\n\t'


install() {
bash ci/helpers/ensure_python_pip.bash
make devenv
# shellcheck source=/dev/null
source .venv/bin/activate
pushd tests/public-api
pip3 install -r requirements/ci.txt
pip freeze
make install-ci
popd
make .env
pip list -v
make info-images
}

test() {
# WARNING: this test is heavy. Due to limited CI machine power, please do not
# add too much overhead (e.g. low log-level etc)
pytest \
--color=yes \
--keep-docker-up \
--durations=5 \
-v \
tests/public-api
# shellcheck source=/dev/null
source .venv/bin/activate
pushd tests/public-api
make test-ci
}

clean_up() {
Expand Down
9 changes: 6 additions & 3 deletions ci/github/system-testing/swarm-deploy.bash
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,21 @@ set -o pipefail # don't hide errors within pipes
IFS=$'\n\t'

install() {
bash ci/helpers/ensure_python_pip.bash
make devenv
# shellcheck source=/dev/null
source .venv/bin/activate
pushd tests/swarm-deploy
pip3 install -r requirements/ci.txt
make install-ci
popd
make .env
pip list -v
make info-images
}

test() {
# WARNING: this test is heavy. Due to limited CI machine power, please do not
# add too much overhead (e.g. low log-level etc)
# shellcheck source=/dev/null
source .venv/bin/activate
pytest \
--asyncio-mode=auto \
--color=yes \
Expand Down
3 changes: 1 addition & 2 deletions ci/github/unit-testing/agent.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ set -o pipefail # don't hide errors within pipes
IFS=$'\n\t'

install() {
bash ci/helpers/ensure_python_pip.bash
make devenv
# shellcheck source=/dev/null
source .venv/bin/activate
pushd services/agent
make install-ci
popd
.venv/bin/pip list --verbose
pip list --verbose
}

test() {
Expand Down
5 changes: 2 additions & 3 deletions ci/github/unit-testing/api-server.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ set -o pipefail # don't hide errors within pipes
IFS=$'\n\t'

install() {
bash ci/helpers/ensure_python_pip.bash
make devenv
# shellcheck source=/dev/null
source .venv/bin/activate
pushd services/api-server
make install-ci
popd
.venv/bin/pip list --verbose
pip list --verbose
}

test() {
Expand All @@ -30,7 +29,7 @@ typecheck() {
popd
}

openapi-diff(){
openapi-diff() {
# shellcheck source=/dev/null
source .venv/bin/activate
pushd services/api-server
Expand Down
3 changes: 1 addition & 2 deletions ci/github/unit-testing/autoscaling.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ set -o pipefail # don't hide errors within pipes
IFS=$'\n\t'

install() {
bash ci/helpers/ensure_python_pip.bash
make devenv
# shellcheck source=/dev/null
source .venv/bin/activate
pushd services/autoscaling
make install-ci
popd
.venv/bin/pip list --verbose
pip list --verbose
}

test() {
Expand Down
3 changes: 1 addition & 2 deletions ci/github/unit-testing/aws-library.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ set -o pipefail # don't hide errors within pipes
IFS=$'\n\t'

install() {
bash ci/helpers/ensure_python_pip.bash
make devenv
# shellcheck source=/dev/null
source .venv/bin/activate
pushd packages/aws-library
make install-ci
popd
.venv/bin/pip list --verbose
pip list --verbose
}

test() {
Expand Down
3 changes: 1 addition & 2 deletions ci/github/unit-testing/catalog.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ set -o pipefail # don't hide errors within pipes
IFS=$'\n\t'

install() {
bash ci/helpers/ensure_python_pip.bash
make devenv
# shellcheck source=/dev/null
source .venv/bin/activate
pushd services/catalog
make install-ci
popd
.venv/bin/pip list --verbose
pip list --verbose
}

test() {
Expand Down
3 changes: 1 addition & 2 deletions ci/github/unit-testing/dask-sidecar.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ set -o pipefail # don't hide errors within pipes
IFS=$'\n\t'

install() {
bash ci/helpers/ensure_python_pip.bash
make devenv
# shellcheck source=/dev/null
source .venv/bin/activate
pushd services/dask-sidecar
make install-ci
popd
.venv/bin/pip list --verbose
pip list --verbose
}

test() {
Expand Down
3 changes: 1 addition & 2 deletions ci/github/unit-testing/dask-task-models-library.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ set -o pipefail # don't hide errors within pipes
IFS=$'\n\t'

install() {
bash ci/helpers/ensure_python_pip.bash
make devenv
# shellcheck source=/dev/null
source .venv/bin/activate
pushd packages/dask-task-models-library
make install-ci
popd
.venv/bin/pip list --verbose
pip list --verbose
}

test() {
Expand Down
3 changes: 1 addition & 2 deletions ci/github/unit-testing/datcore-adapter.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ set -o pipefail # don't hide errors within pipes
IFS=$'\n\t'

install() {
bash ci/helpers/ensure_python_pip.bash
make devenv
# shellcheck source=/dev/null
source .venv/bin/activate
pushd services/datcore-adapter
make install-ci
popd
.venv/bin/pip list --verbose
pip list --verbose
}

test() {
Expand Down
Loading

0 comments on commit 5156f45

Please sign in to comment.