feat: add PyPI publishing via maturin (pip install aish-cli)#195
feat: add PyPI publishing via maturin (pip install aish-cli)#195jexShain wants to merge 1 commit into
Conversation
Package the aish binary as a Python wheel using maturin with bin bindings, enabling distribution through PyPI. Linux x86_64 and aarch64 wheels are built via CI on tag push.
📝 WalkthroughWalkthroughThis PR establishes the foundational infrastructure for publishing the ChangesPython Package Publishing
Sequence DiagramsequenceDiagram
participant User
participant GitHub as GitHub Actions
participant BuildJob as build-wheels Job
participant PublishJob as publish-pypi Job
participant PyPI
participant TestPyPI
User->>GitHub: Tag push v* or manual dispatch
GitHub->>BuildJob: Trigger matrix build (x86_64, aarch64)
BuildJob->>BuildJob: Build wheels via Maturin
BuildJob->>GitHub: Upload wheels as artifacts
GitHub->>PublishJob: All wheels built
PublishJob->>PublishJob: Download and merge all wheels
alt test_pypi = true
PublishJob->>TestPyPI: Publish wheels with TEST_PYPI_API_TOKEN
else test_pypi = false
PublishJob->>PyPI: Publish wheels with PYPI_API_TOKEN
end
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks for the pull request. A maintainer will review it when available. Please keep the PR focused, explain the why in the description, and make sure local checks pass before requesting review. Contribution guide: https://github.com/AI-Shell-Team/aish/blob/main/CONTRIBUTING.md |
|
This pull request description looks incomplete. Please update the missing sections below before review. Missing items:
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/pypi.yml (1)
51-51: ⚡ Quick winSwitch to PyPI trusted publishing (OIDC) over API tokens.
This removes long-lived credential risk and aligns with current PyPI publishing best practices. Add
permissions: id-token: writeto the job and remove thepasswordfields from both publish steps (lines 67 and 74). Both PyPI and TestPyPI support trusted publishing; configure trusted publishers on each index separately.Proposed direction
publish-pypi: name: Publish to ${{ github.event.inputs.test_pypi == 'true' && 'TestPyPI' || 'PyPI' }} needs: build-wheels runs-on: ubuntu-latest environment: release + permissions: + id-token: write steps: - name: Download wheels uses: actions/download-artifact@v6 with: pattern: wheel-* path: dist merge-multiple: true - name: List wheels run: ls -la dist/ - name: Publish to TestPyPI if: github.event.inputs.test_pypi == 'true' uses: pypa/gh-action-pypi-publish@release/v1 with: - password: ${{ secrets.TEST_PYPI_API_TOKEN }} repository-url: https://test.pypi.org/legacy/ - name: Publish to PyPI if: github.event.inputs.test_pypi != 'true' uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.PYPI_API_TOKEN }}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/pypi.yml at line 51, Update the GitHub Actions job to use OIDC trusted publishing by adding the job-level key permissions: id-token: write and removing the hardcoded password fields from the PyPI publish steps (remove any password: entries in the publish/upload steps for both PyPI and TestPyPI); ensure the publish steps rely on the default GITHUB_TOKEN/OIDC flow and that trusted publishers are configured on the PyPI and TestPyPI indexes to accept the OIDC token.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In @.github/workflows/pypi.yml:
- Line 51: Update the GitHub Actions job to use OIDC trusted publishing by
adding the job-level key permissions: id-token: write and removing the hardcoded
password fields from the PyPI publish steps (remove any password: entries in the
publish/upload steps for both PyPI and TestPyPI); ensure the publish steps rely
on the default GITHUB_TOKEN/OIDC flow and that trusted publishers are configured
on the PyPI and TestPyPI indexes to accept the OIDC token.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 59c41717-9510-4a32-bf49-a627d01595f7
📒 Files selected for processing (2)
.github/workflows/pypi.ymlpyproject.toml
Summary
pyproject.tomlwith maturin bin bindings configuration for packaging theaishbinary as a Python wheel.github/workflows/pypi.ymlfor automated wheel building and PyPI publishing on tag pushTest plan
pip install maturin && maturin build --releaseworkflow_dispatchto test build (publish to TestPyPI)pip install -i https://test.pypi.org/simple/ aish-cli && aish --helpSummary by CodeRabbit