Skip to content

Commit dc0a2f7

Browse files
committed
Added to workflow
1 parent 7a7303a commit dc0a2f7

File tree

3 files changed

+38
-5
lines changed

3 files changed

+38
-5
lines changed

.github/workflows/cleanup_pypi.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: cleanup_pypi.yml
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
dry-run:
6+
description: List packages that would be deleted but don't delete them
7+
type: boolean
8+
default: false
9+
workflow_call:
10+
jobs:
11+
cleanup_pypi:
12+
name: Remove Nightlies from PyPI
13+
runs-on: ubuntu-latest
14+
env:
15+
PYPI_CLEANUP_PASSWORD: ${{secrets.PYPI_CLEANUP_PASSWORD}}
16+
PYPI_CLEANUP_OTP: ${{secrets.PYPI_CLEANUP_OTP}}
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Install Astral UV
20+
uses: astral-sh/setup-uv@v6
21+
with:
22+
version: "0.7.14"
23+
python-version: 3.11
24+
25+
- name: Run Cleanup
26+
run: |
27+
uv sync --only-group pypi --no-install-project
28+
uv run --no-sync -s scripts/pypi_cleanup.py ${{ inputs.dry-run && '--dry' || '' }} \
29+
--index-hostname "${{ vars.PYPI_HOST }}" \
30+
--username "${{ vars.PYPI_CLEANUP_USERNAME }}" \
31+
--max-nightlies ${{ vars.PYPI_MAX_NIGHTLIES }}

pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ test = [ # dependencies used for running tests
250250
"numpy<2; python_version < '3.12'",
251251
"numpy>=2; python_version >= '3.12'",
252252
]
253-
254253
scripts = [ # dependencies used for running scripts
255254
"cxxheaderparser",
256255
"ipython",
@@ -260,9 +259,12 @@ scripts = [ # dependencies used for running scripts
260259
"pcpp",
261260
"polars",
262261
"pyarrow",
263-
"pyotp>=2.9.0",
264262
"pytz"
265263
]
264+
pypi = [ # dependencies used by the pypi cleanup script
265+
"pyotp>=2.9.0",
266+
"requests>=2.32.4",
267+
]
266268
build = [
267269
"cmake>=3.29.0",
268270
"ninja>=1.10",

scripts/pypi_cleanup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ def non_empty_string(value):
4141
epilog="Environment variables required (unless --dry): PYPI_CLEANUP_PASSWORD, PYPI_CLEANUP_OTP"
4242
)
4343
parser.add_argument("--dry", action="store_true", help="Show what would be deleted but don't actually do it")
44-
parser.add_argument("--index-hostname", type=valid_hostname, required=True, help="Index hostname (required)")
45-
parser.add_argument("--max-nightlies", type=int, default=2, help="Max number of nightlies of unreleased versions (default=2)")
46-
parser.add_argument("--username", type=non_empty_string, help="Username (required unless --dry)")
44+
parser.add_argument("-i", "--index-hostname", type=valid_hostname, required=True, help="Index hostname (required)")
45+
parser.add_argument("-m", "--max-nightlies", type=int, default=2, help="Max number of nightlies of unreleased versions (default=2)")
46+
parser.add_argument("-u", "--username", type=non_empty_string, help="Username (required unless --dry)")
4747
args = parser.parse_args()
4848

4949
# Handle secrets from environment variables

0 commit comments

Comments
 (0)