Skip to content

Commit

Permalink
Merge pull request #6 from iamtatsuki05/feature/uv
Browse files Browse the repository at this point in the history
change poetry -> uv
  • Loading branch information
iamtatsuki05 authored Oct 14, 2024
2 parents ecc786b + 1730147 commit c71f9b1
Show file tree
Hide file tree
Showing 10 changed files with 5,599 additions and 7,988 deletions.
189 changes: 187 additions & 2 deletions .github/workflows/test_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,195 @@ jobs:
# context: ${{ matrix.service }}/docker/cpu
# cache-from: type=gha
# cache-to: type=gha,mode=max

- name: Check space before cleanup
run: |
echo "Free space:"
df -h
sudo chown runner /mnt
- name: Cleanup
run: |
docker images
sudo rm -rf "/home/work/*" || true
sudo rm -rf "/opt/*" || true
sudo rm -rf "/usr/share/dotnet" || true
sudo rm -rf "$AGENT_TOOLSDIRECTORY" || true
sudo rm -rf "/usr/local/lib/android" || true
sudo rm -rf "/usr/local/share/boost" || true
sudo rm -rf "/usr/lib/jvm" || true
sudo rm -rf "/usr/share/swift" || true
sudo rm -rf "/usr/local/julia*" || true
sudo rm -rf "/usr/share/kotlinc" || true
sudo rm -rf "/usr/local/share/edge_driver" || true
sudo rm -rf "/usr/local/share/chromedriver-linux64" || true
sudo rm -rf "/usr/local/share/gecko_driver" || true
sudo rm -rf "/usr/share/miniconda" || true
sudo rm -rf "/usr/local/share/phantomjs*" || true
sudo rm -rf "/usr/share/sbt" || true
sudo rm -rf "/usr/local/sqlpackage" || true
sudo rm -rf "/usr/bin/yq" || true
sudo rm -rf "/usr/local/share/vcpkg" || true
sudo rm -rf "/usr/local/bin/terraform" || true
sudo rm -rf "/usr/local/bin/stack" || true
sudo rm -rf "/usr/local/bin/aliyun" || true
sudo rm -rf "/usr/local/bin/pulumi" || true
sudo rm -rf "/usr/local/bin/pulumi-language-dotnet" || true
sudo rm -rf "/usr/local/bin/azcopy" || true
sudo rm -rf "/usr/local/aws-cli" || true
sudo rm -rf "/usr/local/bin/bicep" || true
sudo rm -rf "/usr/local/bin/rebar3" || true
sudo rm -rf "/usr/local/bin/phpunit" || true
sudo rm -rf "/usr/local/bin/packer" || true
sudo rm -rf "/usr/local/bin/bicep" || true
sudo rm -rf "/home/.dotnet/tools" || true
sudo rm -rf "/etc/skel/.dotnet/tools" || true
sudo rm -rf "/usr/local/bin/minikube" || true
sudo rm -rf "/usr/local/bin/kustomize" || true
sudo rm -rf "/usr/local/bin/kubectl" || true
sudo rm -rf "/usr/local/bin/kind" || true
sudo rm -rf "/usr/local/bin/helm" || true
sudo rm -rf "/home/linuxbrew" || true
sudo rm -rf "/usr/share/apache-maven-3.8.8" || true
sudo rm -rf "/usr/share/gradle-8.7" || true
sudo rm -rf "/usr/local/share/phantomjs-8.6" || true
sudo rm -rf "/usr/local/bin/azcopy_11.3.1" || true
sudo rm -rf "/usr/local/bin/bicep" || true
sudo rm -rf "/usr/local/bin/.ghcup" || true
sudo rm -rf "/usr/local/.ghcup" || true
sudo rm -rf "/home/.nvm" || true
sudo rm -rf "/usr/bin/composer" || true
sudo rm -rf "/usr/local/bin/phpunit" || true
sudo rm -rf "/usr/local/bin/pulumi-analyzer-policy" || true
sudo rm -rf "/usr/local/bin/pulumi-analyzer-policy-python" || true
sudo rm -rf "/usr/local/bin/pulumi-language-java" || true
sudo rm -rf "/usr/local/bin/pulumi-language-nodejs" || true
sudo rm -rf "/usr/local/bin/pulumi-language-go" || true
sudo rm -rf "/usr/local/bin/pulumi-language-python" || true
sudo rm -rf "/usr/local/bin/pulumi-language-python-exec" || true
sudo rm -rf "/usr/local/bin/pulumi-language-yaml" || true
sudo rm -rf "/usr/local/bin/pulumi-resource-pulumi-nodejs" || true
sudo rm -rf "/usr/local/bin/pulumi-resource-pulumi-python" || true
sudo rm -rf "/usr/local/bin/pulumi-watch" || true
sudo rm -rf "/usr/local/bin/oc" || true
sudo rm -rf "/usr/local/bin/ctest" || true
sudo rm -rf "/usr/local/bin/cmake-gui" || true
sudo rm -rf "/usr/local/bin/ccmake" || true
sudo rm -rf "/usr/local/bin/cpack" || true
sudo rm -rf "/usr/local/bin/oras" || true
sudo rm -rf "/usr/local/share/emacs" || true
sudo rm -rf "/usr/local/share/fonts" || true
sudo rm -rf "/usr/local/share/icons" || true
sudo rm -rf "/usr/local/share/man" || true
sudo rm -rf "/usr/local/share/chromium" || true
sudo rm -rf "/usr/local/share/powershell" || true
sudo rm -rf "/usr/local/share/doc" || true
sudo rm -rf "/home/perflog" || true
sudo rm -rf "/usr/local/lib/lein" || true
sudo docker image prune --all --force
sudo npm uninstall bazel || true
sudo npm uninstall bazelisk || true
rustup self uninstall -y
sudo apt purge \
ansible \
aria2 \
azure-cli \
cabal* \
clang* \
dotnet-sdk* \
ghc* \
google-chrome-stable \
kubectl \
mysql* \
node* \
npm* \
php* \
powershell \
rpm \
ruby* \
subversion \
yarn \
firefox \
mono-complete \
nuget \
apache2 \
moby-engine \
moby-cli \
moby-buildx \
moby-compose \
microsoft-edge-stable \
mongodb* \
nginx \
postgresql* \
libpq-dev \
r-base \
sphinxsearch \
swig \
tcl \
temurin-* \
skopeo \
imagemagick-* \
mssql-tools* \
unixodbc-dev \
ubuntu-advantage-tools \
fonts-* \
llvm-* \
javascript-common \
openjdk-11-jre-headless \
linux-cloud-tools* \
linux-azure-6.2-* \
hicolor-icon-theme \
gcc-9 \
gcc-10 \
gcc-11 \
gcc-12 \
cloud-initramfs* \
x11-* \
bind9-* \
cloud-* \
gir1.2-* \
golang-github-* \
libjs-* \
libllvm* \
nano \
python3-* \
podman \
buildah \
skopeo \
temurin-* \
ant \
ant-optional \
libmysqlclient-dev \
libxft-dev \
libfreetype6-dev \
libfontconfig1-dev \
libpq-dev \
tcl* \
p7zip* \
gfortran-13 \
gcc-12-* \
gcc-11-* \
google-cloud-cli \
heroku \
snmp \
liblz4-dev \
man-db \
packages-microsoft-prod \
perl \
*-dev \
linux-headers-* \
manpages \
-yq || true
sudo dpkg -r packages-microsoft-prod > /dev/null 2>&1 || true
sudo apt-get autoremove -y > /dev/null 2>&1 || true
sudo apt-get autoclean -y > /dev/null 2>&1 || true
apt list --installed
ls -al /usr/local/share
- name: Setup docker
shell: bash
run: |
docker compose build python-cpu --progress=plain
docker compose up -d python-cpu
docker compose up python-cpu -d
- name: Test
run: docker compose exec python-cpu poetry run tox
run: docker compose exec python-cpu uv run tox
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test-poetry
name: test-uv

on:
pull_request:
Expand Down Expand Up @@ -33,15 +33,15 @@ jobs:
sudo apt-get update
sudo apt-get install -y mecab libmecab-dev mecab-ipadic-utf8
- name: Install Poetry
- name: Install uv
run: |
curl -sSL https://install.python-poetry.org | python3 -
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV
- name: Install dependencies
run: |
poetry install
uv sync
- name: Run tests
run: |
poetry run tox
uv run tox
4 changes: 2 additions & 2 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
ports:
- "8888:8888"
command:
poetry run jupyter lab
uv run jupyter lab
--ip=0.0.0.0
--allow-root
--NotebookApp.token=''
Expand Down Expand Up @@ -49,7 +49,7 @@ services:
- "6006:6006"
- "8888:8888"
command:
poetry run jupyter lab
uv run jupyter lab
--ip=0.0.0.0
--allow-root
--NotebookApp.token=''
Expand Down
15 changes: 6 additions & 9 deletions docker/cpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,15 @@ RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
&& python3 get-pip.py \
&& pip3 --no-cache-dir install --upgrade pip

## install Poetry
RUN curl -sSL https://install.python-poetry.org | python3 -
ENV PATH $PATH:/root/.local/bin
RUN poetry config virtualenvs.create true \
&& poetry config virtualenvs.in-project false
## install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv

WORKDIR ${WORKDIR}

# install python packages
COPY poetry.lock pyproject.toml ./
COPY uv.lock pyproject.toml ./
COPY src ./src
RUN poetry install --sync --with cpu --no-dev
RUN uv sync --frozen --no-cache

FROM base AS dev
WORKDIR /opt
Expand Down Expand Up @@ -83,6 +80,6 @@ RUN cp -r /usr/share/mecab/dic/ipadic/ `mecab-config --dicdir`/ \
WORKDIR ${WORKDIR}

# install python packages
COPY poetry.lock pyproject.toml ./
COPY uv.lock pyproject.toml ./
COPY src ./src
RUN poetry install --sync --with cpu
RUN uv sync --frozen --no-cache
19 changes: 8 additions & 11 deletions docker/gpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,16 @@ RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
&& python3 get-pip.py \
&& pip3 --no-cache-dir install --upgrade pip

## install Poetry
RUN curl -sSL https://install.python-poetry.org | python3 -
ENV PATH $PATH:/root/.local/bin
RUN poetry config virtualenvs.create true \
&& poetry config virtualenvs.in-project false
## install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv

WORKDIR ${WORKDIR}

# install python packages
COPY poetry.lock pyproject.toml ./
COPY uv.lock pyproject.toml ./
COPY src ./src
RUN poetry install --sync --with gpu --no-dev
RUN poetry run pip3 install deepspeed
RUN uv sync --frozen --no-cache
RUN uv run pip3 install deepspeed

FROM base AS dev
WORKDIR /opt
Expand Down Expand Up @@ -84,7 +81,7 @@ RUN cp -r /usr/share/mecab/dic/ipadic/ `mecab-config --dicdir`/ \
WORKDIR ${WORKDIR}

# install python packages
COPY poetry.lock pyproject.toml ./
COPY uv.lock pyproject.toml ./
COPY src ./src
RUN poetry install --sync --with gpu
RUN poetry run pip3 install deepspeed
RUN uv sync --frozen --no-cache
RUN uv run pip3 install deepspeed
Loading

0 comments on commit c71f9b1

Please sign in to comment.