-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from Caltech-AMBER/pixi-setup
Pixi Setup (python)
- Loading branch information
Showing
38 changed files
with
22,036 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "Obelisk Dev Container", | ||
"dockerComposeFile": "../docker/docker-compose.yml", | ||
"service": "obelisk", | ||
"workspaceFolder": "${localWorkspaceFolder}", | ||
"shutdownAction": "stopCompose", | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"mutantdino.resourcemonitor", | ||
"ms-azuretools.vscode-docker", | ||
"nvidia.nsight-vscode-edition", | ||
"ms-python.python", | ||
"charliermarsh.ruff" | ||
] | ||
} | ||
}, | ||
"initializeCommand": "export OBELISK_ROOT=${localWorkspaceFolder}", | ||
"remoteEnv": { | ||
"OBELISK_ROOT": "${localEnv: OBELISK_ROOT}" | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Core Tests | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12.4' | ||
- uses: prefix-dev/[email protected] | ||
with: | ||
pixi-version: v0.24.2 | ||
cache: true | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ hashFiles('pixi.toml') }} | ||
- name: Run Ruff Linter | ||
run: | | ||
pixi run --environment test-workflow ruff check docs/ obelisk/ tests/ --output-format=github | ||
- name: Run Ruff Formatter | ||
run: | | ||
pixi run --environment test-workflow ruff format docs/ obelisk/ tests/ --diff | ||
- name: Run Pyright | ||
run: | | ||
pixi run --environment test-workflow pyright | ||
- name: Test with pytest | ||
run: | | ||
pixi run --environment test-workflow pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
default_language_version: | ||
python: python3 | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
rev: v0.4.9 | ||
hooks: | ||
- id: ruff | ||
types_or: [ python, pyi, jupyter ] | ||
args: [ --fix ] | ||
- id: ruff-format | ||
types_or: [ python, pyi, jupyter ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
# base image | ||
FROM ubuntu:22.04 as base | ||
SHELL ["/bin/bash", "-c"] | ||
|
||
# username, uid, gid | ||
ARG USER=user | ||
ARG UID=1000 | ||
ARG GID=1000 | ||
ENV USER=$USER | ||
ENV UID=$UID | ||
ENV GID=$GID | ||
|
||
# set timezone | ||
ENV TZ=America/Los_Angeles | ||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
|
||
# essential dependencies | ||
RUN apt-get update -y && \ | ||
apt-get install -y \ | ||
curl \ | ||
build-essential \ | ||
cmake \ | ||
clang-tools-12 \ | ||
nano \ | ||
vim \ | ||
git \ | ||
python3-dev \ | ||
python-is-python3 \ | ||
python3-pip \ | ||
python3-argcomplete \ | ||
sudo && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# create non-root user with sudo privileges for certain commands | ||
RUN groupadd --gid $GID $USER && \ | ||
useradd --uid $UID --gid $GID -m $USER -d /home/${USER} --shell /usr/bin/bash && \ | ||
echo "${USER}:password" | chpasswd && \ | ||
usermod -aG sudo ${USER} && \ | ||
echo "%${USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers | ||
|
||
# switch to new user and workdir | ||
USER ${UID} | ||
|
||
# pixi, uv, and nvm (for pyright) | ||
RUN curl -fsSL https://pixi.sh/install.sh | bash && \ | ||
curl -LsSf https://astral.sh/uv/install.sh | sh && \ | ||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash && \ | ||
source /home/${USER}/.bashrc && \ | ||
export NVM_DIR="$HOME/.nvm" && \ | ||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \ | ||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" && \ | ||
nvm install 20 | ||
|
||
# add local user binary folder to PATH variable | ||
ENV PATH="${PATH}:/home/${USER}/.local/bin" | ||
WORKDIR /home/${USER} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
services: | ||
obelisk: | ||
shm_size: '12gb' | ||
build: | ||
context: . | ||
args: | ||
USER: $USER | ||
UID: $GID | ||
GID: $GID | ||
dockerfile: Dockerfile | ||
network_mode: host | ||
ipc: host | ||
environment: | ||
NVIDIA_DRIVER_CAPABILITIES: all | ||
DISPLAY: $DISPLAY | ||
USER: $USER | ||
UID: $UID | ||
GID: $UID | ||
QT_X11_NO_MITSHM: 1 | ||
security_opt: | ||
- seccomp=unconfined | ||
cap_add: | ||
- NET_ADMIN | ||
volumes: | ||
- $OBELISK_ROOT:$OBELISK_ROOT | ||
- /tmp/.X11-unix:/tmp/.X11-unix | ||
- $HOME/.Xauthority:/root/.Xauthority:rw | ||
- $HOME/.bashrc:$HOME/.bashrc | ||
ports: | ||
- 7007:7007 | ||
privileged: true | ||
working_dir: $OBELISK_ROOT | ||
stdin_open: true | ||
tty: true | ||
command: /bin/bash |
Oops, something went wrong.