From beb0f7df03f9f5f9c974498458c96a6b0adc64a4 Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Sun, 12 Jan 2025 20:18:27 +0530 Subject: [PATCH 01/29] Testing uv instead of using pip --- .github/workflows/ci_cd.yml | 361 +++++++++++++++++++----------------- 1 file changed, 190 insertions(+), 171 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index fad0ce5..6e2f6c2 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -6,7 +6,7 @@ on: tags: - "*" branches: - - main + - test-uv env: MAIN_PYTHON_VERSION: '3.12' @@ -20,59 +20,59 @@ concurrency: cancel-in-progress: true jobs: - doc-style: - name: "Documentation style" - runs-on: ubuntu-latest - steps: - - uses: ansys/actions/doc-style@v8 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - tests: - name: "Tests" - runs-on: windows-latest - strategy: - matrix: - python-version: ['3.10', '3.11', '3.12'] - fail-fast: false - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - DISPLAY: ':99' - steps: - - name: Install Linux os dependencies - if: runner.os == 'Linux' - run: sudo apt install libegl1 - - - name: Setup headless display - uses: pyvista/setup-headless-display-action@v3 - - - uses: ansys/actions/tests-pytest@v8 - with: - python-version: ${{ matrix.python-version }} - - doc-build: - name: "Build documentation" - runs-on: ubuntu-latest - needs: [doc-style] - steps: - - name: Build project documentation - uses: ansys/actions/doc-build@v8 - with: - python-version: ${{ env.MAIN_PYTHON_VERSION }} - dependencies: "libegl1" - - doc-deploy: - name: "Deploy development documentation" - runs-on: ubuntu-latest - needs: [doc-build] - if: github.ref == 'refs/heads/main' - steps: - - uses: ansys/actions/doc-deploy-dev@v8 - with: - cname: ${{ env.DOCUMENTATION_CNAME }} - token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} - bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} - bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} + # doc-style: + # name: "Documentation style" + # runs-on: ubuntu-latest + # steps: + # - uses: ansys/actions/doc-style@v8 + # with: + # token: ${{ secrets.GITHUB_TOKEN }} + + # tests: + # name: "Tests" + # runs-on: windows-latest + # strategy: + # matrix: + # python-version: ['3.10', '3.11', '3.12'] + # fail-fast: false + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # DISPLAY: ':99' + # steps: + # - name: Install Linux os dependencies + # if: runner.os == 'Linux' + # run: sudo apt install libegl1 + + # - name: Setup headless display + # uses: pyvista/setup-headless-display-action@v3 + + # - uses: ansys/actions/tests-pytest@v8 + # with: + # python-version: ${{ matrix.python-version }} + + # doc-build: + # name: "Build documentation" + # runs-on: ubuntu-latest + # needs: [doc-style] + # steps: + # - name: Build project documentation + # uses: ansys/actions/doc-build@v8 + # with: + # python-version: ${{ env.MAIN_PYTHON_VERSION }} + # dependencies: "libegl1" + + # doc-deploy: + # name: "Deploy development documentation" + # runs-on: ubuntu-latest + # needs: [doc-build] + # if: github.ref == 'refs/heads/main' + # steps: + # - uses: ansys/actions/doc-deploy-dev@v8 + # with: + # cname: ${{ env.DOCUMENTATION_CNAME }} + # token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} + # bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} + # bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} build-application-windows: name: "Build Application" @@ -84,8 +84,14 @@ jobs: with: python-version: ${{ env.MAIN_PYTHON_VERSION }} + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} + enable-cache: true + - name: Install Dependencies - run: pip install -e .[freeze] + run: uv install --editable .[freeze] - name: Freeze application run: pyinstaller frozen.spec @@ -127,6 +133,12 @@ jobs: with: python-version: ${{ env.MAIN_PYTHON_VERSION }} + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} + enable-cache: true + - name: Install Linux Dependencies run: | sudo apt update @@ -193,7 +205,7 @@ jobs: ls -l ${RUNNER_WORKSPACE}/python-installer-qt-gui/src/ansys/tools/installer/assets/python-asset/${{ matrix.os }} - name: Install Dependencies - run: pip install -e .[freeze] + run: uv install --editable .[freeze] - name: Freeze application env: @@ -334,14 +346,21 @@ jobs: mv python-${{ env.PRECOMPILE_PYTHON_VERSION }}.tar.gz ${{ env.GITHUB_WORKSPACE }}/src/ansys/tools/installer/assets/python-asset/${{ env.FOLDER_NAME }} ls -l ${{ env.GITHUB_WORKSPACE }}/src/ansys/tools/installer/assets/python-asset/${{ env.FOLDER_NAME }} - - name: Update pip - run: | - python3 --version - python3 -m pip install pip -U - - name: Install pip Dependencies + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} + enable-cache: true + + # - name: Update pip + # run: | + # python3 --version + # python3 -m pip install pip -U + + - name: Install uv Dependencies run: | - python3 -m pip install --ignore-installed -e .[freeze] + uv install --editable .[freeze] - name: Freeze application env: @@ -401,113 +420,113 @@ jobs: path: | ${{ env.GITHUB_WORKSPACE }}/Ansys-Python-Manager_linux_${{ env.OS_VERSION_PROCESSED }}_${{ env.APPLICATION_VERSION }}.zip - sign-application-windows: - name: Sign application - needs: [build-application-windows] - runs-on: - group: ansys-network - labels: [self-hosted, Windows, signtool] - steps: - - name: Checkout the SignTool - uses: actions/checkout@v4 - with: - repository: ansys-internal/signtool-ansys-apps - token: ${{ secrets.SIGNTOOL_ACCESS_TOKEN }} - - - uses: actions/download-artifact@v4 - with: - name: Python-Installer-windows - path: signtool/installer - - - name: List current structure - run: ls -R - - - name: Sign application - working-directory: signtool - run: | - $filename = (get-ChildItem installer -recurse | where {$_.name -like "*Setup*"}).Name - $jobname = $filename -replace ".{4}$" - .\Ansys.SignClient.exe sign ` - --signUrl https://csign.ansys.com ` - -r gh_signtool_account ` - -s '${{ secrets.SIGNTOOL_PWD }}' ` - -n $jobname ` - -i installer/$filename ` - -o installer/$filename - - - uses: actions/upload-artifact@v4 - with: - name: Python-Installer-windows-signed - path: signtool/installer/*Setup*.exe - - release: - name: Release application - if: github.event_name == 'push' && contains(github.ref, 'refs/tags') - needs: - - sign-application-windows - - build-application-linux-debian - - build-application-linux-non-debian - runs-on: ubuntu-latest - steps: - - uses: actions/download-artifact@v4 - with: - name: Python-Installer-windows-signed - path: installer-signed - - - uses: actions/download-artifact@v4 - with: - name: Python-Installer-windows - path: installer - - - uses: actions/download-artifact@v4 - with: - name: Python-Installer-ubuntu_20.04 - path: installer - - - uses: actions/download-artifact@v4 - with: - name: Python-Installer-ubuntu_22.04 - path: installer - - - uses: actions/download-artifact@v4 - with: - name: Python-Installer-centos_stream9 - path: installer - - - uses: actions/download-artifact@v4 - with: - name: Python-Installer-fedora_40 - path: installer - - - name: Display structure of downloaded files - run: ls -R - - - name: Rename unsigned exe - run: | - cd installer - for filename in *.exe; do mv "$filename" "Unsigned_${filename}"; done; - cd - - - - name: Release to GitHub - uses: softprops/action-gh-release@v2 - with: - files: | - installer/*.zip - installer-signed/*.exe - installer/*.exe - generate_release_notes: true - - doc-deploy-release: - name: Upload release documentation - if: github.event_name == 'push' && contains(github.ref, 'refs/tags') - runs-on: ubuntu-latest - needs: [release, doc-build] - steps: - - name: Deploy the stable documentation - uses: ansys/actions/doc-deploy-stable@v8 - with: - cname: ${{ env.DOCUMENTATION_CNAME }} - token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} - bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} - bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} + # sign-application-windows: + # name: Sign application + # needs: [build-application-windows] + # runs-on: + # group: ansys-network + # labels: [self-hosted, Windows, signtool] + # steps: + # - name: Checkout the SignTool + # uses: actions/checkout@v4 + # with: + # repository: ansys-internal/signtool-ansys-apps + # token: ${{ secrets.SIGNTOOL_ACCESS_TOKEN }} + + # - uses: actions/download-artifact@v4 + # with: + # name: Python-Installer-windows + # path: signtool/installer + + # - name: List current structure + # run: ls -R + + # - name: Sign application + # working-directory: signtool + # run: | + # $filename = (get-ChildItem installer -recurse | where {$_.name -like "*Setup*"}).Name + # $jobname = $filename -replace ".{4}$" + # .\Ansys.SignClient.exe sign ` + # --signUrl https://csign.ansys.com ` + # -r gh_signtool_account ` + # -s '${{ secrets.SIGNTOOL_PWD }}' ` + # -n $jobname ` + # -i installer/$filename ` + # -o installer/$filename + + # - uses: actions/upload-artifact@v4 + # with: + # name: Python-Installer-windows-signed + # path: signtool/installer/*Setup*.exe + + # release: + # name: Release application + # if: github.event_name == 'push' && contains(github.ref, 'refs/tags') + # needs: + # - sign-application-windows + # - build-application-linux-debian + # - build-application-linux-non-debian + # runs-on: ubuntu-latest + # steps: + # - uses: actions/download-artifact@v4 + # with: + # name: Python-Installer-windows-signed + # path: installer-signed + + # - uses: actions/download-artifact@v4 + # with: + # name: Python-Installer-windows + # path: installer + + # - uses: actions/download-artifact@v4 + # with: + # name: Python-Installer-ubuntu_20.04 + # path: installer + + # - uses: actions/download-artifact@v4 + # with: + # name: Python-Installer-ubuntu_22.04 + # path: installer + + # - uses: actions/download-artifact@v4 + # with: + # name: Python-Installer-centos_stream9 + # path: installer + + # - uses: actions/download-artifact@v4 + # with: + # name: Python-Installer-fedora_40 + # path: installer + + # - name: Display structure of downloaded files + # run: ls -R + + # - name: Rename unsigned exe + # run: | + # cd installer + # for filename in *.exe; do mv "$filename" "Unsigned_${filename}"; done; + # cd - + + # - name: Release to GitHub + # uses: softprops/action-gh-release@v2 + # with: + # files: | + # installer/*.zip + # installer-signed/*.exe + # installer/*.exe + # generate_release_notes: true + + # doc-deploy-release: + # name: Upload release documentation + # if: github.event_name == 'push' && contains(github.ref, 'refs/tags') + # runs-on: ubuntu-latest + # needs: [release, doc-build] + # steps: + # - name: Deploy the stable documentation + # uses: ansys/actions/doc-deploy-stable@v8 + # with: + # cname: ${{ env.DOCUMENTATION_CNAME }} + # token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} + # bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} + # bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} From afdd789d896a719985041bec91be829a1cd37e28 Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Sun, 12 Jan 2025 21:09:13 +0530 Subject: [PATCH 02/29] Testing uv instead of pip --- .github/workflows/ci_cd.yml | 8 ++++---- pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 6e2f6c2..e57654f 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -91,7 +91,7 @@ jobs: enable-cache: true - name: Install Dependencies - run: uv install --editable .[freeze] + run: uv sync --extra freeze --no-venv - name: Freeze application run: pyinstaller frozen.spec @@ -205,7 +205,7 @@ jobs: ls -l ${RUNNER_WORKSPACE}/python-installer-qt-gui/src/ansys/tools/installer/assets/python-asset/${{ matrix.os }} - name: Install Dependencies - run: uv install --editable .[freeze] + run: uv sync --extra freeze --no-venv - name: Freeze application env: @@ -358,9 +358,9 @@ jobs: # python3 --version # python3 -m pip install pip -U - - name: Install uv Dependencies + - name: Install Dependencies run: | - uv install --editable .[freeze] + python3 -m uv sync --extra freeze --no-venv - name: Freeze application env: diff --git a/pyproject.toml b/pyproject.toml index bfbead4..7911b18 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "flit_core.buildapi" name = "ansys-tools-installer" description = "Python QT app or CLI for installing Python and PyAnsys." readme = "README.rst" -requires-python = ">=3.9,<4" +requires-python = ">=3.10,<4" license = { file = "LICENSE" } authors = [{ name = "Ansys, Inc.", email = "pyansys.core@ansys.com" }] maintainers = [{ name = "Ansys, Inc.", email = "pyansys.core@ansys.com" }] From e5b7f5413a6c45f9208f1bf2b29907370039b999 Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Sun, 12 Jan 2025 21:26:04 +0530 Subject: [PATCH 03/29] Testing uv instead of pip --- .github/workflows/ci_cd.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index e57654f..3614ab8 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -91,7 +91,9 @@ jobs: enable-cache: true - name: Install Dependencies - run: uv sync --extra freeze --no-venv + run: | + export UV_PROJECT_ENVIRONMENT="${pythonLocation}" + python3 -m uv sync --extra freeze - name: Freeze application run: pyinstaller frozen.spec @@ -205,7 +207,9 @@ jobs: ls -l ${RUNNER_WORKSPACE}/python-installer-qt-gui/src/ansys/tools/installer/assets/python-asset/${{ matrix.os }} - name: Install Dependencies - run: uv sync --extra freeze --no-venv + run: | + export UV_PROJECT_ENVIRONMENT="${pythonLocation}" + python3 -m uv sync --extra freeze - name: Freeze application env: @@ -360,7 +364,8 @@ jobs: - name: Install Dependencies run: | - python3 -m uv sync --extra freeze --no-venv + export UV_PROJECT_ENVIRONMENT="${pythonLocation}" + python3 -m uv sync --extra freeze - name: Freeze application env: From 14680cd0744ce32d94bf377c58157c2a1ef2b75d Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Sun, 12 Jan 2025 21:37:52 +0530 Subject: [PATCH 04/29] Testing uv instead of pip --- .github/workflows/ci_cd.yml | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 3614ab8..9a9a50c 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -85,14 +85,12 @@ jobs: python-version: ${{ env.MAIN_PYTHON_VERSION }} - name: Install uv - uses: astral-sh/setup-uv@v5 - with: - python-version: ${{ env.MAIN_PYTHON_VERSION }} - enable-cache: true + run: | + python3 -m pip install uv - name: Install Dependencies run: | - export UV_PROJECT_ENVIRONMENT="${pythonLocation}" + set UV_PROJECT_ENVIRONMENT=${{ env.pythonLocation }} python3 -m uv sync --extra freeze - name: Freeze application @@ -135,12 +133,6 @@ jobs: with: python-version: ${{ env.MAIN_PYTHON_VERSION }} - - name: Install uv - uses: astral-sh/setup-uv@v5 - with: - python-version: ${{ env.MAIN_PYTHON_VERSION }} - enable-cache: true - - name: Install Linux Dependencies run: | sudo apt update @@ -206,6 +198,10 @@ jobs: mv python-${{ env.PRECOMPILE_PYTHON_VERSION }}.tar.gz ${RUNNER_WORKSPACE}/python-installer-qt-gui/src/ansys/tools/installer/assets/python-asset/${{ matrix.os }} ls -l ${RUNNER_WORKSPACE}/python-installer-qt-gui/src/ansys/tools/installer/assets/python-asset/${{ matrix.os }} + - name: Install uv + run: | + python3 -m pip install uv + - name: Install Dependencies run: | export UV_PROJECT_ENVIRONMENT="${pythonLocation}" @@ -352,10 +348,8 @@ jobs: - name: Install uv - uses: astral-sh/setup-uv@v5 - with: - python-version: ${{ env.MAIN_PYTHON_VERSION }} - enable-cache: true + run: | + python3 -m pip install uv # - name: Update pip # run: | From daae82944c709612f43f7309c8894fe078bb0cd3 Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Sun, 12 Jan 2025 22:15:56 +0530 Subject: [PATCH 05/29] Testing uv instead of pip --- .github/workflows/ci_cd.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 9a9a50c..0def0a7 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -86,12 +86,12 @@ jobs: - name: Install uv run: | - python3 -m pip install uv + pip install uv - name: Install Dependencies run: | set UV_PROJECT_ENVIRONMENT=${{ env.pythonLocation }} - python3 -m uv sync --extra freeze + uv sync --extra freeze - name: Freeze application run: pyinstaller frozen.spec @@ -200,12 +200,12 @@ jobs: - name: Install uv run: | - python3 -m pip install uv + pip install uv - name: Install Dependencies run: | export UV_PROJECT_ENVIRONMENT="${pythonLocation}" - python3 -m uv sync --extra freeze + uv sync --extra freeze - name: Freeze application env: @@ -349,7 +349,7 @@ jobs: - name: Install uv run: | - python3 -m pip install uv + pip install uv # - name: Update pip # run: | @@ -358,13 +358,14 @@ jobs: - name: Install Dependencies run: | + export pythonLocation="/usr/bin/python-${{ env.PRECOMPILE_PYTHON_VERSION }}" export UV_PROJECT_ENVIRONMENT="${pythonLocation}" - python3 -m uv sync --extra freeze + uv sync --extra freeze - name: Freeze application env: ADD_PYTHON_BINARIES: false - run: python3 -m PyInstaller frozen.spec + run: PyInstaller frozen.spec - name: Setup and Copy CentOS/RHEL files for packaging if: contains(matrix.os, 'centos') From e0ac887a221f84c0704abd4d5c0b5494d1e5e4e5 Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Sun, 12 Jan 2025 22:19:34 +0530 Subject: [PATCH 06/29] Testing uv instead of pip --- .github/workflows/ci_cd.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 0def0a7..157df46 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -90,11 +90,10 @@ jobs: - name: Install Dependencies run: | - set UV_PROJECT_ENVIRONMENT=${{ env.pythonLocation }} uv sync --extra freeze - name: Freeze application - run: pyinstaller frozen.spec + run: uv run pyinstaller frozen.spec - name: Install NSIS run: choco install nsis -y @@ -204,13 +203,12 @@ jobs: - name: Install Dependencies run: | - export UV_PROJECT_ENVIRONMENT="${pythonLocation}" uv sync --extra freeze - name: Freeze application env: ADD_PYTHON_BINARIES: true - run: pyinstaller frozen.spec + run: uv run pyinstaller frozen.spec - name: Setup and Copy Linux files for packaging run: | @@ -358,14 +356,12 @@ jobs: - name: Install Dependencies run: | - export pythonLocation="/usr/bin/python-${{ env.PRECOMPILE_PYTHON_VERSION }}" - export UV_PROJECT_ENVIRONMENT="${pythonLocation}" uv sync --extra freeze - name: Freeze application env: ADD_PYTHON_BINARIES: false - run: PyInstaller frozen.spec + run: uv run PyInstaller frozen.spec - name: Setup and Copy CentOS/RHEL files for packaging if: contains(matrix.os, 'centos') From 3dc4de4a960508eb40adc6e058c7e05f2e121f8b Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Sun, 12 Jan 2025 22:30:32 +0530 Subject: [PATCH 07/29] Testing uv instead of pip --- .github/workflows/ci_cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 157df46..1eeb260 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -361,7 +361,7 @@ jobs: - name: Freeze application env: ADD_PYTHON_BINARIES: false - run: uv run PyInstaller frozen.spec + run: uv run pyinstaller frozen.spec - name: Setup and Copy CentOS/RHEL files for packaging if: contains(matrix.os, 'centos') From 42c0e5e46dc65a449e9a4a48ff71a410b067d7af Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Mon, 13 Jan 2025 01:28:37 +0530 Subject: [PATCH 08/29] Test - Adding uv to source code --- .../workflows/autoupdate_python_versions.yml | 4 ++-- Makefile | 20 ++++++++++++++----- README.rst | 18 ++++++++--------- make.bat | 14 +++++++------ src/ansys/tools/installer/installed_table.py | 20 +++++++++---------- src/ansys/tools/installer/linux_functions.py | 11 +++++----- 6 files changed, 50 insertions(+), 37 deletions(-) diff --git a/.github/workflows/autoupdate_python_versions.yml b/.github/workflows/autoupdate_python_versions.yml index 57fdd8c..7ea1345 100644 --- a/.github/workflows/autoupdate_python_versions.yml +++ b/.github/workflows/autoupdate_python_versions.yml @@ -33,8 +33,8 @@ jobs: - name: Run the autoupdate script run: | - python -m pip install --upgrade pip - pip install -r scripts/requirements.txt + python -m pip install --upgrade pip uv + uv pip install -r scripts/requirements.txt python scripts/update_python_versions.py - name: Commit changes (if any) diff --git a/Makefile b/Makefile index f355241..2cb8e1a 100644 --- a/Makefile +++ b/Makefile @@ -2,29 +2,39 @@ .PHONY: install tests doc build clean fresh-build install: + @echo "Installing uv..." + pip install uv @echo "Installing..." - pip install -e .[freeze] + uv pip install -e .[freeze] @echo "Installation complete." tests: + @echo "Installing uv..." + pip install uv @echo "Installing test dependencies..." - pip install -e .[tests] + uv pip install -e .[tests] @echo "Running tests..." - pytest + uv run pytest @echo "Tests complete." doc: + @echo "Installing uv..." + pip install uv @echo "Installing documentation dependencies..." - pip install -e .[doc] + uv pip install -e .[doc] @echo "Building documentation..." cd doc && make clean && make html && cd .. @echo "Documentation complete." build: + @echo "Installing uv..." + pip install uv @echo "Freezing using pyinstaller" - pyinstaller frozen.spec + uv run pyinstaller frozen.spec clean: + @echo "Installing uv..." + pip install uv @echo "Cleaning up build files..." rm -rf build dist diff --git a/README.rst b/README.rst index c81aba5..76ce8d8 100644 --- a/README.rst +++ b/README.rst @@ -50,8 +50,8 @@ You can be up and running with four lines of code: git clone https://github.com/ansys/python-installer-qt-gui cd python-installer-qt-gui - pip install pip -U - pip install -e . + pip install pip uv -U + uv pip install -e . Now you can run it with: @@ -94,13 +94,13 @@ guide`_. You will need to follow these steps: .. code:: bash - python -m pip install -U pip + python -m pip install -U pip uv #. Install the project in editable mode: .. code:: bash - python -m pip install -e .[tests,doc] + python -m uv pip install -e .[tests,doc] #. Finally, verify your development installation by running: @@ -115,8 +115,8 @@ This project uses `pre-commit `_. Install with: .. code:: - pip install pre-commit - pre-commit install + uv pip install pre-commit + uv pre-commit install This will now run ``pre-commit`` for each commit to ensure you follow project style guidelines. For example: @@ -150,8 +150,8 @@ This application can be deployed as a 'frozen' application using `pyinstaller .. code:: - pip install -e .[freeze] - pyinstaller frozen.spec + uv pip install -e .[freeze] + uv run pyinstaller frozen.spec This will generate application files at ``dist/ansys_python_manager`` and you can run it locally by executing ``Ansys Python Manager.exe``. @@ -164,7 +164,7 @@ For building documentation, you can either run the usual rules provided in the .. code:: bash - pip install -e .[doc] + uv pip install -e .[doc] make -C doc/ html # subsequently open the documentation with (under Linux): diff --git a/make.bat b/make.bat index 3b41952..491d967 100644 --- a/make.bat +++ b/make.bat @@ -11,22 +11,24 @@ if "%1" == "build" goto build if "%1" == "clean" goto clean if "%1" == "fresh-build" goto fresh-build +pip install -U pip uv + :install Echo ^>^>^> Installing... -pip install -e .[freeze] +uv pip install -e .[freeze] Echo ^>^>^> Installation complete. goto end :tests Echo ^>^>^> Installing test dependencies... -pip install -e .[tests] +uv pip install -e .[tests] Echo ^>^>^> Running tests... -pytest +uv run pytest goto end :doc Echo ^>^>^> Installing documentation dependencies... -pip install -e .[doc] +uv pip install -e .[doc] Echo ^>^>^> Building documentation... chdir /d doc call make.bat clean @@ -37,7 +39,7 @@ goto end :build Echo ^>^>^> Freezing using pyinstaller -pyinstaller frozen.spec +uv run pyinstaller frozen.spec goto end :clean @@ -51,7 +53,7 @@ Echo ^>^>^> Cleaning up build files... rmdir /s /q build > /NUL 2>&1 rmdir /s /q dist > /NUL 2>&1 Echo ^>^>^> Freezing using pyinstaller -pyinstaller frozen.spec +uv run pyinstaller frozen.spec goto end :end diff --git a/src/ansys/tools/installer/installed_table.py b/src/ansys/tools/installer/installed_table.py index c4a994c..ff18217 100644 --- a/src/ansys/tools/installer/installed_table.py +++ b/src/ansys/tools/installer/installed_table.py @@ -357,16 +357,16 @@ def eventFilter(self, source, event): def launch_spyder(self): """Launch spyder IDE.""" # handle errors - error_msg = "(pip install spyder && spyder && exit 0) || echo Failed to launch. Try reinstalling spyder with pip install spyder --force-reinstall" + error_msg = "(uv pip install spyder && spyder && exit 0) || echo Failed to launch. Try reinstalling spyder with pip install spyder --force-reinstall" self._update_pck_mnger() self.launch_cmd( - f'pip list | {"grep" if is_linux_os() else "findstr"} "spyder" && spyder && exit 0 || {error_msg}' + f'uv pip list | {"grep" if is_linux_os() else "findstr"} "spyder" && spyder && exit 0 || {error_msg}' ) def launch_jupyterlab(self): """Launch Jupyterlab.""" # handle errors - error_msg = "pip install jupyterlab && python -m jupyter lab || echo Failed to launch. Try reinstalling jupyterlab with pip install jupyterlab --force-reinstall" + error_msg = "uv pip install jupyterlab && python -m jupyter lab || echo Failed to launch. Try reinstalling jupyterlab with pip install jupyterlab --force-reinstall" self._update_pck_mnger() self.launch_cmd(f"python -m jupyter lab || {error_msg}") @@ -377,13 +377,13 @@ def launch_vscode(self): def launch_jupyter_notebook(self): """Launch Jupyter Notebook.""" # handle errors - error_msg = "pip install jupyter && python -m jupyter notebook || echo Failed to launch. Try reinstalling jupyter with pip install jupyter --force-reinstall" + error_msg = "uv pip install jupyter && python -m jupyter notebook || echo Failed to launch. Try reinstalling jupyter with pip install jupyter --force-reinstall" self._update_pck_mnger() self.launch_cmd(f"python -m jupyter notebook || {error_msg}") def install_defaults(self): """Install Python default packages.""" - cmd = "pip install numpy pandas scipy scikit-learn matplotlib pyvista[all] && timeout 3 && exit || echo Failed to install default Python packages. Try reinstalling it with pip install numpy pandas scipy scikit-learn matplotlib pyvista[all] --force-reinstall" + cmd = "uv pip install numpy pandas scipy scikit-learn matplotlib pyvista[all] && timeout 3 && exit || echo Failed to install default Python packages. Try reinstalling it with pip install numpy pandas scipy scikit-learn matplotlib pyvista[all] --force-reinstall" self._update_pck_mnger() self.launch_cmd(cmd) @@ -396,7 +396,7 @@ def install_pyansys_packages(self): if chosen_ver else f"{PYANSYS_LIBS[chosen_pkg]}" ) - cmd = f"pip install {pck_ver} && timeout 3 && exit || echo Failed to install this PyAnsys Library. Try reinstalling it with pip install {pck_ver} --force-reinstall" + cmd = f"uv pip install {pck_ver} && timeout 3 && exit || echo Failed to install this PyAnsys Library. Try reinstalling it with pip install {pck_ver} --force-reinstall" self._update_pck_mnger() self.launch_cmd(cmd, always_use_pip=True) @@ -417,7 +417,7 @@ def update_package_combo(self, index): def list_packages(self): """List installed Python packages.""" - self.launch_cmd("pip list") + self.launch_cmd("uv pip list") def _update_pck_mnger(self): """Update package manager if needed. @@ -428,7 +428,7 @@ def _update_pck_mnger(self): """ if self.is_chk_box_active(): if "Python" in self.table.active_version: - cmd = "python -m pip install -U pip && exit" + cmd = "python -m pip install -U pip uv && exit" else: # Otherwise, conda cmd = "conda update conda --yes && exit" self.launch_cmd(cmd, minimized_window=True) @@ -610,7 +610,7 @@ def launch_cmd( if extra: # Replace the pip install command for conda if not always_use_pip: - extra = extra.replace("pip", "conda") + extra = extra.replace("uv pip", "conda") extra = extra.replace("conda install", "conda install --yes") cmd = f"&& {extra}" else: @@ -627,7 +627,7 @@ def launch_cmd( if extra: # Replace the pip install command for conda if not always_use_pip: - extra = extra.replace("pip", "conda") + extra = extra.replace("uv pip", "conda") extra = extra.replace("conda install", "conda install --yes") cmd = f"&& {extra}" else: diff --git a/src/ansys/tools/installer/linux_functions.py b/src/ansys/tools/installer/linux_functions.py index 63cc695..8c0faab 100644 --- a/src/ansys/tools/installer/linux_functions.py +++ b/src/ansys/tools/installer/linux_functions.py @@ -246,7 +246,7 @@ def run_linux_command(pypath, extra, venv=False): Examples -------- - >>> run_linux_command("/home/sha/.local/ansys/python-3.8.10/bin/python3", "pip list") + >>> run_linux_command("/home/sha/.local/ansys/python-3.8.10/bin/python3", "uv pip list") """ prefix = f"{pypath}" @@ -263,7 +263,7 @@ def run_linux_command(pypath, extra, venv=False): prefix = f". {pypath}/bin/activate; " else: prefix = "/".join(prefix.split("/")[:-1]) + "/" - extra = extra.replace("pip", f"pip{major_version}") + #extra = extra.replace("pip", f"pip{major_version}") execute_linux_command(f"cd ~ ; {prefix}{extra}", wait=False) @@ -273,13 +273,13 @@ def run_linux_command_conda(pypath, extra, venv=False): Examples -------- - >>> run_linux_command_conda("/home/sha/.local/ansys/python-3.8.10/bin/python3", "pip list") + >>> run_linux_command_conda("/home/sha/.local/ansys/python-3.8.10/bin/python3", "uv pip list") """ venvParam = "" extra = extra.replace("timeout", "sleep") extra = extra.replace("conda install --yes", "mamba install --yes") - # extra = extra.replace("conda update conda --yes", "python -m pip install -U pip") + # extra = extra.replace("conda update conda --yes", "python -m pip install -U pip uv") extra = extra.replace( "conda update conda --yes", "mamba update -n base mamba --yes" ) @@ -302,7 +302,8 @@ def run_linux_command_conda(pypath, extra, venv=False): break venvParam = f"; . {miniforge_path}; . {miniforge_path.replace('conda.sh', 'mamba.sh')} ;mamba activate {pypath}" else: - extra = extra.replace(" pip", f" {pypath}/bin/pip") + pass + #extra = extra.replace(" pip", f" {pypath}/bin/pip") execute_linux_command(f"cd ~ {venvParam} ; {conda_path}{extra} ", wait=False) From 2e7a490a6c0d842f4c917f67f879f4a46d5d25d6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 12 Jan 2025 19:59:06 +0000 Subject: [PATCH 09/29] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/ansys/tools/installer/linux_functions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ansys/tools/installer/linux_functions.py b/src/ansys/tools/installer/linux_functions.py index 8c0faab..e713562 100644 --- a/src/ansys/tools/installer/linux_functions.py +++ b/src/ansys/tools/installer/linux_functions.py @@ -263,7 +263,7 @@ def run_linux_command(pypath, extra, venv=False): prefix = f". {pypath}/bin/activate; " else: prefix = "/".join(prefix.split("/")[:-1]) + "/" - #extra = extra.replace("pip", f"pip{major_version}") + # extra = extra.replace("pip", f"pip{major_version}") execute_linux_command(f"cd ~ ; {prefix}{extra}", wait=False) @@ -303,7 +303,7 @@ def run_linux_command_conda(pypath, extra, venv=False): venvParam = f"; . {miniforge_path}; . {miniforge_path.replace('conda.sh', 'mamba.sh')} ;mamba activate {pypath}" else: pass - #extra = extra.replace(" pip", f" {pypath}/bin/pip") + # extra = extra.replace(" pip", f" {pypath}/bin/pip") execute_linux_command(f"cd ~ {venvParam} ; {conda_path}{extra} ", wait=False) From 3253307f4daef7f173d62e55161541bc543205ab Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Tue, 14 Jan 2025 20:00:43 +0530 Subject: [PATCH 10/29] revert CI/CD --- .github/workflows/ci_cd.yml | 349 ++++++++++++++++++------------------ README.rst | 2 +- 2 files changed, 173 insertions(+), 178 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 1eeb260..4db126f 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -6,7 +6,7 @@ on: tags: - "*" branches: - - test-uv + - main env: MAIN_PYTHON_VERSION: '3.12' @@ -20,59 +20,59 @@ concurrency: cancel-in-progress: true jobs: - # doc-style: - # name: "Documentation style" - # runs-on: ubuntu-latest - # steps: - # - uses: ansys/actions/doc-style@v8 - # with: - # token: ${{ secrets.GITHUB_TOKEN }} - - # tests: - # name: "Tests" - # runs-on: windows-latest - # strategy: - # matrix: - # python-version: ['3.10', '3.11', '3.12'] - # fail-fast: false - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # DISPLAY: ':99' - # steps: - # - name: Install Linux os dependencies - # if: runner.os == 'Linux' - # run: sudo apt install libegl1 - - # - name: Setup headless display - # uses: pyvista/setup-headless-display-action@v3 - - # - uses: ansys/actions/tests-pytest@v8 - # with: - # python-version: ${{ matrix.python-version }} - - # doc-build: - # name: "Build documentation" - # runs-on: ubuntu-latest - # needs: [doc-style] - # steps: - # - name: Build project documentation - # uses: ansys/actions/doc-build@v8 - # with: - # python-version: ${{ env.MAIN_PYTHON_VERSION }} - # dependencies: "libegl1" - - # doc-deploy: - # name: "Deploy development documentation" - # runs-on: ubuntu-latest - # needs: [doc-build] - # if: github.ref == 'refs/heads/main' - # steps: - # - uses: ansys/actions/doc-deploy-dev@v8 - # with: - # cname: ${{ env.DOCUMENTATION_CNAME }} - # token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} - # bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} - # bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} + doc-style: + name: "Documentation style" + runs-on: ubuntu-latest + steps: + - uses: ansys/actions/doc-style@v8 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + tests: + name: "Tests" + runs-on: windows-latest + strategy: + matrix: + python-version: ['3.10', '3.11', '3.12'] + fail-fast: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DISPLAY: ':99' + steps: + - name: Install Linux os dependencies + if: runner.os == 'Linux' + run: sudo apt install libegl1 + + - name: Setup headless display + uses: pyvista/setup-headless-display-action@v3 + + - uses: ansys/actions/tests-pytest@v8 + with: + python-version: ${{ matrix.python-version }} + + doc-build: + name: "Build documentation" + runs-on: ubuntu-latest + needs: [doc-style] + steps: + - name: Build project documentation + uses: ansys/actions/doc-build@v8 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} + dependencies: "libegl1" + + doc-deploy: + name: "Deploy development documentation" + runs-on: ubuntu-latest + needs: [doc-build] + if: github.ref == 'refs/heads/main' + steps: + - uses: ansys/actions/doc-deploy-dev@v8 + with: + cname: ${{ env.DOCUMENTATION_CNAME }} + token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} + bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} + bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} build-application-windows: name: "Build Application" @@ -84,13 +84,13 @@ jobs: with: python-version: ${{ env.MAIN_PYTHON_VERSION }} - - name: Install uv + - name: Upgrade pip & uv run: | - pip install uv + pip install -U pip uv - name: Install Dependencies run: | - uv sync --extra freeze + uv pip install -e .[freeze] - name: Freeze application run: uv run pyinstaller frozen.spec @@ -197,13 +197,13 @@ jobs: mv python-${{ env.PRECOMPILE_PYTHON_VERSION }}.tar.gz ${RUNNER_WORKSPACE}/python-installer-qt-gui/src/ansys/tools/installer/assets/python-asset/${{ matrix.os }} ls -l ${RUNNER_WORKSPACE}/python-installer-qt-gui/src/ansys/tools/installer/assets/python-asset/${{ matrix.os }} - - name: Install uv + - name: Upgrade pip & uv run: | - pip install uv + pip install -U pip uv - name: Install Dependencies run: | - uv sync --extra freeze + uv pip install -e .[freeze] - name: Freeze application env: @@ -345,18 +345,13 @@ jobs: ls -l ${{ env.GITHUB_WORKSPACE }}/src/ansys/tools/installer/assets/python-asset/${{ env.FOLDER_NAME }} - - name: Install uv + - name: Upgrade pip & uv run: | - pip install uv - - # - name: Update pip - # run: | - # python3 --version - # python3 -m pip install pip -U + pip install -U pip uv - name: Install Dependencies run: | - uv sync --extra freeze + uv pip install -e .[freeze] - name: Freeze application env: @@ -416,113 +411,113 @@ jobs: path: | ${{ env.GITHUB_WORKSPACE }}/Ansys-Python-Manager_linux_${{ env.OS_VERSION_PROCESSED }}_${{ env.APPLICATION_VERSION }}.zip - # sign-application-windows: - # name: Sign application - # needs: [build-application-windows] - # runs-on: - # group: ansys-network - # labels: [self-hosted, Windows, signtool] - # steps: - # - name: Checkout the SignTool - # uses: actions/checkout@v4 - # with: - # repository: ansys-internal/signtool-ansys-apps - # token: ${{ secrets.SIGNTOOL_ACCESS_TOKEN }} - - # - uses: actions/download-artifact@v4 - # with: - # name: Python-Installer-windows - # path: signtool/installer - - # - name: List current structure - # run: ls -R - - # - name: Sign application - # working-directory: signtool - # run: | - # $filename = (get-ChildItem installer -recurse | where {$_.name -like "*Setup*"}).Name - # $jobname = $filename -replace ".{4}$" - # .\Ansys.SignClient.exe sign ` - # --signUrl https://csign.ansys.com ` - # -r gh_signtool_account ` - # -s '${{ secrets.SIGNTOOL_PWD }}' ` - # -n $jobname ` - # -i installer/$filename ` - # -o installer/$filename - - # - uses: actions/upload-artifact@v4 - # with: - # name: Python-Installer-windows-signed - # path: signtool/installer/*Setup*.exe - - # release: - # name: Release application - # if: github.event_name == 'push' && contains(github.ref, 'refs/tags') - # needs: - # - sign-application-windows - # - build-application-linux-debian - # - build-application-linux-non-debian - # runs-on: ubuntu-latest - # steps: - # - uses: actions/download-artifact@v4 - # with: - # name: Python-Installer-windows-signed - # path: installer-signed - - # - uses: actions/download-artifact@v4 - # with: - # name: Python-Installer-windows - # path: installer - - # - uses: actions/download-artifact@v4 - # with: - # name: Python-Installer-ubuntu_20.04 - # path: installer - - # - uses: actions/download-artifact@v4 - # with: - # name: Python-Installer-ubuntu_22.04 - # path: installer - - # - uses: actions/download-artifact@v4 - # with: - # name: Python-Installer-centos_stream9 - # path: installer - - # - uses: actions/download-artifact@v4 - # with: - # name: Python-Installer-fedora_40 - # path: installer - - # - name: Display structure of downloaded files - # run: ls -R - - # - name: Rename unsigned exe - # run: | - # cd installer - # for filename in *.exe; do mv "$filename" "Unsigned_${filename}"; done; - # cd - - - # - name: Release to GitHub - # uses: softprops/action-gh-release@v2 - # with: - # files: | - # installer/*.zip - # installer-signed/*.exe - # installer/*.exe - # generate_release_notes: true - - # doc-deploy-release: - # name: Upload release documentation - # if: github.event_name == 'push' && contains(github.ref, 'refs/tags') - # runs-on: ubuntu-latest - # needs: [release, doc-build] - # steps: - # - name: Deploy the stable documentation - # uses: ansys/actions/doc-deploy-stable@v8 - # with: - # cname: ${{ env.DOCUMENTATION_CNAME }} - # token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} - # bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} - # bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} + sign-application-windows: + name: Sign application + needs: [build-application-windows] + runs-on: + group: ansys-network + labels: [self-hosted, Windows, signtool] + steps: + - name: Checkout the SignTool + uses: actions/checkout@v4 + with: + repository: ansys-internal/signtool-ansys-apps + token: ${{ secrets.SIGNTOOL_ACCESS_TOKEN }} + + - uses: actions/download-artifact@v4 + with: + name: Python-Installer-windows + path: signtool/installer + + - name: List current structure + run: ls -R + + - name: Sign application + working-directory: signtool + run: | + $filename = (get-ChildItem installer -recurse | where {$_.name -like "*Setup*"}).Name + $jobname = $filename -replace ".{4}$" + .\Ansys.SignClient.exe sign ` + --signUrl https://csign.ansys.com ` + -r gh_signtool_account ` + -s '${{ secrets.SIGNTOOL_PWD }}' ` + -n $jobname ` + -i installer/$filename ` + -o installer/$filename + + - uses: actions/upload-artifact@v4 + with: + name: Python-Installer-windows-signed + path: signtool/installer/*Setup*.exe + + release: + name: Release application + if: github.event_name == 'push' && contains(github.ref, 'refs/tags') + needs: + - sign-application-windows + - build-application-linux-debian + - build-application-linux-non-debian + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v4 + with: + name: Python-Installer-windows-signed + path: installer-signed + + - uses: actions/download-artifact@v4 + with: + name: Python-Installer-windows + path: installer + + - uses: actions/download-artifact@v4 + with: + name: Python-Installer-ubuntu_20.04 + path: installer + + - uses: actions/download-artifact@v4 + with: + name: Python-Installer-ubuntu_22.04 + path: installer + + - uses: actions/download-artifact@v4 + with: + name: Python-Installer-centos_stream9 + path: installer + + - uses: actions/download-artifact@v4 + with: + name: Python-Installer-fedora_40 + path: installer + + - name: Display structure of downloaded files + run: ls -R + + - name: Rename unsigned exe + run: | + cd installer + for filename in *.exe; do mv "$filename" "Unsigned_${filename}"; done; + cd - + + - name: Release to GitHub + uses: softprops/action-gh-release@v2 + with: + files: | + installer/*.zip + installer-signed/*.exe + installer/*.exe + generate_release_notes: true + + doc-deploy-release: + name: Upload release documentation + if: github.event_name == 'push' && contains(github.ref, 'refs/tags') + runs-on: ubuntu-latest + needs: [release, doc-build] + steps: + - name: Deploy the stable documentation + uses: ansys/actions/doc-deploy-stable@v8 + with: + cname: ${{ env.DOCUMENTATION_CNAME }} + token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} + bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} + bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} diff --git a/README.rst b/README.rst index 76ce8d8..1dbfde7 100644 --- a/README.rst +++ b/README.rst @@ -116,7 +116,7 @@ This project uses `pre-commit `_. Install with: .. code:: uv pip install pre-commit - uv pre-commit install + uv run pre-commit install This will now run ``pre-commit`` for each commit to ensure you follow project style guidelines. For example: From 17923678d538aa6666c75ff4171807cced57d0fe Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Tue, 14 Jan 2025 20:12:03 +0530 Subject: [PATCH 11/29] minor fix --- .github/workflows/ci_cd.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 4db126f..920a084 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -90,7 +90,7 @@ jobs: - name: Install Dependencies run: | - uv pip install -e .[freeze] + uv sync --extra freeze - name: Freeze application run: uv run pyinstaller frozen.spec @@ -203,7 +203,7 @@ jobs: - name: Install Dependencies run: | - uv pip install -e .[freeze] + uv sync --extra freeze - name: Freeze application env: @@ -351,7 +351,7 @@ jobs: - name: Install Dependencies run: | - uv pip install -e .[freeze] + uv sync --extra freeze - name: Freeze application env: From 71bc786f1abcfe90a9354ed22bc6c3bc7332c9aa Mon Sep 17 00:00:00 2001 From: Tushar Bana <153725830+tusharbana-ansys@users.noreply.github.com> Date: Wed, 15 Jan 2025 22:45:32 +0530 Subject: [PATCH 12/29] Update Makefile Co-authored-by: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2cb8e1a..4686678 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ install: @echo "Installing uv..." - pip install uv + pip install uv @echo "Installing..." uv pip install -e .[freeze] @echo "Installation complete." From e357c78c03085e894fb2970ed76689f7a12de12f Mon Sep 17 00:00:00 2001 From: Tushar Bana <153725830+tusharbana-ansys@users.noreply.github.com> Date: Wed, 15 Jan 2025 22:45:53 +0530 Subject: [PATCH 13/29] Update Makefile Co-authored-by: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4686678..fab630d 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ install: tests: @echo "Installing uv..." - pip install uv + pip install uv @echo "Installing test dependencies..." uv pip install -e .[tests] @echo "Running tests..." From 080d50c2d021e5ddcaedd49626371ed9868dadc4 Mon Sep 17 00:00:00 2001 From: Tushar Bana <153725830+tusharbana-ansys@users.noreply.github.com> Date: Wed, 15 Jan 2025 22:46:03 +0530 Subject: [PATCH 14/29] Update Makefile Co-authored-by: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index fab630d..5c4dd08 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ tests: doc: @echo "Installing uv..." - pip install uv + pip install uv @echo "Installing documentation dependencies..." uv pip install -e .[doc] @echo "Building documentation..." From 3e016a0c03b2e1481675a13ef80242ae90ed1400 Mon Sep 17 00:00:00 2001 From: Tushar Bana <153725830+tusharbana-ansys@users.noreply.github.com> Date: Wed, 15 Jan 2025 22:46:20 +0530 Subject: [PATCH 15/29] Update Makefile Co-authored-by: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5c4dd08..1b8952b 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ doc: build: @echo "Installing uv..." - pip install uv + pip install uv @echo "Freezing using pyinstaller" uv run pyinstaller frozen.spec From 938782a1e492df21ac00f18d8641fdbd3cdfc2cd Mon Sep 17 00:00:00 2001 From: Tushar Bana <153725830+tusharbana-ansys@users.noreply.github.com> Date: Wed, 15 Jan 2025 22:46:31 +0530 Subject: [PATCH 16/29] Update Makefile Co-authored-by: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1b8952b..4d19502 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ build: clean: @echo "Installing uv..." - pip install uv + pip install uv @echo "Cleaning up build files..." rm -rf build dist From c0621c66b7f02a890233866d7365c7aa719dc7b1 Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Wed, 15 Jan 2025 23:15:14 +0530 Subject: [PATCH 17/29] Changes --- Makefile | 10 +++++----- make.bat | 7 +++++-- src/ansys/tools/installer/linux_functions.py | 3 +-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 4d19502..c8e22f4 100644 --- a/Makefile +++ b/Makefile @@ -3,14 +3,14 @@ install: @echo "Installing uv..." - pip install uv + pip install -U pip uv @echo "Installing..." uv pip install -e .[freeze] @echo "Installation complete." tests: @echo "Installing uv..." - pip install uv + pip install -U pip uv @echo "Installing test dependencies..." uv pip install -e .[tests] @echo "Running tests..." @@ -19,7 +19,7 @@ tests: doc: @echo "Installing uv..." - pip install uv + pip install -U pip uv @echo "Installing documentation dependencies..." uv pip install -e .[doc] @echo "Building documentation..." @@ -28,13 +28,13 @@ doc: build: @echo "Installing uv..." - pip install uv + pip install -U pip uv @echo "Freezing using pyinstaller" uv run pyinstaller frozen.spec clean: @echo "Installing uv..." - pip install uv + pip install -U pip uv @echo "Cleaning up build files..." rm -rf build dist diff --git a/make.bat b/make.bat index 491d967..abb3cb0 100644 --- a/make.bat +++ b/make.bat @@ -11,16 +11,16 @@ if "%1" == "build" goto build if "%1" == "clean" goto clean if "%1" == "fresh-build" goto fresh-build -pip install -U pip uv - :install Echo ^>^>^> Installing... +pip install -U pip uv uv pip install -e .[freeze] Echo ^>^>^> Installation complete. goto end :tests Echo ^>^>^> Installing test dependencies... +pip install -U pip uv uv pip install -e .[tests] Echo ^>^>^> Running tests... uv run pytest @@ -28,6 +28,7 @@ goto end :doc Echo ^>^>^> Installing documentation dependencies... +pip install -U pip uv uv pip install -e .[doc] Echo ^>^>^> Building documentation... chdir /d doc @@ -39,6 +40,7 @@ goto end :build Echo ^>^>^> Freezing using pyinstaller +pip install -U pip uv uv run pyinstaller frozen.spec goto end @@ -53,6 +55,7 @@ Echo ^>^>^> Cleaning up build files... rmdir /s /q build > /NUL 2>&1 rmdir /s /q dist > /NUL 2>&1 Echo ^>^>^> Freezing using pyinstaller +pip install -U pip uv uv run pyinstaller frozen.spec goto end diff --git a/src/ansys/tools/installer/linux_functions.py b/src/ansys/tools/installer/linux_functions.py index e713562..28aa099 100644 --- a/src/ansys/tools/installer/linux_functions.py +++ b/src/ansys/tools/installer/linux_functions.py @@ -302,8 +302,7 @@ def run_linux_command_conda(pypath, extra, venv=False): break venvParam = f"; . {miniforge_path}; . {miniforge_path.replace('conda.sh', 'mamba.sh')} ;mamba activate {pypath}" else: - pass - # extra = extra.replace(" pip", f" {pypath}/bin/pip") + extra = extra.replace("uv pip", f" {pypath}/bin/pip") execute_linux_command(f"cd ~ {venvParam} ; {conda_path}{extra} ", wait=False) From 4e1aa27539dc5f56bbd1e428d6b39eb6af862715 Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Wed, 15 Jan 2025 23:36:08 +0530 Subject: [PATCH 18/29] changes --- Makefile | 20 +++++++------------- make.bat | 7 ++----- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index c8e22f4..2f4ed74 100644 --- a/Makefile +++ b/Makefile @@ -1,40 +1,34 @@ # Simple makefile to simplify repetitive build env management tasks under posix -.PHONY: install tests doc build clean fresh-build +.PHONY: setup install tests doc build clean fresh-build -install: +setup: @echo "Installing uv..." pip install -U pip uv + +install: setup @echo "Installing..." uv pip install -e .[freeze] @echo "Installation complete." -tests: - @echo "Installing uv..." - pip install -U pip uv +tests: setup @echo "Installing test dependencies..." uv pip install -e .[tests] @echo "Running tests..." uv run pytest @echo "Tests complete." -doc: - @echo "Installing uv..." - pip install -U pip uv +doc: setup @echo "Installing documentation dependencies..." uv pip install -e .[doc] @echo "Building documentation..." cd doc && make clean && make html && cd .. @echo "Documentation complete." -build: - @echo "Installing uv..." - pip install -U pip uv +build: setup @echo "Freezing using pyinstaller" uv run pyinstaller frozen.spec clean: - @echo "Installing uv..." - pip install -U pip uv @echo "Cleaning up build files..." rm -rf build dist diff --git a/make.bat b/make.bat index abb3cb0..491d967 100644 --- a/make.bat +++ b/make.bat @@ -11,16 +11,16 @@ if "%1" == "build" goto build if "%1" == "clean" goto clean if "%1" == "fresh-build" goto fresh-build +pip install -U pip uv + :install Echo ^>^>^> Installing... -pip install -U pip uv uv pip install -e .[freeze] Echo ^>^>^> Installation complete. goto end :tests Echo ^>^>^> Installing test dependencies... -pip install -U pip uv uv pip install -e .[tests] Echo ^>^>^> Running tests... uv run pytest @@ -28,7 +28,6 @@ goto end :doc Echo ^>^>^> Installing documentation dependencies... -pip install -U pip uv uv pip install -e .[doc] Echo ^>^>^> Building documentation... chdir /d doc @@ -40,7 +39,6 @@ goto end :build Echo ^>^>^> Freezing using pyinstaller -pip install -U pip uv uv run pyinstaller frozen.spec goto end @@ -55,7 +53,6 @@ Echo ^>^>^> Cleaning up build files... rmdir /s /q build > /NUL 2>&1 rmdir /s /q dist > /NUL 2>&1 Echo ^>^>^> Freezing using pyinstaller -pip install -U pip uv uv run pyinstaller frozen.spec goto end From e1d875565671ce0069d470f2f5fed7ab71d00dc8 Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Wed, 15 Jan 2025 23:43:56 +0530 Subject: [PATCH 19/29] minor --- make.bat | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/make.bat b/make.bat index 491d967..a967607 100644 --- a/make.bat +++ b/make.bat @@ -11,15 +11,20 @@ if "%1" == "build" goto build if "%1" == "clean" goto clean if "%1" == "fresh-build" goto fresh-build +:setup +Echo ^>^>^> Setting up environment... pip install -U pip uv +goto :eof :install +call :setup Echo ^>^>^> Installing... uv pip install -e .[freeze] Echo ^>^>^> Installation complete. goto end :tests +call :setup Echo ^>^>^> Installing test dependencies... uv pip install -e .[tests] Echo ^>^>^> Running tests... @@ -27,6 +32,7 @@ uv run pytest goto end :doc +call :setup Echo ^>^>^> Installing documentation dependencies... uv pip install -e .[doc] Echo ^>^>^> Building documentation... @@ -38,6 +44,7 @@ Echo ^>^>^> Documentation complete. goto end :build +call :setup Echo ^>^>^> Freezing using pyinstaller uv run pyinstaller frozen.spec goto end @@ -49,11 +56,8 @@ rmdir /s /q dist > /NUL 2>&1 goto end :fresh-build -Echo ^>^>^> Cleaning up build files... -rmdir /s /q build > /NUL 2>&1 -rmdir /s /q dist > /NUL 2>&1 -Echo ^>^>^> Freezing using pyinstaller -uv run pyinstaller frozen.spec +call :clean +call :build goto end :end From 117921f0f6d45d292efff5ffe4debad293151f09 Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Thu, 23 Jan 2025 15:18:08 +0530 Subject: [PATCH 20/29] UV fixes --- src/ansys/tools/installer/installed_table.py | 5 ++++- src/ansys/tools/installer/linux_functions.py | 7 ++++++- src/ansys/tools/installer/windows_functions.py | 7 ++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/ansys/tools/installer/installed_table.py b/src/ansys/tools/installer/installed_table.py index ff18217..3ad8a38 100644 --- a/src/ansys/tools/installer/installed_table.py +++ b/src/ansys/tools/installer/installed_table.py @@ -396,7 +396,7 @@ def install_pyansys_packages(self): if chosen_ver else f"{PYANSYS_LIBS[chosen_pkg]}" ) - cmd = f"uv pip install {pck_ver} && timeout 3 && exit || echo Failed to install this PyAnsys Library. Try reinstalling it with pip install {pck_ver} --force-reinstall" + cmd = f"uv pip install {pck_ver} && timeout 3 && exit || echo Failed to install this PyAnsys Library. Try reinstalling it with uv pip install {pck_ver} --force-reinstall" self._update_pck_mnger() self.launch_cmd(cmd, always_use_pip=True) @@ -588,6 +588,9 @@ def launch_cmd( if is_linux_os(): run_linux_command(py_path, extra) else: + # Update the package managers + subprocess.call(f'start /w /min cmd /K "set PATH={new_path} && python -m pip install --upgrade pip uv wheel && exit"', shell=True) + subprocess.call( f'start {min_win} cmd /K "set PATH={new_path} && cd %userprofile% {cmd}"', shell=True, diff --git a/src/ansys/tools/installer/linux_functions.py b/src/ansys/tools/installer/linux_functions.py index 28aa099..f6c1422 100644 --- a/src/ansys/tools/installer/linux_functions.py +++ b/src/ansys/tools/installer/linux_functions.py @@ -203,7 +203,8 @@ def create_venv_linux(venv_dir, py_path): ... ) """ - execute_linux_command(f"{py_path} -m venv {venv_dir}") + execute_linux_command(f"{py_path} -m pip install -U pip uv") + execute_linux_command(f"{py_path} -m uv venv {venv_dir}") def create_venv_linux_conda(venv_dir, py_path): @@ -249,6 +250,10 @@ def run_linux_command(pypath, extra, venv=False): >>> run_linux_command("/home/sha/.local/ansys/python-3.8.10/bin/python3", "uv pip list") """ + + # Update package manager before executing commands + execute_linux_command(f"{pypath} -m pip install -U pip uv") + prefix = f"{pypath}" extra = extra.replace("timeout", "sleep") python_name = prefix.split("/")[-1] diff --git a/src/ansys/tools/installer/windows_functions.py b/src/ansys/tools/installer/windows_functions.py index 9ff8abf..4b2d747 100644 --- a/src/ansys/tools/installer/windows_functions.py +++ b/src/ansys/tools/installer/windows_functions.py @@ -48,8 +48,13 @@ def create_venv_windows(venv_dir: str, py_path: str): user_profile = os.path.expanduser("~") scripts_path = os.path.join(py_path, "Scripts") new_path = f"{py_path};{scripts_path};%PATH%" + + # Update the package managers + subprocess.call(f'start /w /min cmd /K "set PATH={new_path} && python -m pip install --upgrade pip uv wheel && exit"', shell=True, cwd=user_profile) + + # Create venv using uv subprocess.call( - f'start /w /min cmd /K "set PATH={new_path} && python -m venv {venv_dir} && exit"', + f'start /w /min cmd /K "set PATH={new_path} && python -m uv venv {venv_dir} && exit"', shell=True, cwd=user_profile, ) From 5ade5d41b2b2c9e6b1b3b33119dfe38fb8a12d5e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 09:48:47 +0000 Subject: [PATCH 21/29] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/ansys/tools/installer/installed_table.py | 7 +++++-- src/ansys/tools/installer/linux_functions.py | 4 ++-- src/ansys/tools/installer/windows_functions.py | 10 +++++++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/ansys/tools/installer/installed_table.py b/src/ansys/tools/installer/installed_table.py index 3ad8a38..dff38e3 100644 --- a/src/ansys/tools/installer/installed_table.py +++ b/src/ansys/tools/installer/installed_table.py @@ -589,8 +589,11 @@ def launch_cmd( run_linux_command(py_path, extra) else: # Update the package managers - subprocess.call(f'start /w /min cmd /K "set PATH={new_path} && python -m pip install --upgrade pip uv wheel && exit"', shell=True) - + subprocess.call( + f'start /w /min cmd /K "set PATH={new_path} && python -m pip install --upgrade pip uv wheel && exit"', + shell=True, + ) + subprocess.call( f'start {min_win} cmd /K "set PATH={new_path} && cd %userprofile% {cmd}"', shell=True, diff --git a/src/ansys/tools/installer/linux_functions.py b/src/ansys/tools/installer/linux_functions.py index f6c1422..f9bd9a2 100644 --- a/src/ansys/tools/installer/linux_functions.py +++ b/src/ansys/tools/installer/linux_functions.py @@ -250,10 +250,10 @@ def run_linux_command(pypath, extra, venv=False): >>> run_linux_command("/home/sha/.local/ansys/python-3.8.10/bin/python3", "uv pip list") """ - + # Update package manager before executing commands execute_linux_command(f"{pypath} -m pip install -U pip uv") - + prefix = f"{pypath}" extra = extra.replace("timeout", "sleep") python_name = prefix.split("/")[-1] diff --git a/src/ansys/tools/installer/windows_functions.py b/src/ansys/tools/installer/windows_functions.py index 4b2d747..dd0639f 100644 --- a/src/ansys/tools/installer/windows_functions.py +++ b/src/ansys/tools/installer/windows_functions.py @@ -48,10 +48,14 @@ def create_venv_windows(venv_dir: str, py_path: str): user_profile = os.path.expanduser("~") scripts_path = os.path.join(py_path, "Scripts") new_path = f"{py_path};{scripts_path};%PATH%" - + # Update the package managers - subprocess.call(f'start /w /min cmd /K "set PATH={new_path} && python -m pip install --upgrade pip uv wheel && exit"', shell=True, cwd=user_profile) - + subprocess.call( + f'start /w /min cmd /K "set PATH={new_path} && python -m pip install --upgrade pip uv wheel && exit"', + shell=True, + cwd=user_profile, + ) + # Create venv using uv subprocess.call( f'start /w /min cmd /K "set PATH={new_path} && python -m uv venv {venv_dir} && exit"', From 379aff5152d94ee15cdf7ec84dbc69e4ea463e44 Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Thu, 23 Jan 2025 16:15:55 +0530 Subject: [PATCH 22/29] uv fixes --- README.rst | 3 ++- src/ansys/tools/installer/installed_table.py | 3 ++- src/ansys/tools/installer/windows_functions.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 1dbfde7..847f05e 100644 --- a/README.rst +++ b/README.rst @@ -51,13 +51,14 @@ You can be up and running with four lines of code: git clone https://github.com/ansys/python-installer-qt-gui cd python-installer-qt-gui pip install pip uv -U + uv venv uv pip install -e . Now you can run it with: .. code:: bash - ansys_python_installer + uv run ansys_python_installer **Details** diff --git a/src/ansys/tools/installer/installed_table.py b/src/ansys/tools/installer/installed_table.py index 3ad8a38..9767a1e 100644 --- a/src/ansys/tools/installer/installed_table.py +++ b/src/ansys/tools/installer/installed_table.py @@ -581,6 +581,7 @@ def launch_cmd( new_path = f"{py_path};{scripts_path};{myenv}" if extra: + extra = extra.replace("uv pip install", "uv pip install --system") cmd = f"&& {extra}" else: cmd = f"&& echo Python set to {py_path}" @@ -589,7 +590,7 @@ def launch_cmd( run_linux_command(py_path, extra) else: # Update the package managers - subprocess.call(f'start /w /min cmd /K "set PATH={new_path} && python -m pip install --upgrade pip uv wheel && exit"', shell=True) + subprocess.call(f'start /w /min cmd /K "set PATH={new_path} && python -m pip install --upgrade pip uv && exit"', shell=True) subprocess.call( f'start {min_win} cmd /K "set PATH={new_path} && cd %userprofile% {cmd}"', diff --git a/src/ansys/tools/installer/windows_functions.py b/src/ansys/tools/installer/windows_functions.py index 4b2d747..f7a3e81 100644 --- a/src/ansys/tools/installer/windows_functions.py +++ b/src/ansys/tools/installer/windows_functions.py @@ -50,7 +50,7 @@ def create_venv_windows(venv_dir: str, py_path: str): new_path = f"{py_path};{scripts_path};%PATH%" # Update the package managers - subprocess.call(f'start /w /min cmd /K "set PATH={new_path} && python -m pip install --upgrade pip uv wheel && exit"', shell=True, cwd=user_profile) + subprocess.call(f'start /w /min cmd /K "set PATH={new_path} && python -m pip install --upgrade pip uv && exit"', shell=True, cwd=user_profile) # Create venv using uv subprocess.call( From b45e7c1affc1e8c4f7ae98a731da254397333540 Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Thu, 23 Jan 2025 16:17:16 +0530 Subject: [PATCH 23/29] uv fixes --- src/ansys/tools/installer/windows_functions.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/ansys/tools/installer/windows_functions.py b/src/ansys/tools/installer/windows_functions.py index a58c1b8..9da81f5 100644 --- a/src/ansys/tools/installer/windows_functions.py +++ b/src/ansys/tools/installer/windows_functions.py @@ -50,17 +50,8 @@ def create_venv_windows(venv_dir: str, py_path: str): new_path = f"{py_path};{scripts_path};%PATH%" # Update the package managers -<<<<<<< HEAD subprocess.call(f'start /w /min cmd /K "set PATH={new_path} && python -m pip install --upgrade pip uv && exit"', shell=True, cwd=user_profile) -======= - subprocess.call( - f'start /w /min cmd /K "set PATH={new_path} && python -m pip install --upgrade pip uv wheel && exit"', - shell=True, - cwd=user_profile, - ) - ->>>>>>> 5ade5d41b2b2c9e6b1b3b33119dfe38fb8a12d5e # Create venv using uv subprocess.call( f'start /w /min cmd /K "set PATH={new_path} && python -m uv venv {venv_dir} && exit"', From e51f2e43454a8a5eb40a25bd957b443a46fc754b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 10:48:01 +0000 Subject: [PATCH 24/29] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/ansys/tools/installer/installed_table.py | 7 +++++-- src/ansys/tools/installer/windows_functions.py | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/ansys/tools/installer/installed_table.py b/src/ansys/tools/installer/installed_table.py index 9767a1e..87b74f7 100644 --- a/src/ansys/tools/installer/installed_table.py +++ b/src/ansys/tools/installer/installed_table.py @@ -590,8 +590,11 @@ def launch_cmd( run_linux_command(py_path, extra) else: # Update the package managers - subprocess.call(f'start /w /min cmd /K "set PATH={new_path} && python -m pip install --upgrade pip uv && exit"', shell=True) - + subprocess.call( + f'start /w /min cmd /K "set PATH={new_path} && python -m pip install --upgrade pip uv && exit"', + shell=True, + ) + subprocess.call( f'start {min_win} cmd /K "set PATH={new_path} && cd %userprofile% {cmd}"', shell=True, diff --git a/src/ansys/tools/installer/windows_functions.py b/src/ansys/tools/installer/windows_functions.py index 9da81f5..4f8a3e7 100644 --- a/src/ansys/tools/installer/windows_functions.py +++ b/src/ansys/tools/installer/windows_functions.py @@ -50,8 +50,12 @@ def create_venv_windows(venv_dir: str, py_path: str): new_path = f"{py_path};{scripts_path};%PATH%" # Update the package managers - subprocess.call(f'start /w /min cmd /K "set PATH={new_path} && python -m pip install --upgrade pip uv && exit"', shell=True, cwd=user_profile) - + subprocess.call( + f'start /w /min cmd /K "set PATH={new_path} && python -m pip install --upgrade pip uv && exit"', + shell=True, + cwd=user_profile, + ) + # Create venv using uv subprocess.call( f'start /w /min cmd /K "set PATH={new_path} && python -m uv venv {venv_dir} && exit"', From ad2c4f2afd688067100113b79e47592c53637544 Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Thu, 23 Jan 2025 16:28:50 +0530 Subject: [PATCH 25/29] uv respects system python environments --- src/ansys/tools/installer/installed_table.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ansys/tools/installer/installed_table.py b/src/ansys/tools/installer/installed_table.py index 9767a1e..1421dc7 100644 --- a/src/ansys/tools/installer/installed_table.py +++ b/src/ansys/tools/installer/installed_table.py @@ -357,7 +357,7 @@ def eventFilter(self, source, event): def launch_spyder(self): """Launch spyder IDE.""" # handle errors - error_msg = "(uv pip install spyder && spyder && exit 0) || echo Failed to launch. Try reinstalling spyder with pip install spyder --force-reinstall" + error_msg = "uv pip install spyder && python -m spyder || echo Failed to launch. Try reinstalling spyder with pip install spyder --force-reinstall" self._update_pck_mnger() self.launch_cmd( f'uv pip list | {"grep" if is_linux_os() else "findstr"} "spyder" && spyder && exit 0 || {error_msg}' @@ -582,6 +582,7 @@ def launch_cmd( if extra: extra = extra.replace("uv pip install", "uv pip install --system") + extra = extra.replace("uv pip list", "uv pip list --system") cmd = f"&& {extra}" else: cmd = f"&& echo Python set to {py_path}" From 1ead8781f6d3a7e53fc482f87d8c74f37b678fdf Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Thu, 23 Jan 2025 16:35:34 +0530 Subject: [PATCH 26/29] uv respects system python environments --- src/ansys/tools/installer/installed_table.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/tools/installer/installed_table.py b/src/ansys/tools/installer/installed_table.py index 151d176..19af815 100644 --- a/src/ansys/tools/installer/installed_table.py +++ b/src/ansys/tools/installer/installed_table.py @@ -357,7 +357,7 @@ def eventFilter(self, source, event): def launch_spyder(self): """Launch spyder IDE.""" # handle errors - error_msg = "uv pip install spyder && python -m spyder || echo Failed to launch. Try reinstalling spyder with pip install spyder --force-reinstall" + error_msg = "uv pip install spyder && spyder || echo Failed to launch. Try reinstalling spyder with pip install spyder --force-reinstall" self._update_pck_mnger() self.launch_cmd( f'uv pip list | {"grep" if is_linux_os() else "findstr"} "spyder" && spyder && exit 0 || {error_msg}' From 0b16c002631102cd7382664b4197cdafce27de26 Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Thu, 23 Jan 2025 16:39:39 +0530 Subject: [PATCH 27/29] uv fixes --- src/ansys/tools/installer/installed_table.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/tools/installer/installed_table.py b/src/ansys/tools/installer/installed_table.py index 19af815..4ec589f 100644 --- a/src/ansys/tools/installer/installed_table.py +++ b/src/ansys/tools/installer/installed_table.py @@ -357,7 +357,7 @@ def eventFilter(self, source, event): def launch_spyder(self): """Launch spyder IDE.""" # handle errors - error_msg = "uv pip install spyder && spyder || echo Failed to launch. Try reinstalling spyder with pip install spyder --force-reinstall" + error_msg = "uv pip install spyder && spyder && exit 0 || echo Failed to launch. Try reinstalling spyder with pip install spyder --force-reinstall" self._update_pck_mnger() self.launch_cmd( f'uv pip list | {"grep" if is_linux_os() else "findstr"} "spyder" && spyder && exit 0 || {error_msg}' From d89d881956c6ec7db6e8de4da1b4a1035ce836dc Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Thu, 23 Jan 2025 16:40:42 +0530 Subject: [PATCH 28/29] uv fixes --- src/ansys/tools/installer/installed_table.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/tools/installer/installed_table.py b/src/ansys/tools/installer/installed_table.py index 4ec589f..3fbdb4d 100644 --- a/src/ansys/tools/installer/installed_table.py +++ b/src/ansys/tools/installer/installed_table.py @@ -357,7 +357,7 @@ def eventFilter(self, source, event): def launch_spyder(self): """Launch spyder IDE.""" # handle errors - error_msg = "uv pip install spyder && spyder && exit 0 || echo Failed to launch. Try reinstalling spyder with pip install spyder --force-reinstall" + error_msg = "(uv pip install spyder && spyder && exit 0) || echo Failed to launch. Try reinstalling spyder with pip install spyder --force-reinstall" self._update_pck_mnger() self.launch_cmd( f'uv pip list | {"grep" if is_linux_os() else "findstr"} "spyder" && spyder && exit 0 || {error_msg}' From d595a4abd7df639c8a66b4aaae546fa4bfad2c67 Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Thu, 23 Jan 2025 18:24:18 +0530 Subject: [PATCH 29/29] updates --- README.rst | 8 ++++---- src/ansys/tools/installer/linux_functions.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index 847f05e..ff8cb24 100644 --- a/README.rst +++ b/README.rst @@ -80,7 +80,7 @@ guide`_. You will need to follow these steps: .. code:: bash # Create a virtual environment - python -m venv .venv + python -m uv venv .venv # Activate it in a POSIX system source .venv/bin/activate @@ -107,7 +107,7 @@ guide`_. You will need to follow these steps: .. code:: bash - pytest tests -v + uv run pytest tests -v Style and testing @@ -141,7 +141,7 @@ If you need to run it again on all files and not just staged files, run: .. code:: - pre-commit run --all-files + uv run pre-commit run --all-files Local build @@ -166,7 +166,7 @@ For building documentation, you can either run the usual rules provided in the .. code:: bash uv pip install -e .[doc] - make -C doc/ html + uv run make -C doc/ html # subsequently open the documentation with (under Linux): doc/html/index.html diff --git a/src/ansys/tools/installer/linux_functions.py b/src/ansys/tools/installer/linux_functions.py index f9bd9a2..67217d8 100644 --- a/src/ansys/tools/installer/linux_functions.py +++ b/src/ansys/tools/installer/linux_functions.py @@ -133,7 +133,7 @@ def install_python_linux(filename): file = file.replace(".tar.xz", "") file = file.lower() execute_linux_command( - f"cd {untar_dirname};mkdir -p {ansys_linux_path}/{file};make clean;./configure --prefix={ansys_linux_path}/{file};make;make install" + f"cd {untar_dirname};mkdir -p {ansys_linux_path}/{file};make clean;./configure --prefix={ansys_linux_path}/{file};make;make install;cp {ansys_linux_path}/{file}/bin/python3 {ansys_linux_path}/{file}/bin/python" ) os.chdir(cwd) return 0