Skip to content

Commit fcd8da8

Browse files
authored
Deprecate 'upload' and 'publish' CLI commands (#2875)
Implements half of #2334
1 parent fe823be commit fcd8da8

File tree

3 files changed

+46
-36
lines changed

3 files changed

+46
-36
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,15 +238,11 @@ jobs:
238238
subject-path: |
239239
./*.tar.gz
240240
./*.whl
241-
- uses: actions/setup-python@v6
241+
- uses: astral-sh/setup-uv@v7
242242
if: startsWith(github.ref, 'refs/tags/')
243-
with:
244-
python-version: "3.10"
245243
- name: Publish
246244
if: startsWith(github.ref, 'refs/tags/')
247-
run: |
248-
pip install maturin
249-
maturin upload --skip-existing *
245+
run: uv publish '*'
250246
- name: Set environment url
251247
id: set_url
252248
run: |

src/ci.rs

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -658,15 +658,18 @@ jobs:\n",
658658
"#,
659659
);
660660
}
661+
conf.push_str(
662+
r#" - name: Install uv
663+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
664+
uses: astral-sh/setup-uv@v7
665+
"#,
666+
);
661667
conf.push_str(
662668
r#" - name: Publish to PyPI
663669
if: ${{ startsWith(github.ref, 'refs/tags/') }}
664-
uses: PyO3/maturin-action@v1
670+
run: uv publish 'wheels-*/*'
665671
env:
666-
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
667-
with:
668-
command: upload
669-
args: --non-interactive --skip-existing wheels-*/*
672+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
670673
"#,
671674
);
672675
if platforms.contains(&Platform::Emscripten) {
@@ -892,14 +895,14 @@ mod tests {
892895
uses: actions/attest-build-provenance@v3
893896
with:
894897
subject-path: 'wheels-*/*'
898+
- name: Install uv
899+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
900+
uses: astral-sh/setup-uv@v7
895901
- name: Publish to PyPI
896902
if: ${{ startsWith(github.ref, 'refs/tags/') }}
897-
uses: PyO3/maturin-action@v1
903+
run: uv publish 'wheels-*/*'
898904
env:
899-
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
900-
with:
901-
command: upload
902-
args: --non-interactive --skip-existing wheels-*/*"#]];
905+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}"#]];
903906
expected.assert_eq(&conf);
904907
}
905908

@@ -1110,14 +1113,14 @@ mod tests {
11101113
uses: actions/attest-build-provenance@v3
11111114
with:
11121115
subject-path: 'wheels-*/*'
1116+
- name: Install uv
1117+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
1118+
uses: astral-sh/setup-uv@v7
11131119
- name: Publish to PyPI
11141120
if: ${{ startsWith(github.ref, 'refs/tags/') }}
1115-
uses: PyO3/maturin-action@v1
1121+
run: uv publish 'wheels-*/*'
11161122
env:
1117-
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
1118-
with:
1119-
command: upload
1120-
args: --non-interactive --skip-existing wheels-*/*"#]];
1123+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}"#]];
11211124
expected.assert_eq(&conf);
11221125
}
11231126

@@ -1325,14 +1328,14 @@ mod tests {
13251328
contents: write
13261329
steps:
13271330
- uses: actions/download-artifact@v6
1331+
- name: Install uv
1332+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
1333+
uses: astral-sh/setup-uv@v7
13281334
- name: Publish to PyPI
13291335
if: ${{ startsWith(github.ref, 'refs/tags/') }}
1330-
uses: PyO3/maturin-action@v1
1336+
run: uv publish 'wheels-*/*'
13311337
env:
1332-
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
1333-
with:
1334-
command: upload
1335-
args: --non-interactive --skip-existing wheels-*/*"#]];
1338+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}"#]];
13361339
expected.assert_eq(&conf);
13371340
}
13381341

@@ -1605,14 +1608,14 @@ mod tests {
16051608
uses: actions/attest-build-provenance@v3
16061609
with:
16071610
subject-path: 'wheels-*/*'
1611+
- name: Install uv
1612+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
1613+
uses: astral-sh/setup-uv@v7
16081614
- name: Publish to PyPI
16091615
if: ${{ startsWith(github.ref, 'refs/tags/') }}
1610-
uses: PyO3/maturin-action@v1
1616+
run: uv publish 'wheels-*/*'
16111617
env:
1612-
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
1613-
with:
1614-
command: upload
1615-
args: --non-interactive --skip-existing wheels-*/*"#]];
1618+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}"#]];
16161619
expected.assert_eq(&conf);
16171620
}
16181621

@@ -1786,14 +1789,14 @@ mod tests {
17861789
uses: actions/attest-build-provenance@v3
17871790
with:
17881791
subject-path: 'wheels-*/*'
1792+
- name: Install uv
1793+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
1794+
uses: astral-sh/setup-uv@v7
17891795
- name: Publish to PyPI
17901796
if: ${{ startsWith(github.ref, 'refs/tags/') }}
1791-
uses: PyO3/maturin-action@v1
1797+
run: uv publish 'wheels-*/*'
17921798
env:
1793-
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
1794-
with:
1795-
command: upload
1796-
args: --non-interactive --skip-existing wheels-*/*"#]];
1799+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}"#]];
17971800
expected.assert_eq(&conf);
17981801
}
17991802
}

src/upload.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,17 @@ impl PublishOpt {
6666
/// Set to non interactive mode if we're running on CI
6767
pub fn non_interactive_on_ci(&mut self) {
6868
if !self.non_interactive && env::var("CI").map(|v| v == "true").unwrap_or_default() {
69+
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";
70+
eprintln!("{msg}");
71+
72+
if env::var("GITHUB_ACTIONS")
73+
.map(|v| v == "true")
74+
.unwrap_or_default()
75+
{
76+
// Also emit a warning annotation on the GH action
77+
println!("::warning::{msg}");
78+
}
79+
6980
eprintln!("🎛️ Running in non-interactive mode on CI");
7081
self.non_interactive = true;
7182
}

0 commit comments

Comments
 (0)