From 40b4fcca2b9d0f4b47e9a20bf777dd4515ed096e Mon Sep 17 00:00:00 2001 From: Eashwar Ranganathan Date: Wed, 26 Nov 2025 13:58:57 -0500 Subject: [PATCH] Deprecate 'upload' and 'publish' CLI commands --- .github/workflows/release.yml | 8 ++--- src/ci.rs | 63 ++++++++++++++++++----------------- src/upload.rs | 11 ++++++ 3 files changed, 46 insertions(+), 36 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7ed25e7b4..e9d4e3772 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -238,15 +238,11 @@ jobs: subject-path: | ./*.tar.gz ./*.whl - - uses: actions/setup-python@v6 + - uses: astral-sh/setup-uv@v7 if: startsWith(github.ref, 'refs/tags/') - with: - python-version: "3.10" - name: Publish if: startsWith(github.ref, 'refs/tags/') - run: | - pip install maturin - maturin upload --skip-existing * + run: uv publish '*' - name: Set environment url id: set_url run: | diff --git a/src/ci.rs b/src/ci.rs index a56cf9807..612b6e7a8 100644 --- a/src/ci.rs +++ b/src/ci.rs @@ -658,15 +658,18 @@ jobs:\n", "#, ); } + conf.push_str( + r#" - name: Install uv + if: ${{ startsWith(github.ref, 'refs/tags/') }} + uses: astral-sh/setup-uv@v7 +"#, + ); conf.push_str( r#" - name: Publish to PyPI if: ${{ startsWith(github.ref, 'refs/tags/') }} - uses: PyO3/maturin-action@v1 + run: uv publish 'wheels-*/*' env: - MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} - with: - command: upload - args: --non-interactive --skip-existing wheels-*/* + UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }} "#, ); if platforms.contains(&Platform::Emscripten) { @@ -892,14 +895,14 @@ mod tests { uses: actions/attest-build-provenance@v3 with: subject-path: 'wheels-*/*' + - name: Install uv + if: ${{ startsWith(github.ref, 'refs/tags/') }} + uses: astral-sh/setup-uv@v7 - name: Publish to PyPI if: ${{ startsWith(github.ref, 'refs/tags/') }} - uses: PyO3/maturin-action@v1 + run: uv publish 'wheels-*/*' env: - MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} - with: - command: upload - args: --non-interactive --skip-existing wheels-*/*"#]]; + UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}"#]]; expected.assert_eq(&conf); } @@ -1110,14 +1113,14 @@ mod tests { uses: actions/attest-build-provenance@v3 with: subject-path: 'wheels-*/*' + - name: Install uv + if: ${{ startsWith(github.ref, 'refs/tags/') }} + uses: astral-sh/setup-uv@v7 - name: Publish to PyPI if: ${{ startsWith(github.ref, 'refs/tags/') }} - uses: PyO3/maturin-action@v1 + run: uv publish 'wheels-*/*' env: - MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} - with: - command: upload - args: --non-interactive --skip-existing wheels-*/*"#]]; + UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}"#]]; expected.assert_eq(&conf); } @@ -1325,14 +1328,14 @@ mod tests { contents: write steps: - uses: actions/download-artifact@v6 + - name: Install uv + if: ${{ startsWith(github.ref, 'refs/tags/') }} + uses: astral-sh/setup-uv@v7 - name: Publish to PyPI if: ${{ startsWith(github.ref, 'refs/tags/') }} - uses: PyO3/maturin-action@v1 + run: uv publish 'wheels-*/*' env: - MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} - with: - command: upload - args: --non-interactive --skip-existing wheels-*/*"#]]; + UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}"#]]; expected.assert_eq(&conf); } @@ -1605,14 +1608,14 @@ mod tests { uses: actions/attest-build-provenance@v3 with: subject-path: 'wheels-*/*' + - name: Install uv + if: ${{ startsWith(github.ref, 'refs/tags/') }} + uses: astral-sh/setup-uv@v7 - name: Publish to PyPI if: ${{ startsWith(github.ref, 'refs/tags/') }} - uses: PyO3/maturin-action@v1 + run: uv publish 'wheels-*/*' env: - MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} - with: - command: upload - args: --non-interactive --skip-existing wheels-*/*"#]]; + UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}"#]]; expected.assert_eq(&conf); } @@ -1786,14 +1789,14 @@ mod tests { uses: actions/attest-build-provenance@v3 with: subject-path: 'wheels-*/*' + - name: Install uv + if: ${{ startsWith(github.ref, 'refs/tags/') }} + uses: astral-sh/setup-uv@v7 - name: Publish to PyPI if: ${{ startsWith(github.ref, 'refs/tags/') }} - uses: PyO3/maturin-action@v1 + run: uv publish 'wheels-*/*' env: - MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} - with: - command: upload - args: --non-interactive --skip-existing wheels-*/*"#]]; + UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}"#]]; expected.assert_eq(&conf); } } diff --git a/src/upload.rs b/src/upload.rs index fd0e633de..73de314cf 100644 --- a/src/upload.rs +++ b/src/upload.rs @@ -66,6 +66,17 @@ impl PublishOpt { /// Set to non interactive mode if we're running on CI pub fn non_interactive_on_ci(&mut self) { if !self.non_interactive && env::var("CI").map(|v| v == "true").unwrap_or_default() { + let msg = "⚠️ Warning: The maturin upload and publish commands are deprecated and will be removed in the future. For more information see: https://github.com/PyO3/maturin/issues/2334"; + eprintln!("{msg}"); + + if env::var("GITHUB_ACTIONS") + .map(|v| v == "true") + .unwrap_or_default() + { + // Also emit a warning annotation on the GH action + println!("::warning::{msg}"); + } + eprintln!("🎛️ Running in non-interactive mode on CI"); self.non_interactive = true; }