Skip to content

Commit

Permalink
Merge pull request #440 from dyson-ai/feature/update_from_template
Browse files Browse the repository at this point in the history
Feature/update from template
  • Loading branch information
blooop authored Oct 1, 2024
2 parents 54761dd + d543564 commit 9df9b7f
Show file tree
Hide file tree
Showing 6 changed files with 291 additions and 470 deletions.
8 changes: 1 addition & 7 deletions bencher.deps.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
apt_sources:
- curl
- ca-certificates

apt_tools:
- git
- git-lfs
Expand All @@ -10,6 +6,4 @@ apt_tools:

pip_language-toolchain:
- uv #use uv instead of pip

script_pixi-user:
- scripts/install_pixi.sh
- pip #update to the latest pip
695 changes: 267 additions & 428 deletions pixi.lock

Large diffs are not rendered by default.

16 changes: 4 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ version = "1.29.0"
authors = [{ name = "Austin Gregg-Smith", email = "[email protected]" }]
description = "A package for benchmarking the performance of arbitrary functions"
readme = "README.md"
license = "MIT"

dependencies = [
"holoviews>=1.15,<=1.19.1",
Expand Down Expand Up @@ -46,11 +47,6 @@ python = "3.11.*"
[tool.pixi.feature.py312.dependencies]
python = "3.12.*"

#an environment for launching vscode with rocker and deps_rocker
[tool.pixi.feature.devenv]
dependencies = { python = "3.10" }
pypi-dependencies = { deps-rocker = ">=0.2" }
tasks = { code = "scripts/launch_vscode.sh", code-nocache = "scripts/launch_vscode.sh --nocache" }

[tool.pixi.pypi-dependencies]
holobench = { path = ".", editable = true }
Expand All @@ -60,9 +56,9 @@ test = [
"black>=23,<=24.8.0",
"pylint>=3.2.5,<=3.2.7",
"pytest-cov>=4.1,<=5.0.0",
"pytest>=7.4,<=8.3.2",
"hypothesis>=6.104.2,<=6.111.2",
"ruff>=0.5.0,<=0.6.3",
"pytest>=7.4,<=8.3.3",
"hypothesis>=6.104.2,<=6.112.1",
"ruff>=0.5.0,<=0.6.5",
"coverage>=7.5.4,<=7.6.1",
]

Expand All @@ -80,9 +76,6 @@ py310 = ["py310","test"]
py311 = ["py311","test"]
py312 = ["py312","test"]

devenv = { features = [
"devenv",
], solve-group = "devenv", no-default-feature = true }

[tool.pixi.tasks]
success = "echo Success"
Expand Down Expand Up @@ -118,7 +111,6 @@ update-from-template-repo = "./scripts/update_from_template.sh"
#demos
demo = "python3 bencher/example/example_image.py"


[tool.pylint]
extension-pkg-whitelist = ["numpy", "scipy"]
jobs = 16 #detect number of cores
Expand Down
17 changes: 17 additions & 0 deletions rockerc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file describes the docker image and rocker extensions to load
# Rockerc configuration: https://github.com/blooop/rockerc
#
# Key components:
# - image: Specifies the base image to pass to rocker
# - args: Lists additional features or tools to be added to the docker image

image: ubuntu:22.04
args:
- nvidia
- x11
- user
- pull
- deps
- git
- lazygit
- pixi
4 changes: 0 additions & 4 deletions scripts/install_pixi.sh

This file was deleted.

21 changes: 2 additions & 19 deletions scripts/launch_vscode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,6 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" #gets the current
#move to the project root folder
cd "$SCRIPT_DIR"/..

git submodule update --init --recursive

CONTAINER_NAME=${PWD##*/}
# CONTAINER_NAME="${PWD##*/}_$(date +%Y-%m-%d_%H-%M-%S)"

echo "stopping existing container" "$CONTAINER_NAME"
# docker stop "$CONTAINER_NAME" || true
docker rename "$CONTAINER_NAME" "${CONTAINER_NAME}_$(date +%Y-%m-%d_%H-%M-%S)" || true

CONTAINER_HEX=$(printf $CONTAINER_NAME | xxd -p | tr '\n' ' ' | sed 's/\\s//g' | tr -d ' ');

#!/bin/bash

if ! dpkg -l | grep -q python3-venv; then
echo "python3-venv is not installed. Installing..."
sudo apt-get update
Expand All @@ -40,18 +27,14 @@ if [ ! -d "$VENV_DIR" ]; then
echo "Activating the virtual environment..."
source $VENV_DIR/bin/activate
echo "Installing deps rocker..."
pip install deps-rocker
pip install deps-rocker pixi-rocker rockervsc
echo "Virtual environment setup and deps rocker installation complete."
else
echo "Virtual environment already exists in $VENV_DIR."
echo "Activating the existing virtual environment..."
source $VENV_DIR/bin/activate
fi

# Run the rocker command with the specified parameters
rocker --nvidia --x11 --user --pull --git --image-name "$CONTAINER_NAME" --name "$CONTAINER_NAME" --volume "${PWD}":/workspaces/"${CONTAINER_NAME}":Z --deps --oyr-run-arg " --detach" ubuntu:22.04 "$@"
rockervsc

deactivate

#this follows the same convention as if it were opened by a vscode devcontainer
code --folder-uri vscode-remote://attached-container+"$CONTAINER_HEX"/workspaces/"${CONTAINER_NAME}"

0 comments on commit 9df9b7f

Please sign in to comment.