From 35d764777675fc03eec354addbed3b391fdc5bb3 Mon Sep 17 00:00:00 2001 From: dvd233 <111864431+dvd233@users.noreply.github.com> Date: Tue, 22 Sep 2026 17:03:58 -0700 Subject: [PATCH] ci: publish Python source distribution --- .github/workflows/publish-python-sdist.yml | 50 ++++++++++++++++++++++ docs/development.md | 18 ++++++++ 2 files changed, 68 insertions(+) create mode 100644 .github/workflows/publish-python-sdist.yml diff --git a/.github/workflows/publish-python-sdist.yml b/.github/workflows/publish-python-sdist.yml new file mode 100644 index 0000000..feff5ec --- /dev/null +++ b/.github/workflows/publish-python-sdist.yml @@ -0,0 +1,50 @@ +name: Publish Python source distribution + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + build: + name: Build source distribution + runs-on: ubuntu-latest + steps: + - name: Check out the release source + uses: actions/checkout@v4 + + - name: Build source distribution + uses: PyO3/maturin-action@v1 + with: + command: sdist + args: --manifest-path deepseek-recipe-python/Cargo.toml --out dist + + - name: Store source distribution + uses: actions/upload-artifact@v4 + with: + name: python-sdist + path: dist/*.tar.gz + if-no-files-found: error + + publish: + name: Publish source distribution to PyPI + needs: build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/deepseek-recipe + permissions: + id-token: write + steps: + - name: Download source distribution + uses: actions/download-artifact@v4 + with: + name: python-sdist + path: dist + + - name: Publish package distributions + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: dist/ diff --git a/docs/development.md b/docs/development.md index 789d089..88caf68 100644 --- a/docs/development.md +++ b/docs/development.md @@ -110,6 +110,24 @@ For an installation without editable development, use: python3 -m pip install ./deepseek-recipe-python ``` +## Source distribution + +The release workflow publishes a source distribution alongside the wheels so +`pip` has an artifact to build when no wheel matches the user's platform. To +reproduce the source artifact locally: + +```sh +maturin sdist \ + --manifest-path deepseek-recipe-python/Cargo.toml \ + --out dist-sdist +twine check dist-sdist/* +``` + +The command packages the workspace crates and Python sources needed to build +the extension. The PyPI publishing job uses trusted publishing and runs when a +GitHub release is published; configure the `pypi` environment and the +`deepseek-recipe` trusted publisher before the first release. + ## Wheel packaging The extension links OpenCV dynamically, so a wheel is only installable on a