diff --git a/.github/workflows/build_rocky.yml b/.github/workflows/build_rocky.yml index 6bb1cdceb7..804a9c8053 100644 --- a/.github/workflows/build_rocky.yml +++ b/.github/workflows/build_rocky.yml @@ -9,6 +9,13 @@ jobs: container: rockylinux:9 steps: + - name: Set up uv + uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0 + + - name: Install Python + # Installs latest Python version so it's preferred by uv over Rocky's system Python. + run: uv python install + - name: Install Dependencies run: | dnf update -y @@ -18,7 +25,6 @@ jobs: sqlite-devel bzip2-devel zlib-devel openssl-devel xz-devel \ readline-devel ncurses-devel libffi-devel libuuid-devel git-lfs \ findutils xz byacc patchelf libxkbcommon-devel - python3 -m pip install typing_extensions aqtinstall git config --global --add safe.directory '*' - name: Install aws cli @@ -46,7 +52,7 @@ jobs: - name: Unpack Dependencies run: | cd build - python3 ../nix/cache_dependencies.py unpack + uv run ../nix/cache_dependencies.py unpack - name: ccache uses: hendrikmuhs/ccache-action@v1.2.22 @@ -57,7 +63,7 @@ jobs: shell: bash run: | set -o pipefail - CXXFLAGS="-O3" CFLAGS="-O3 ${DARWIN_C_SOURCE}" ADD_COMMIT_SHA=1 BUILD_CFG=Release BUILD_IFCVIEWER=ON python3 ./nix/build-all.py -v --diskcleanup 2>&1 | tee build.log + CXXFLAGS="-O3" CFLAGS="-O3 ${DARWIN_C_SOURCE}" ADD_COMMIT_SHA=1 BUILD_CFG=Release BUILD_IFCVIEWER=ON uv run ./nix/build-all.py -v --diskcleanup 2>&1 | tee build.log - name: Upload Build Logs if: always() @@ -72,7 +78,7 @@ jobs: - name: Pack Dependencies run: | cd build - python3 ../nix/cache_dependencies.py pack + uv run ../nix/cache_dependencies.py pack - name: Commit and Push Changes to Build Repository run: | diff --git a/.github/workflows/build_rocky_arm.yml b/.github/workflows/build_rocky_arm.yml index e2e58766fb..0219660ba0 100644 --- a/.github/workflows/build_rocky_arm.yml +++ b/.github/workflows/build_rocky_arm.yml @@ -9,6 +9,13 @@ jobs: container: arm64v8/rockylinux:9 steps: + - name: Set up uv + uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0 + + - name: Install Python + # Installs latest Python version so it's preferred by uv over Rocky's system Python. + run: uv python install + - name: Install Dependencies run: | dnf update -y @@ -18,7 +25,6 @@ jobs: sqlite-devel bzip2-devel zlib-devel openssl-devel xz-devel \ readline-devel ncurses-devel libffi-devel libuuid-devel git-lfs \ findutils xz byacc patchelf libxkbcommon-devel - python3 -m pip install typing_extensions aqtinstall git config --global --add safe.directory '*' - name: Install aws cli @@ -46,7 +52,7 @@ jobs: - name: Unpack Dependencies run: | cd build - python3 ../nix/cache_dependencies.py unpack + uv run ../nix/cache_dependencies.py unpack - name: ccache uses: hendrikmuhs/ccache-action@v1.2.22 @@ -57,7 +63,7 @@ jobs: shell: bash run: | set -o pipefail - CXXFLAGS="-O3" CFLAGS="-O3 ${DARWIN_C_SOURCE}" ADD_COMMIT_SHA=1 BUILD_CFG=Release BUILD_IFCVIEWER=ON python3 ./nix/build-all.py -v --diskcleanup 2>&1 | tee build.log + CXXFLAGS="-O3" CFLAGS="-O3 ${DARWIN_C_SOURCE}" ADD_COMMIT_SHA=1 BUILD_CFG=Release BUILD_IFCVIEWER=ON uv run ./nix/build-all.py -v --diskcleanup 2>&1 | tee build.log - name: Upload Build Logs if: always() @@ -72,7 +78,7 @@ jobs: - name: Pack Dependencies run: | cd build - python3 ../nix/cache_dependencies.py pack + uv run ../nix/cache_dependencies.py pack - name: Commit and Push Changes to Build Repository run: | diff --git a/.github/workflows/ci-lint.yaml b/.github/workflows/ci-lint.yaml index 6dc18453ad..4ef84f8cbb 100644 --- a/.github/workflows/ci-lint.yaml +++ b/.github/workflows/ci-lint.yaml @@ -95,8 +95,7 @@ jobs: echo "\`\`\`" >> $GITHUB_STEP_SUMMARY } - run_check poe ruff-main - run_check poe ruff-old + run_check poe ruff exit $ERROR continue-on-error: true diff --git a/nix/build-all.py b/nix/build-all.py index 1b02d89a4e..cc7978d9b1 100644 --- a/nix/build-all.py +++ b/nix/build-all.py @@ -1,4 +1,6 @@ #!/usr/bin/python +# /// script +# /// ############################################################################### # # # This file is part of IfcOpenShell. # @@ -125,13 +127,7 @@ from collections.abc import Generator, Sequence from pathlib import Path from urllib.request import urlretrieve -try: - from typing import Literal, Union -except: - # python 3.6 compatibility for rocky 8 - from typing import Union - - from typing_extensions import Literal +from typing import Literal, Union logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) diff --git a/nix/cache_dependencies.py b/nix/cache_dependencies.py index 3d115764b4..7d231779ee 100644 --- a/nix/cache_dependencies.py +++ b/nix/cache_dependencies.py @@ -1,3 +1,5 @@ +# /// script +# /// """ Cache built dependencies for builds. diff --git a/pyproject.toml b/pyproject.toml index 0a8d1ec80c..45c0b357a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -215,10 +215,7 @@ exclude = [ [tool.poe.tasks] -ruff-main = "ruff check --extend-exclude nix/build-all.py" -# It's actually Python 3.6, but ruff only supports 3.7+, but it should do. -ruff-old = "ruff check nix/build-all.py --target-version py37" -ruff.sequence = ["ruff-main", "ruff-old"] +ruff = "ruff check" black = "black ." @@ -238,7 +235,7 @@ ty-venv-ios.sequence = [ {cmd = "uv pip install -r src/ifcopenshell-python/type-check-requirements.txt --python=src/ifcopenshell-python/.venv"}, ] -format.sequence = ["black", "ruff-main", "ruff-old"] +format.sequence = ["black", "ruff"] cmake-format = "gersemi . --in-place"