diff --git a/.github/workflows/publish-release-packages.yaml b/.github/workflows/publish-release-packages.yaml index 5c4d0cf04..fe9216c7e 100644 --- a/.github/workflows/publish-release-packages.yaml +++ b/.github/workflows/publish-release-packages.yaml @@ -3,7 +3,7 @@ name: Publish packages to public repositories on: workflow_call: inputs: - wheelArtifactName: + artifactName: required: true type: string description: "The github artifact holding the wheel file which will be published" @@ -16,11 +16,6 @@ on: default: true type: boolean description: "Publish to brew repository" - do_chocolatey: - required: false - default: true - type: boolean - description: "Publish to Chocolatey repository" do_snap: required: false default: true @@ -31,32 +26,6 @@ on: default: true type: boolean description: "Publish to Winget repository" - workflow_dispatch: - inputs: - release_version: - required: true - type: string - description: "The release version that will be published (e.g. 0.1.0). Note this is not the tag version." - do_brew: - required: false - default: true - type: boolean - description: "Publish to brew repository" - do_chocolatey: - required: false - default: true - type: boolean - description: "Publish to Chocolatey repository" - do_winget: - required: false - default: true - type: boolean - description: "Publish to Winget repository" - do_snap: - required: false - default: true - type: boolean - description: "Publish to snap repository" jobs: publish-brew: @@ -66,84 +35,24 @@ jobs: - name: Checkout source code uses: actions/checkout@v4 - # Download either via release or provided artifact - name: Download wheel from release - if: ${{ github.event_name == 'workflow_dispatch' }} run: gh release download v${{ inputs.release_version }} --pattern "*.whl" --dir dist env: GH_TOKEN: ${{ github.token }} - - name: Download wheel from artifact - if: ${{ github.event_name == 'workflow_call' }} - uses: actions/download-artifact@v4 - with: - name: ${{ inputs.wheelArtifactName }} - path: dist - - - name: Download macOS binary from release - if: ${{ github.event_name == 'workflow_dispatch' }} - run: gh release download ${{ inputs.release }} --pattern "*-brew.tar.gz" --dir dist + - name: Download binary artifact from release + run: gh release download v${{ inputs.release_version }} --pattern "*-brew.tar.gz" --dir dist env: GH_TOKEN: ${{ github.token }} - - name: Download macOS binary from artifact - uses: actions/download-artifact@v4 - if: ${{ github.event_name == 'workflow_call' }} - with: - name: ${{ inputs.binaryArtifactName }} - path: dist - - name: Set Git user as GitHub actions run: git config --global user.email "actions@github.com" && git config --global user.name "github-actions" - - name: ls dist folder - run: ls -la dist - - name: Update homebrew cask run: scripts/update-brew-cask.sh "dist/algokit*-py3-none-any.whl" "dist/algokit*-macos_arm64-brew.tar.gz" "dist/algokit*-macos_x64-brew.tar.gz" "algorandfoundation/homebrew-tap" env: TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }} - publish-chocolatey: - runs-on: windows-latest - if: ${{ inputs.do_chocolatey }} - steps: - - name: Checkout source code - uses: actions/checkout@v4 - - # Download either via release or provided artifact - - name: Download release - if: ${{ github.event_name == 'workflow_dispatch' }} - run: gh release download v${{ inputs.release_version }} --pattern "*.whl" --dir dist - env: - GH_TOKEN: ${{ github.token }} - - - name: Download artifact - if: ${{ github.event_name == 'workflow_call' }} - uses: actions/download-artifact@v4 - with: - name: ${{ inputs.artifactName }} - path: dist - - - name: Update chocolatey files - id: update_chocolatey_files - run: scripts/update-chocolatey-package.ps1 - - - name: Build package - uses: crazy-max/ghaction-chocolatey@v2 - with: - args: pack --version ${{ steps.update_chocolatey_files.outputs.version }} .\scripts\chocolatey\algokit\algokit.nuspec - - - name: Set API key - uses: crazy-max/ghaction-chocolatey@v2 - with: - args: apikey --api-key ${{ secrets.CHOCOLATEY_API_KEY }} -source https://push.chocolatey.org/ - - - name: Push package - uses: crazy-max/ghaction-chocolatey@v2 - with: - args: push --source https://push.chocolatey.org/ - publish-winget: runs-on: windows-latest if: ${{ inputs.do_winget }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3fadb5761..21e835a71 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,6 +22,7 @@ repos: additional_dependencies: [] minimum_pre_commit_version: "0" files: "^(src|tests)/" + exclude: "^src/algokit/core/_vendor/" - id: mypy name: mypy description: "`mypy` will check Python types for correctness" @@ -32,3 +33,4 @@ repos: additional_dependencies: [] minimum_pre_commit_version: "2.9.2" files: "^(src|tests)/" + exclude: "^src/algokit/core/_vendor/" diff --git a/README.md b/README.md index 5a41641a5..8879525d0 100644 --- a/README.md +++ b/README.md @@ -86,18 +86,23 @@ This is an open source project managed by the Algorand Foundation. See the [cont The key required dependency is Python 3.10+, but some of the installation options below will install that for you. We recommend using Python 3.12+, as the `algokit compile python` command requires this version. -AlgoKit also has some runtime dependencies that also need to be available for particular commands. - > **Note** -> You can still install and use AlgoKit without these dependencies and AlgoKit will tell you if you are missing one for a given command. +> You can still install and use AlgoKit without these dependencies, and AlgoKit will tell you if you are missing one for a given command. - **Git**: Essential for creating and updating projects from templates. Installation guide available at [Git Installation](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git). - **Docker**: Necessary for running the AlgoKit LocalNet environment. Docker Compose version 2.5.0 or higher is required. See [Docker Installation](https://docs.docker.com/get-docker/). - **Node.js**: For those working on frontend templates or building contracts using TEALScript. **Minimum required versions are Node.js `v18` and npm `v9`**. Instructions can be found at [Node.js Installation](https://nodejs.org/en/download/). +> **Note** +> If you have previously installed AlgoKit using `pipx` and would like to switch to a different installation method, please ensure that +> you first uninstall the existing version by running `pipx uninstall algokit`. Once uninstalled, you can follow the installation instructions for your preferred platform. + ## Cross-platform installation -AlgoKit can be installed using OS specific package managers, or using the python tool [pipx](https://pypa.github.io/pipx/) see below for specific installation instructions. +AlgoKit can be installed using OS specific package managers, or using the python tool [pipx](https://pypa.github.io/pipx/). +See below for specific installation instructions. + +### Installation Methods - [Windows](#install-algokit-on-windows) - [Mac](#install-algokit-on-mac) @@ -107,36 +112,22 @@ AlgoKit can be installed using OS specific package managers, or using the python ## Install AlgoKit on Windows > **Note** -> This method will install the most recent python3 version [via winget](https://learn.microsoft.com/en-us/windows/package-manager/winget/). If you already have python 3.10+ installed, you may [prefer to use pipx directly instead](#install-algokit-with-pipx-on-any-os) so you can control the python version used. +> AlgoKit is supported on Windows 10 1709 (build 16299) and later. +> We only publish an x64 binary, however it also runs on ARM devices by default using the built in x64 emulation feature. 1. Ensure prerequisites are installed + - [WinGet](https://learn.microsoft.com/en-us/windows/package-manager/winget/) (should be installed by default on recent Windows 10 or later) - [Git](https://github.com/git-guides/install-git#install-git-on-windows) (or `winget install git.git`) - [Docker](https://docs.docker.com/desktop/install/windows-install/) (or `winget install docker.dockerdesktop`) > **Note** > See [our LocalNet documentation](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/features/localnet.md#prerequisites) for more tips on installing Docker on Windows -2. Install using WinGet - - 1. Install python: `winget install python.python.3.11` - 2. Restart the terminal to ensure Python and pip are available on the path - - > **Note** - > Windows has a feature called **App Execution Aliases** that provides redirects for the Python command that guide users to the - > Windows Store. Unfortunately these aliases can prevent normal execution of Python if Python is installed via other means, to disable them - > search for **Manage app execution aliases** from the start menu, and then turn off entries listed as - > **App Installer python.exe** or **App Installer python3.exe**. - - 3. Install pipx: +2. Install using winget - ``` - pip install --user pipx - python -m pipx ensurepath - ``` - - 4. Restart the terminal to ensure pipx is available on the path - 5. Install AlgoKit via pipx: `pipx install algokit` - 6. Restart the terminal to ensure AlgoKit is available on the path + ```shell + winget install algokit + ``` 3. [Verify installation](#verify-installation) @@ -144,13 +135,13 @@ AlgoKit can be installed using OS specific package managers, or using the python Some useful commands for updating or removing AlgoKit in the future. -- To update AlgoKit: `pipx upgrade algokit` -- To remove AlgoKit: `pipx uninstall algokit` +- To update AlgoKit: `winget upgrade algokit` +- To remove AlgoKit: `winget uninstall algokit` ## Install AlgoKit on Mac > **Note** -> This method will install Python 3.10 as a dependency via Homebrew. If you already have python installed, you may prefer to use `pipx install algokit` as explained [here](#install-algokit-with-pipx-on-any-os). +> AlgoKit is supported on macOS Big Sur (11) and later for both x64 and ARM (Apple Silicon) 1. Ensure prerequisites are installed @@ -160,7 +151,12 @@ Some useful commands for updating or removing AlgoKit in the future. > **Note** > Docker requires MacOS 11+ -2. Install using Homebrew `brew install algorandfoundation/tap/algokit` +2. Install using Homebrew + + ```shell + brew install algorandfoundation/tap/algokit + ``` + 3. Restart the terminal to ensure AlgoKit is available on the path 4. [Verify installation](#verify-installation) @@ -173,18 +169,29 @@ Some useful commands for updating or removing AlgoKit in the future. ## Install AlgoKit on Linux -1. Ensure prerequisites are installed - - - [Python 3.10+](https://www.python.org/downloads/) +> **Note** +> AlgoKit is compatible with Ubuntu 16.04 and later, Debian, RedHat, and any distribution that supports [Snap](https://snapcraft.io/docs/installing-snapd), but it is only supported on x64 architecture; ARM is not supported. - > **Note** - > There is probably a better way to install Python than to download it directly, e.g. your local Linux package manager +1. Ensure prerequisites are installed - - [pipx](https://pypa.github.io/pipx/#on-linux-install-via-pip-requires-pip-190-or-later) + - [Snap](https://snapcraft.io/docs/installing-snapd) (should be installed by default on Ubuntu 16.04.4 LTS (Xenial Xerus) or later) - [Git](https://github.com/git-guides/install-git#install-git-on-linux) - [Docker](https://docs.docker.com/desktop/install/linux-install/) -2. Continue with step 2 in the following section to install via [pipx](#install-algokit-with-pipx-on-any-os) +2. Install using snap + + ```shell + snap install algokit --classic + ``` + +3. [Verify installation](#verify-installation) + +### Maintenance + +Some useful commands for updating or removing AlgoKit in the future. + +- To update AlgoKit: `snap refresh algokit` +- To remove AlgoKit: `snap remove --purge algokit` ## Install AlgoKit with pipx on any OS @@ -195,7 +202,12 @@ Some useful commands for updating or removing AlgoKit in the future. - [Git](https://github.com/git-guides/install-git) - [Docker](https://docs.docker.com/get-docker/) -2. Install using pipx `pipx install algokit` +2. Install using pipx + + ```shell + pipx install algokit + ``` + 3. Restart the terminal to ensure AlgoKit is available on the path 4. [Verify installation](#verify-installation) diff --git a/scripts/chocolatey/algokit/README.md b/scripts/chocolatey/algokit/README.md deleted file mode 100644 index ae6c5d932..000000000 --- a/scripts/chocolatey/algokit/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# Chocolatey Package - -This directory contains the nuspec file to define the [Chocolatey](https://chocolatey.org/) repository package for Windows and various associate powershell scripts. - -# Installing - -> __Note__ -> This will install the most recent python3 version through chocolatey. If you already have python installed, you may prefer to use `pipx install algokit` as explained in [Installing](../../../README.md). - -1. Ensure chocolatey is installed - https://chocolatey.org/install -2. Run `choco install algokit` from an administrator powershell/cmd/terminal window -3. Test algokit is installed `algokit --version` - -# Development - -## Building and publishing locally - -1. Ensure wheel file is built `poetry build` (make sure there's only a single file in _dist_ directory) -2. Set version field in _algokit.nuspec_ - > __Note__ - > Versions with a pre-release suffix such as 1.2.3-beta are automatically designated as pre-release packages by chocolatey -3. `cd .\scripts\chocolatey\algokit` -4. `choco pack` -5. `choco apikey --api-key [API_KEY_HERE] -source https://push.chocolatey.org/` -6. `choco push --source https://push.chocolatey.org/` - -Also see [Chocolatey docs](https://docs.chocolatey.org/en-us/create/create-packages). - -## Installing from local packages - -- `cd .\scripts\chocolatey\algokit` -- Install - `choco install algokit -pre --source "'.;https://community.chocolatey.org/api/v2/'" -y` -- Uninstall - `choco uninstall algokit -y` -- Upgrade - `choco upgrade algokit -pre --source "'.;https://community.chocolatey.org/api/v2/'" -y` - -# Issues - -- Chocolatey doesn't support full sematic release v2 versions yet. This means version identifiers with dot notation are not supported (1.2.3-beta.12). See [this issue](https://github.com/chocolatey/choco/issues/1610). -- Installing using the `-pre` tag on will also install pre-release verisons of dependencies. At the time of development, this installed python 3.12.0-a2 which has errors installing algokit. Solution is to `choco install python3` prior to `choco install algokit -pre`. See [nuspec](https://learn.microsoft.com/en-us/nuget/concepts/package-versioning#pre-release-versions) for clarification. diff --git a/scripts/chocolatey/algokit/algokit.nuspec b/scripts/chocolatey/algokit/algokit.nuspec deleted file mode 100644 index 032dd097c..000000000 --- a/scripts/chocolatey/algokit/algokit.nuspec +++ /dev/null @@ -1,33 +0,0 @@ - - - - - algokit - 0.1.0-beta - https://github.com/algorandfoundation/algokit-cli/blob/main/scripts/chocolatey - algorand-foundation - AlgoKit - Algorand Foundation - https://www.algorand.foundation/developers - https://rawcdn.githack.com/algorandfoundation/algokit-cli/733cbc7714db7d4786cb9c0de60c991c63dcc3b7/scripts/chocolatey/algokit/algorand-logo-512.png?min=1 - https://github.com/algorandfoundation/algokit-cli/blob/main/LICENSE - false - https://github.com/algorandfoundation/algokit-cli - https://github.com/algorandfoundation/algokit-cli/blob/main/README.md - https://github.com/algorandfoundation/algokit-cli/issues - https://github.com/algorandfoundation/algokit-cli/blob/main/CHANGELOG.md - algokit algorand developers python typescript hello-world smart-contract beaker - The Algorand AlgoKit CLI is the one-stop shop tool for developers building on the Algorand network. - - - - - - - - - - - diff --git a/scripts/chocolatey/algokit/algorand-logo-512.png b/scripts/chocolatey/algokit/algorand-logo-512.png deleted file mode 100644 index e6a3f9923..000000000 Binary files a/scripts/chocolatey/algokit/algorand-logo-512.png and /dev/null differ diff --git a/scripts/chocolatey/algokit/tools/LICENSE.txt b/scripts/chocolatey/algokit/tools/LICENSE.txt deleted file mode 100644 index feb9b31ab..000000000 --- a/scripts/chocolatey/algokit/tools/LICENSE.txt +++ /dev/null @@ -1,22 +0,0 @@ -From: https://github.com/algorandfoundation/algokit-cli/blob/main/LICENSE -MIT License - -Copyright (c) 2022 Algorand Foundation - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/scripts/chocolatey/algokit/tools/VERIFICATION.txt b/scripts/chocolatey/algokit/tools/VERIFICATION.txt deleted file mode 100644 index d57d0e6d6..000000000 --- a/scripts/chocolatey/algokit/tools/VERIFICATION.txt +++ /dev/null @@ -1,11 +0,0 @@ -VERIFICATION -Verification is intended to assist the Chocolatey moderators and community -in verifying that this package's contents are trustworthy. - -To verify this package download the .whl from the URL specified below and compare it's SHA-256 checksum with the -below. - -Wheel: {wheel_url} -SHA256: {sha256} - -Algorand Foundation are the authors of this software and maintainers of the Chocolatey package. diff --git a/scripts/chocolatey/algokit/tools/chocolateyinstall.ps1 b/scripts/chocolatey/algokit/tools/chocolateyinstall.ps1 deleted file mode 100644 index 378c432ad..000000000 --- a/scripts/chocolatey/algokit/tools/chocolateyinstall.ps1 +++ /dev/null @@ -1,53 +0,0 @@ -$ErrorActionPreference = 'Stop' - -$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" - -# ensure pipx is installed -python -m pip install --disable-pip-version-check --no-warn-script-location pipx -if ($LASTEXITCODE -ne 0) { - Throw "Error installing pipx" -} - -# work out the wheel name and make sure there wasn't a packaging error -$wheelFileName = Get-ChildItem -File -Filter $env:ChocolateyPackageName*.whl $toolsDir -if ($wheelFileName.count -ne 1) { - Throw "Packaging error. nupkg contained $($wheelFile.count) wheel files" -} - -# determine if the package is already installed. In which case, uninstall it first -# Note - pipx upgrade does not work with local files -$pipxListOutput = &{ - # pipx outputs to stderr if there are no packages, so ignore that error - $ErrorActionPreference = 'Continue' - python -m pipx list 2>&1 - if ($LASTEXITCODE -ne 0) { - Throw "Error searching for existing packages" - } -} - -# uninstall existing package if present -if ($pipxListOutput -match "$env:ChocolateyPackageName.*") { - &{ - #pipx outputs to stderr as part of normal execution, so ignore stderr - $ErrorActionPreference = 'Continue' - python -m pipx uninstall $env:ChocolateyPackageName 2>&1 - if ($LASTEXITCODE -ne 0) { - Throw "Error removing existing version" - } - } -} - -# install the bundled wheel file. -&{ - #pipx outputs to stderr as part of normal execution, so ignore stderr - $ErrorActionPreference = 'Continue' - python -m pipx install $wheelFileName[0].FullName 2>&1 - if ($LASTEXITCODE -ne 0) { - Throw "Error installing $($wheelFileName[0].FullName)" - } -} - -#setup shim -$pipx_list = python -m pipx list --json | ConvertFrom-Json -$algokit_path = $pipx_list.venvs.algokit.metadata.main_package.app_paths.__Path__ -Install-BinFile -Name algokit -Path $algokit_path \ No newline at end of file diff --git a/scripts/chocolatey/algokit/tools/chocolateyuninstall.ps1 b/scripts/chocolatey/algokit/tools/chocolateyuninstall.ps1 deleted file mode 100644 index 6bd79a2c3..000000000 --- a/scripts/chocolatey/algokit/tools/chocolateyuninstall.ps1 +++ /dev/null @@ -1,24 +0,0 @@ -$ErrorActionPreference = 'Stop' - -# ensure pipx is installed. Just in case someone has removed it manually -python -m pip install --disable-pip-version-check --no-warn-script-location --user pipx -if ($LASTEXITCODE -ne 0) { - Throw "Error configuring pipx for uninstalling" -} - -# zap it -&{ - #pipx outputs to stderr as part of normal execution, so ignore stderr - $ErrorActionPreference = 'Continue' - python -m pipx uninstall $env:ChocolateyPackageName 2>&1 - if ($LASTEXITCODE -ne 0) { - if ($cmdOutput -match "Nothing to uninstall" ) { - Write-Output "$($env:ChocolateyPackageName) already uninstalled by pipx. Ignoring" - } - else { - Throw "Error running pipx uninstall $($env:ChocolateyPackageName)" - } - } -} - -Uninstall-BinFile -Name algokit \ No newline at end of file diff --git a/scripts/update-chocolatey-package.ps1 b/scripts/update-chocolatey-package.ps1 deleted file mode 100644 index fec712094..000000000 --- a/scripts/update-chocolatey-package.ps1 +++ /dev/null @@ -1,38 +0,0 @@ -# Re-create the version based on the wheel file name. -# NOTE: x.y.x-beta.12 versions are not supported by chocolatey and need to be rewritten as x.y.z-beta12 (however this will likely change soon) -# "special version part" requirements. <20 characters, no '.' no '+' -$wheelFiles = Get-ChildItem -File -Filter algokit*-py3-none-any.whl dist -if ($wheelFiles.count -ne 1) { - Throw "Packaging error. build artifact contained $($wheelFileName.count) normally named wheel files" -} -$wheelFile = $wheelFiles[0] -$wheelFileName = $wheelFile.Name -if ($wheelFileName -Match '-([0-9]+\.[0-9]+\.[0-9]+)b?([0-9]*)(\+(.*?))?(.[0-9]+)?-') { - $version_number = $Matches[1] - $version_beta = $Matches[2] - $version_branch = $Matches[4] - $version_branch = $version_branch ? $version_branch.Replace(".", "") : "" # dots aren't valid here - $version_betanumber = $Matches[5] - $version_beta_truncated = "beta$($version_beta)$($version_branch)" - #$version_beta_truncated = "beta$($version_beta)$($version_branch)$($version_betanumber)" # When chocolatey supports semver v2.0 - $version_beta_truncated = $version_beta_truncated.subString(0, [System.Math]::Min(20, $version_beta_truncated.Length - 1)) # chocolatey has a limit of 20 characters on "special version part" -} -else { - Throw "Packaging error. Unrecognised file name pattern $($wheelFileName[0].Name)" -} - -$version = $version_number -$release_tag = "v${version_number}" -if ($version_beta) { - $version = "$($version)-$($version_beta_truncated)" - $release_tag = "${release_tag}-beta.${version_beta}" -} - -# Update VERIFICATION.txt with current URL & SHA256 -$verification = Get-Item -Path .\scripts\chocolatey\algokit\tools\VERIFICATION.txt -$wheel_url = "https://github.com/algorandfoundation/algokit-cli/releases/download/${release_tag}/${wheelFileName}" -$sha_256 = Get-FileHash $wheelFile -(Get-Content $verification).replace("{wheel_url}", $wheel_url).replace("{sha256}", $sha_256.Hash) | Set-Content $verification - -echo "version=$version" | Tee-Object -Append -FilePath $env:GITHUB_OUTPUT -echo "wheelFileName=${wheelFileName}" | Tee-Object -Append -FilePath $env:GITHUB_OUTPUT diff --git a/src/algokit/cli/doctor.py b/src/algokit/cli/doctor.py index ca77c6414..91f28ff74 100644 --- a/src/algokit/cli/doctor.py +++ b/src/algokit/cli/doctor.py @@ -68,7 +68,7 @@ def doctor_command(*, copy_to_clipboard: bool) -> None: ["git", "--version"], missing_help=( [ - "Git required to `run algokit init`; install via `choco install git` if using Chocolatey, ", + "Git required to `run algokit init`; install via `winget install -e --id Git.Git` if using winget,", "or via https://github.com/git-guides/install-git#install-git-on-windows", ] if is_windows @@ -103,7 +103,7 @@ def doctor_command(*, copy_to_clipboard: bool) -> None: "npm": check_dependency(["npm" if not is_windows else "npm.cmd", "--version"]), } if is_windows: - service_outputs["chocolatey"] = check_dependency(["choco", "--version"]) + service_outputs["winget"] = check_dependency(["winget", "--version"]) elif os_type == "Darwin": service_outputs["brew"] = check_dependency(["brew", "--version"]) diff --git a/src/algokit/core/_vendor/auth0/authentication/token_verifier.py b/src/algokit/core/_vendor/auth0/authentication/token_verifier.py index 4b9191fa7..24b4e4329 100644 --- a/src/algokit/core/_vendor/auth0/authentication/token_verifier.py +++ b/src/algokit/core/_vendor/auth0/authentication/token_verifier.py @@ -3,7 +3,6 @@ File ref: https://github.com/auth0/auth0-python/blob/master/auth0/authentication/token_verifier.py """ - from __future__ import annotations import json diff --git a/src/algokit/core/utils.py b/src/algokit/core/utils.py index cf3fdd9c3..8de1d8162 100644 --- a/src/algokit/core/utils.py +++ b/src/algokit/core/utils.py @@ -99,7 +99,7 @@ def find_valid_pipx_command(error_message: str) -> list[str]: return pipx_command # If pipx isn't found in global path or python -m pipx then bail out # this is an exceptional circumstance since pipx should always be present with algokit - # since it's installed with brew / choco as a dependency, and otherwise is used to install algokit + # since it's installed with brew / winget as a dependency, and otherwise is used to install algokit raise click.ClickException(error_message) diff --git a/tests/doctor/test_doctor.py b/tests/doctor/test_doctor.py index cc7055788..137bd01f9 100644 --- a/tests/doctor/test_doctor.py +++ b/tests/doctor/test_doctor.py @@ -43,7 +43,7 @@ def _mock_doctor_dependencies(mocker: MockerFixture) -> None: @pytest.fixture(autouse=True) def _mock_happy_values(proc_mock: ProcMock) -> None: - proc_mock.set_output(["choco", "--version"], ["1.2.2"]) + proc_mock.set_output(["winget", "--version"], ["v1.8.1911"]) proc_mock.set_output(["brew", "--version"], ["Homebrew 3.6.15", "Homebrew/homebrew-core (blah)"]) proc_mock.set_output(["docker", "--version"], ["Docker version 20.10.21, build baeda1f"]) proc_mock.set_output(DOCKER_COMPOSE_VERSION_COMMAND, ['{"version": "v2.12.2"}']) @@ -138,7 +138,6 @@ def test_doctor_with_docker_compose_version_unparseable(proc_mock: ProcMock) -> ALL_COMMANDS = [ - ["choco", "--version"], ["brew", "--version"], ["docker", "--version"], DOCKER_COMPOSE_VERSION_COMMAND, @@ -236,9 +235,7 @@ def test_new_algokit_version_available(request: pytest.FixtureRequest, mocker: M @pytest.mark.mock_platform_system("Windows") def test_doctor_with_weird_values_on_windows(proc_mock: ProcMock) -> None: proc_mock.set_output(["git", "--version"], ["git version 2.31.0.windows.1"]) - proc_mock.set_output( - ["choco"], ["Chocolatey v0.10.15", "choco: Please run 'choco -?' or 'choco -?' for help menu."] - ) + proc_mock.set_output(["winget"], ["v1.8.1911", "Winget v1.8.1911"]) proc_mock.should_fail_on(["npm"]) proc_mock.set_output(["npm.cmd", "--version"], [" 16.17.0 "]) diff --git a/tests/doctor/test_doctor.test_doctor_all_commands_bad_exit[windows].approved.txt b/tests/doctor/test_doctor.test_doctor_all_commands_bad_exit[windows].approved.txt index c51395727..f08da2249 100644 --- a/tests/doctor/test_doctor.test_doctor_all_commands_bad_exit[windows].approved.txt +++ b/tests/doctor/test_doctor.test_doctor_all_commands_bad_exit[windows].approved.txt @@ -16,8 +16,8 @@ DEBUG: Running 'node --version' in '{current_working_directory}' DEBUG: node: I AM A TEAPOT DEBUG: Running 'npm.cmd --version' in '{current_working_directory}' DEBUG: npm.cmd: I AM A TEAPOT -DEBUG: Running 'choco --version' in '{current_working_directory}' -DEBUG: choco: I AM A TEAPOT +DEBUG: Running 'winget --version' in '{current_working_directory}' +DEBUG: winget: v1.8.1911 timestamp: 1990-12-31T10:09:08 AlgoKit: 1.2.3 AlgoKit Python: 3.6.2 (location: /home/me/.local/pipx/venvs/algokit) @@ -40,8 +40,7 @@ node: Command exited with code: -1 I AM A TEAPOT npm: Command exited with code: -1 I AM A TEAPOT -chocolatey: Command exited with code: -1 - I AM A TEAPOT +winget: 1.8.1911 If you are experiencing a problem with AlgoKit, feel free to submit an issue via: https://github.com/algorandfoundation/algokit-cli/issues/new diff --git a/tests/doctor/test_doctor.test_doctor_all_commands_not_found[windows].approved.txt b/tests/doctor/test_doctor.test_doctor_all_commands_not_found[windows].approved.txt index 89bcafc8c..bd58ce708 100644 --- a/tests/doctor/test_doctor.test_doctor_all_commands_not_found[windows].approved.txt +++ b/tests/doctor/test_doctor.test_doctor_all_commands_not_found[windows].approved.txt @@ -16,8 +16,8 @@ DEBUG: Running 'node --version' in '{current_working_directory}' DEBUG: Command not found DEBUG: Running 'npm.cmd --version' in '{current_working_directory}' DEBUG: Command not found -DEBUG: Running 'choco --version' in '{current_working_directory}' -DEBUG: Command not found +DEBUG: Running 'winget --version' in '{current_working_directory}' +DEBUG: winget: v1.8.1911 timestamp: 1990-12-31T10:09:08 AlgoKit: 1.2.3 AlgoKit Python: 3.6.2 (location: /home/me/.local/pipx/venvs/algokit) @@ -26,7 +26,7 @@ docker: Command not found! `docker` required to run `algokit localnet` command; install via https://docker.io docker compose: Command not found! git: Command not found! - Git required to `run algokit init`; install via `choco install git` if using Chocolatey, + Git required to `run algokit init`; install via `winget install -e --id Git.Git` if using winget, or via https://github.com/git-guides/install-git#install-git-on-windows python: Command not found! python3: Command not found! @@ -42,7 +42,7 @@ node: Command not found! install via `algokit project bootstrap` within project directory, or via: https://nodejs.dev/en/learn/how-to-install-nodejs/ npm: Command not found! -chocolatey: Command not found! +winget: 1.8.1911 If you are experiencing a problem with AlgoKit, feel free to submit an issue via: https://github.com/algorandfoundation/algokit-cli/issues/new diff --git a/tests/doctor/test_doctor.test_doctor_successful[windows].approved.txt b/tests/doctor/test_doctor.test_doctor_successful[windows].approved.txt index 30782f4c8..8e1ac234b 100644 --- a/tests/doctor/test_doctor.test_doctor_successful[windows].approved.txt +++ b/tests/doctor/test_doctor.test_doctor_successful[windows].approved.txt @@ -18,8 +18,8 @@ DEBUG: Running 'node --version' in '{current_working_directory}' DEBUG: node: v18.12.1 DEBUG: Running 'npm.cmd --version' in '{current_working_directory}' DEBUG: npm.cmd: 8.19.2 -DEBUG: Running 'choco --version' in '{current_working_directory}' -DEBUG: choco: 1.2.2 +DEBUG: Running 'winget --version' in '{current_working_directory}' +DEBUG: winget: v1.8.1911 timestamp: 1990-12-31T10:09:08 AlgoKit: 1.2.3 AlgoKit Python: 3.6.2 (location: /home/me/.local/pipx/venvs/algokit) @@ -33,7 +33,7 @@ pipx: 1.1.0 poetry: 1.2.2 node: 18.12.1 npm: 8.19.2 -chocolatey: 1.2.2 +winget: 1.8.1911 If you are experiencing a problem with AlgoKit, feel free to submit an issue via: https://github.com/algorandfoundation/algokit-cli/issues/new diff --git a/tests/doctor/test_doctor.test_doctor_with_weird_values_on_windows.approved.txt b/tests/doctor/test_doctor.test_doctor_with_weird_values_on_windows.approved.txt index 5b52b6c89..f6404a0ae 100644 --- a/tests/doctor/test_doctor.test_doctor_with_weird_values_on_windows.approved.txt +++ b/tests/doctor/test_doctor.test_doctor_with_weird_values_on_windows.approved.txt @@ -18,9 +18,9 @@ DEBUG: Running 'node --version' in '{current_working_directory}' DEBUG: node: v18.12.1 DEBUG: Running 'npm.cmd --version' in '{current_working_directory}' DEBUG: npm.cmd: 16.17.0 -DEBUG: Running 'choco --version' in '{current_working_directory}' -DEBUG: choco: Chocolatey v0.10.15 -DEBUG: choco: choco: Please run 'choco -?' or 'choco -?' for help menu. +DEBUG: Running 'winget --version' in '{current_working_directory}' +DEBUG: winget: v1.8.1911 +DEBUG: winget: Winget v1.8.1911 timestamp: 1990-12-31T10:09:08 AlgoKit: 1.2.3 AlgoKit Python: 3.6.2 (location: /home/me/.local/pipx/venvs/algokit) @@ -34,7 +34,7 @@ pipx: 1.1.0 poetry: 1.2.2 node: 18.12.1 npm: 16.17.0 -chocolatey: 0.10.15 +winget: 1.8.1911 If you are experiencing a problem with AlgoKit, feel free to submit an issue via: https://github.com/algorandfoundation/algokit-cli/issues/new diff --git a/tests/portability/test_pyinstaller_binary.py b/tests/portability/test_pyinstaller_binary.py index 7566a20e5..5022d3910 100644 --- a/tests/portability/test_pyinstaller_binary.py +++ b/tests/portability/test_pyinstaller_binary.py @@ -38,7 +38,7 @@ def test_non_interactive_algokit_commands( logger.info(f"Command {command} returned {execution_result.stdout}") # Parts of doctor will fail in CI on macOS and windows on github actions since docker isn't available by default - if "doctor" in command and sys.platform in ["darwin", "windows"] and environ.get("CI"): + if "doctor" in command and sys.platform in ["darwin", "windows", "win32"] and environ.get("CI"): exit_codes.append(1) assert execution_result.returncode in exit_codes, f"Command {command} failed with {execution_result.stderr}"