diff --git a/.gitea/workflows/build_hugo_image.yml b/.gitea/workflows/build_hugo_image.yml index fb50a60..1addf6b 100644 --- a/.gitea/workflows/build_hugo_image.yml +++ b/.gitea/workflows/build_hugo_image.yml @@ -1,31 +1,31 @@ -name: Build Hugo Docker Image +# name: Build Hugo Docker Image -on: - push: - paths: - - "hugo.Dockerfile" +# on: +# push: +# paths: +# - "hugo.Dockerfile" -jobs: - build docker: - runs-on: linux_amd - steps: - - name: checkout code - uses: actions/checkout@v3 - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Login to Docker registry - uses: docker/login-action@v2 - with: - registry: git.d3vyce.fr - username: ${{ github.actor }} - password: ${{ secrets.GIT_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v4 - with: - context: . - file: ./hugo.Dockerfile - platforms: linux/amd64 - push: true - tags: git.d3vyce.fr/d3vyce/hugo:latest +# jobs: +# build docker: +# runs-on: linux_amd +# steps: +# - name: checkout code +# uses: actions/checkout@v3 +# - name: Set up QEMU +# uses: docker/setup-qemu-action@v2 +# - name: Set up Docker Buildx +# uses: docker/setup-buildx-action@v2 +# - name: Login to Docker registry +# uses: docker/login-action@v2 +# with: +# registry: git.d3vyce.fr +# username: ${{ github.actor }} +# password: ${{ secrets.GIT_TOKEN }} +# - name: Build and push +# uses: docker/build-push-action@v4 +# with: +# context: . +# file: ./hugo.Dockerfile +# platforms: linux/amd64 +# push: true +# tags: git.d3vyce.fr/d3vyce/hugo:latest diff --git a/Dockerfile b/Dockerfile index e02899e..591f7e1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ WORKDIR /opt/blog COPY . /opt/blog/ RUN git submodule update --init --recursive && \ - git -C themes/blowfish/ checkout v2.58.0 + git -C themes/blowfish/ checkout v2.59.0 RUN hugo # Publish Stage diff --git a/config/_default/params.toml b/config/_default/params.toml index a06b1f2..7d96813 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -39,7 +39,7 @@ smartTOCHideUnfocusedChildren = false layout = "custom" # valid options: page, profile, hero, card, background, custom homepageImage = "img/ocean.webp" # used in: hero, and card showRecent = true - showRecentItems = 9 + showRecentItems = 6 showMoreLink = true showMoreLinkDest = "/posts" cardView = true diff --git a/content/posts/authelia-selfhosted-sso/index.md b/content/posts/authelia-selfhosted-sso/index.md index e541b9e..72c2777 100644 --- a/content/posts/authelia-selfhosted-sso/index.md +++ b/content/posts/authelia-selfhosted-sso/index.md @@ -2,7 +2,7 @@ title: "Authelia : a selfhosted SSO" date: 2022-04-10 slug: "authelia-selfhosted-sso" -tags: ["authentication", "docker", "sso", "tools"] +tags: ["authentication", "docker", "SSO", "tools"] type: "security" --- diff --git a/content/posts/how-to-host-multiple-services-on-one-public-ip/index.md b/content/posts/how-to-host-multiple-services-on-one-public-ip/index.md index b5ed0eb..d3f1d7f 100644 --- a/content/posts/how-to-host-multiple-services-on-one-public-ip/index.md +++ b/content/posts/how-to-host-multiple-services-on-one-public-ip/index.md @@ -2,7 +2,7 @@ title: "How to host multiple services on one public IP ?" date: 2022-02-28 slug: "how-to-host-multiple-services-on-one-public-ip" -tags: ["ddns", "docker", "network", "reverse proxy"] +tags: ["DDNS", "docker", "network", "reverse proxy"] type: "infrastructure" --- diff --git a/content/posts/migrate-from-ghost-to-hugo/index.md b/content/posts/migrate-from-ghost-to-hugo/index.md index f36781d..e29d416 100644 --- a/content/posts/migrate-from-ghost-to-hugo/index.md +++ b/content/posts/migrate-from-ghost-to-hugo/index.md @@ -2,7 +2,7 @@ title: "Migrate from Ghost to Hugo" date: 2024-02-24 slug: "migrate-from-ghost-to-hugo" -tags: ["ci/cd", "docker", "git", "hugo"] +tags: ["CI/CD", "docker", "git", "hugo"] type: "programming" --- diff --git a/content/posts/uv-the-new-python-package-installer-written-in-rust/index.md b/content/posts/uv-the-new-python-package-installer-written-in-rust/index.md index a83f0ea..2f821e3 100644 --- a/content/posts/uv-the-new-python-package-installer-written-in-rust/index.md +++ b/content/posts/uv-the-new-python-package-installer-written-in-rust/index.md @@ -1,17 +1,33 @@ --- title: "UV the new python package installer written in Rust" -date: 2024-02-23 -draft: true +date: 2024-02-25 slug: "uv-the-new-python-package-installer-written-in-rust" -tags: ["ci/cd", "docker", "python", "tools"] +tags: ["CI/CD", "docker", "python", "tools"] type: "programming" --- ## Overview +[UV](https://astral.sh/blog/uv) is Team Astral's new tool. It's written in Rust and aims to replace `pip` and `pip-tools`, all with extreme speed. +After the publication of [Ruff](https://astral.sh/ruff), the team continues with the aim of creating a "Cargo for Python" with this new publication. + +UV can be installed in several ways (with pip or standalone) and is compatible with Linux, Windows and macOS. I installed it with the following command: +```bash +pip install uv +``` + +To use it, simply use the `uv` prefix and then one of the following commands: +```bash +# Basic command like install, uninstall, freeze, sync, compile +uv pip +# Create a VENV +uv venv +# Clean cache or show cache directory +uv cache +``` ## UV benchmark -Let's compare UV and VENV/PIP to see how this new solution performs: according to the creators, UV should be around 80x faster than `python -m venv` and 7x faster than `virtualenv`. +Let's compare UV and VENV/PIP to see how this new solution performs. According to the creators, UV should be around 80x faster than `python -m venv` and 7x faster than `virtualenv`. After creating virtual environments with these different tools, I was able to obtain the following results: @@ -76,8 +92,7 @@ options: { For packet insertion I find that UV is ~5x faster than pip and ~33x faster then `pip` with the UV cache. ## Docker image for CI/CD -UV - +Now let's try to integrate it into our CIs. To do this, I'll create a modified python image that I'll then use in my various workflows. ```dockerfile FROM python:3.11-slim @@ -91,6 +106,9 @@ ENV VIRTUAL_ENV /.venv ENV PATH /.venv/bin:$PATH ``` +The Dockerfile is quite simple, I base it on a python 3.11 image, upgrade pip, then install UV. I then create a venv with UV, and activate it. Finally, I install the packets I need for my workflows. + +Finally, I set the environment variables `VIRTUAL_ENV` and `PATH`. This allows me to be directly in the venv when using the image. I then build the image and check that it works correctly: ```bash debian@debian:~/dev/images$ docker build -t uv_python . [...] @@ -109,6 +127,9 @@ Type "help", "copyright", "credits" or "license" for more information. >>> ``` +After building and testing the image with a docker run, I can confirm that the image works correctly and is usable in my various CIs. + +In addition to this image, we can set the cache for UV in Workflow. For Gitlab, I use the following configuration: ```yml [...] variables: @@ -120,3 +141,16 @@ cache: - $CI_PROJECT_DIR/.cache/uv [...] ``` + +After a few, I've noticed that the cache can be useful in some situations (especially if you have a very good machine) but can also slow down the CI in others. In some situations, UV is faster than Gitlab's cache compression/decompression. In particular, I've seen it slow down runners using HDDs. + +I suggest you test with and without to see which is faster. + +## Conclusion + +UV is a very promising tool, in line with what Team Astral has to offer. In my opinion, it can already be deployed in production, and therefore saves a great amont of time, especially for repeat installations (e.g. CI). The speed of this tool even calls into question some current time-saving options, such as the CI cache. + +It's worth noting that, despite the objective of being a "drop-in replacement for pip", it currently lacks features that could be blocking in certain situations: +- No --trusted-host option ([#1339](https://github.com/astral-sh/uv/issues/1339)) +- No installation without venv ([#1374](https://github.com/astral-sh/uv/issues/1374)) +- etc. diff --git a/content/projects/d3vyce-fr/index.md b/content/projects/d3vyce-fr/index.md index d27c28f..887a678 100644 --- a/content/projects/d3vyce-fr/index.md +++ b/content/projects/d3vyce-fr/index.md @@ -7,7 +7,7 @@ showWordCount: false showReadingTime: false showRelatedContent: false showPagination: false -tags: ["bootstrap", "css3", "html5", "javascript"] +tags: ["bootstrap", "CSS3", "HTML5", "javascript"] --- ## Overview diff --git a/content/projects/url-shortener/index.md b/content/projects/url-shortener/index.md index 32cd214..5d55a2a 100644 --- a/content/projects/url-shortener/index.md +++ b/content/projects/url-shortener/index.md @@ -8,5 +8,5 @@ showWordCount: false showReadingTime: false showRelatedContent: false showPagination: false -tags: ["docker", "flask", "python", "sql"] +tags: ["docker", "flask", "python", "SQL"] --- diff --git a/hugo.Dockerfile b/hugo.Dockerfile index 7b9d788..4f8ab3c 100644 --- a/hugo.Dockerfile +++ b/hugo.Dockerfile @@ -7,4 +7,4 @@ ENV GO111MODULE=on RUN apk update && \ apk add --no-cache gcc musl-dev g++ git -RUN go install -tags extended github.com/gohugoio/hugo@v0.123.3 +RUN go install -tags extended github.com/gohugoio/hugo@v0.123.6 diff --git a/themes/blowfish b/themes/blowfish index f2b934c..984320d 160000 --- a/themes/blowfish +++ b/themes/blowfish @@ -1 +1 @@ -Subproject commit f2b934c8f471fa2bf31bcf4efe08be244d363e6f +Subproject commit 984320d0ef70f22d34f552c501600c434937f1d2