diff --git a/Vagrantfile b/Vagrantfile index eb4de04b..69fc17f4 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -15,7 +15,7 @@ Vagrant.configure("2") do |config| # https://github.com/hashicorp/vagrant/issues/12204 ansible.pip_install_cmd = "sudo apt-get install -y python3-pip python-is-python3 && sudo ln -s -f /usr/bin/pip3 /usr/bin/pip" ansible.install_mode = "pip_args_only" - ansible.pip_args = "-r /opt/algo/requirements.txt" + ansible.pip_args = "ansible==11.8.0 jinja2>=3.1.6 netaddr==1.3.0 pyyaml>=6.0.2" ansible.inventory_path = "/opt/algo/inventory" ansible.limit = "local" ansible.verbose = "-vvvv" diff --git a/algo b/algo index 3841e989..e15a5a29 100755 --- a/algo +++ b/algo @@ -56,9 +56,9 @@ install_uv_via_download() { fi echo "Downloading uv installation script..." - if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" ]]; then - # Windows (Git Bash/WSL) - powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" + if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" || "$OSTYPE" == "linux-gnu" && -n "${WSL_DISTRO_NAME:-}" ]] || uname -s | grep -q "MINGW\|MSYS"; then + # Windows (Git Bash/WSL/MINGW) - use versioned installer + powershell -ExecutionPolicy ByPass -c "irm https://github.com/astral-sh/uv/releases/download/0.8.5/uv-installer.ps1 | iex" else # macOS/Linux - use the versioned script for consistency curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.8.5/uv-installer.sh | sh diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index e695857e..7797e8b4 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -121,7 +121,7 @@ You are running an old version of `pip` that cannot download the binary `cryptog You tried to install Algo and you see an error that reads "ansible-playbook: command not found." -You did not finish step 4 in the installation instructions, "[Install Algo's remaining dependencies](https://github.com/trailofbits/algo#deploy-the-algo-server)." Algo depends on [Ansible](https://github.com/ansible/ansible), an automation framework, and this error indicates that you do not have Ansible installed. Ansible is installed by `pip` when you run `python3 -m pip install -r requirements.txt`. You must complete the installation instructions to run the Algo server deployment process. +You did not finish the installation instructions, "[Install Algo's remaining dependencies](https://github.com/trailofbits/algo#deploy-the-algo-server)." Algo depends on [Ansible](https://github.com/ansible/ansible), an automation framework, and this error indicates that you do not have Ansible installed. Dependencies are managed by uv and installed automatically when you run `./algo`. You must complete the installation instructions to run the Algo server deployment process. ### Fatal: "Failed to validate the SSL certificate" @@ -138,8 +138,8 @@ You tried to install Algo and you received an error like this one: ``` Could not fetch URL https://pypi.python.org/simple/secretstorage/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) - skipping - Could not find a version that satisfies the requirement SecretStorage<3 (from -r requirements.txt (line 2)) (from versions: ) -No matching distribution found for SecretStorage<3 (from -r requirements.txt (line 2)) + Could not find a version that satisfies the requirement SecretStorage<3 (from pyproject.toml dependencies) (from versions: ) +No matching distribution found for SecretStorage<3 (from pyproject.toml dependencies) ``` It's time to upgrade your python. diff --git a/main.yml b/main.yml index 18baae40..0f231f4d 100644 --- a/main.yml +++ b/main.yml @@ -22,11 +22,9 @@ no_log: true register: ipaddr - - name: Extract ansible version from requirements + - name: Extract ansible version from pyproject.toml set_fact: - ansible_requirement: "{{ item }}" - when: '"ansible" in item' - with_items: "{{ lookup('file', 'requirements.txt').splitlines() }}" + ansible_requirement: "{{ lookup('community.general.toml', 'pyproject.toml', 'project.dependencies') | select('match', '^ansible.*') | first }}" - name: Parse ansible version requirement set_fact: @@ -55,7 +53,7 @@ msg: > Ansible version is {{ pip_package_info.packages.pip.ansible.0.version }}. You must update the requirements to use this version of Algo. - Try to run python3 -m pip install -U -r requirements.txt + Try to run: uv sync - name: Include prompts playbook import_playbook: input.yml diff --git a/tests/README.md b/tests/README.md index df3af731..5a98e738 100644 --- a/tests/README.md +++ b/tests/README.md @@ -5,7 +5,7 @@ ### What We Test Now 1. **Basic Sanity** (`test_basic_sanity.py`) - Python version >= 3.10 - - requirements.txt exists + - pyproject.toml exists and has dependencies - config.cfg is valid YAML - Ansible playbook syntax - Shell scripts pass shellcheck diff --git a/tests/unit/test_docker_localhost_deployment.py b/tests/unit/test_docker_localhost_deployment.py index 18d72993..8cf67d73 100755 --- a/tests/unit/test_docker_localhost_deployment.py +++ b/tests/unit/test_docker_localhost_deployment.py @@ -123,7 +123,7 @@ def test_localhost_deployment_requirements(): 'Python 3.8+': sys.version_info >= (3, 8), 'Ansible installed': subprocess.run(['which', 'ansible'], capture_output=True).returncode == 0, 'Main playbook exists': os.path.exists('main.yml'), - 'Requirements file exists': os.path.exists('requirements.txt'), + 'Project config exists': os.path.exists('pyproject.toml'), 'Config template exists': os.path.exists('config.cfg.example') or os.path.exists('config.cfg'), }