diff --git a/.github/actions/setup-uv-python/action.yml b/.github/actions/setup-uv-python/action.yml new file mode 100644 index 000000000..055e56121 --- /dev/null +++ b/.github/actions/setup-uv-python/action.yml @@ -0,0 +1,20 @@ +name: "Set up uv and Python" +description: "Installs uv, sets up Python via .python-version, and installs build deps from pyproject.toml" + +runs: + using: composite + steps: + - name: Install uv + uses: astral-sh/setup-uv@v8.0.0 + with: + version: "0.11.3" + + - name: Set up Python + shell: bash + run: | + uv python install + echo "python=$(uv python find)" >> $GITHUB_ENV + + - name: Install Python build deps + shell: bash + run: uv pip install . diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 385da7f12..f1e1190b2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,15 +49,8 @@ jobs: node-version: '22' cache: 'pnpm' - - name: Setup Python 3.11 for node-gyp - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - - name: Install Python build deps (setuptools shim for distutils) - run: | - python -m pip install --upgrade pip setuptools wheel - echo "python=$(which python3)" >> $GITHUB_ENV + - name: Set up uv and Python + uses: ./.github/actions/setup-uv-python - name: Install dependencies (strict lockfile) env: @@ -192,15 +185,8 @@ jobs: node-version: '22' cache: 'pnpm' - - name: Setup Python 3.11 for node-gyp - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - - name: Install Python build deps (setuptools) - run: | - python -m pip install --upgrade pip setuptools wheel - echo "python=$(which python3)" >> $GITHUB_ENV + - name: Set up uv and Python + uses: ./.github/actions/setup-uv-python - name: Install system build dependencies run: | @@ -305,16 +291,8 @@ jobs: node-version: '20' cache: 'pnpm' - - name: Setup Python 3.11 for node-gyp - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - - name: Install Python build deps (setuptools shim for distutils) - shell: bash - run: | - python -m pip install --upgrade pip setuptools wheel - echo "python=$(which python)" >> "$GITHUB_ENV" + - name: Set up uv and Python + uses: ./.github/actions/setup-uv-python - name: Install dependencies (strict lockfile) shell: bash @@ -479,15 +457,8 @@ jobs: node-version: '22' cache: 'pnpm' - - name: Setup Python 3.11 for node-gyp - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - - name: Install Python build deps (setuptools shim for distutils) - run: | - python -m pip install --upgrade pip setuptools wheel - echo "python=$(which python3)" >> $GITHUB_ENV + - name: Set up uv and Python + uses: ./.github/actions/setup-uv-python - name: Install dependencies (strict lockfile) env: diff --git a/.python-version b/.python-version new file mode 100644 index 000000000..fdcfcfdfc --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.12 \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 30bd3d68f..d10e09c0f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,10 +7,26 @@ Thanks for your interest in contributing! We favor small, focused PRs and clear Prerequisites - **Node.js 20.0.0+ (recommended: 22.20.0)** and Git +- **Python 3.12+** with [uv](https://docs.astral.sh/uv/) (for native module builds) - Optional (recommended for end‑to‑end testing): - GitHub CLI (`brew install gh`; then `gh auth login`) - At least one supported coding agent CLI (see docs for list) +### Python Setup + +This project uses [uv](https://docs.astral.sh/uv/) to manage Python build dependencies. Install uv first, then the project will automatically use the Python version specified in `.python-version`: + +```bash +# Install uv (Linux/macOS) +curl -LsSf https://astral.sh/uv/install.sh | sh + +# Or on Windows (PowerShell) +powershell -ExecutionPolicy Bypass -c "irm https://astral.sh/uv/install.ps1 | iex" + +# Install Python build deps (setuptools, wheel) for native modules +uv pip install . +``` + Setup ```bash diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..b9fa1ece5 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,12 @@ +[project] +name = "emdash-build-deps" +version = "0.0.0" +requires-python = ">=3.12" +dependencies = [ + "setuptools>=67.0", + "wheel", +] + +[build-system] +requires = ["setuptools>=67.0", "wheel"] +build-backend = "setuptools.build_meta"