Add bootstrapping and isolation of development Python versions (#1105)

Replaces https://github.com/astral-sh/puffin/pull/1068 and #1070 which
were more complicated than I wanted.

- Introduces a `.python-versions` file which defines the Python versions
needed for development
- Adds a Bash script at `scripts/bootstrap/install` which installs the
required Python versions from `python-build-standalone` to `./bin`
- Checks in a `versions.json` file with metadata about available
versions on each platform and a `fetch-version` Python script derived
from `rye` for updating the versions
- Updates CI to use these Python builds instead of the `setup-python`
action
- Updates to the latest packse scenarios which require Python 3.8+
instead of 3.7+ since we cannot use 3.7 anymore and includes new test
coverage of patch Python version requests
- Adds a `PUFFIN_PYTHON_PATH` variable to prevent lookup of system
Python versions for isolation during development

Tested on Linux (via CI) and macOS (locally) — presumably it will be a
bit more complicated to do proper Windows support.
This commit is contained in:
Zanie Blue 2024-01-26 12:12:48 -06:00 committed by GitHub
parent cc0e211074
commit 21577ad002
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 5789 additions and 444 deletions

View file

@ -39,14 +39,13 @@ Requirements:
import json
import shutil
import os
import subprocess
import sys
import textwrap
from pathlib import Path
PACKSE_COMMIT = "78f34eec66acfba9c723285764dc1f4b841f4961"
PACKSE_COMMIT = "e944cb4c8f5d68457d0462ee19106509f63b8d34"
TOOL_ROOT = Path(__file__).parent
TEMPLATES = TOOL_ROOT / "templates"
INSTALL_TEMPLATE = TEMPLATES / "install.mustache"
@ -149,6 +148,8 @@ print("Loading scenario metadata...", file=sys.stderr)
data = json.loads(
subprocess.check_output(
[
sys.executable,
"-m",
"packse",
"inspect",
"--short-names",