WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 870132e

Browse files
authored
Merge pull request #17 from scientific-python/ci
2 parents 91bbf52 + 2e0c065 commit 870132e

File tree

12 files changed

+220
-97
lines changed

12 files changed

+220
-97
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Generate release schedule artifacts
2+
on:
3+
schedule:
4+
# At 00:00 on day-of-month 2 in every 3rd month. (i.e. every quarter)
5+
# 2nd is chosen to avoid fencepost errors
6+
- cron: "0 0 2 */3 *"
7+
push:
8+
branches:
9+
- "main"
10+
# On demand
11+
workflow_dispatch:
12+
13+
jobs:
14+
create-artifacts:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v5
21+
with:
22+
# We're going to make a tag that we can we release so we'll need the full history for that
23+
fetch-depth: 0
24+
25+
- uses: prefix-dev/[email protected]
26+
with:
27+
pixi-version: "v0.49.0"
28+
29+
- name: Generate artifacts
30+
run: |
31+
pixi run generate-schedule --locked
32+
33+
- name: Test json artifact
34+
run: |
35+
cat schedule.json | jq
36+
37+
- name: setup git
38+
run: |
39+
# git will complain if we don't do this first
40+
git config user.name "github-actions[bot]"
41+
git config user.email "github-actions[bot]@users.noreply.github.com"
42+
43+
- name: determine tag name
44+
id: tag_name
45+
run: |
46+
echo "TAG_NAME=$(date '+%Y-Q%q')" >> "$GITHUB_OUTPUT"
47+
- name: Commit artifacts and create tag
48+
env:
49+
GH_TOKEN: ${{ secrets.RELEASE_PAT }}
50+
run: |
51+
git add -f schedule.md chart.md schedule.json
52+
git commit -m "generate schedule for ${{ steps.tag_name.outputs.TAG_NAME }} release" || echo "No changes to commit"
53+
git tag ${{ steps.tag_name.outputs.TAG_NAME }}
54+
git push origin main
55+
git push origin tag ${{ steps.tag_name.outputs.TAG_NAME }}
56+
57+
- name: Publish github release
58+
uses: softprops/action-gh-release@v2
59+
env:
60+
GH_TOKEN: ${{ secrets.RELEASE_PAT }}
61+
with:
62+
generate_release_notes: true
63+
tag_name: ${{ steps.tag_name.outputs.TAG_NAME }}
64+
make_latest: true
65+
files: |
66+
schedule.md
67+
chart.md
68+
schedule.json
69+
70+
permissions:
71+
contents: write

.github/workflows/test_action.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
name: Test Action
2-
on: [push, pull_request]
2+
on:
3+
push:
4+
branches:
5+
- "main"
6+
- "*.*"
7+
tags:
8+
- "v*"
9+
pull_request:
10+
# Allow manual runs through the web UI
11+
workflow_dispatch:
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
316

417
jobs:
518
generate_data:

.github/workflows/test_bench.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
name: Run the update test suite
22
on:
33
push:
4-
branches: main
4+
branches:
5+
- "main"
6+
- "*.*"
7+
tags:
8+
- "v*"
59
pull_request:
6-
branches: main
7-
# On demand
10+
# Allow manual runs through the web UI
811
workflow_dispatch:
912

1013
jobs:
@@ -13,7 +16,6 @@ jobs:
1316
steps:
1417
- name: Checkout
1518
uses: actions/checkout@v6
16-
1719
- uses: prefix-dev/[email protected]
1820
with:
1921
pixi-version: "v0.49.0"

action.yaml

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
# action.yml
12
name: "Update SPEC 0 dependencies"
23
description: "Update the lower bounds of Python dependencies covered by the Scientific Python SPEC 0 support schedule"
34
author: Scientific Python Developers
5+
46
inputs:
57
target_branch:
68
description: "Target branch for the pull request"
@@ -34,63 +36,51 @@ runs:
3436
steps:
3537
- name: Checkout code
3638
uses: actions/checkout@v6
37-
3839
- name: Set up Git
3940
shell: bash
4041
run: |
4142
git config user.name "Scientific Python [bot]"
4243
git config user.email "[email protected]"
43-
4444
- uses: prefix-dev/[email protected]
4545
name: Setup Pixi
4646
with:
4747
pixi-version: v0.49.0
4848
manifest-path: ${{ github.action_path }}/pyproject.toml
49-
50-
- name: Regenerate schedule file if necessary
51-
shell: bash
52-
env:
53-
SCHEDULE_FILE: ${{ inputs.schedule_path }}
54-
GH_TOKEN: ${{ inputs.token }}
55-
run: |
56-
set -e
57-
if [ ! -f "${{ github.workspace }}/$SCHEDULE_FILE" ]; then
58-
echo "Regenerating schedule.json..."
59-
pixi run generate-schedule --locked
60-
if diff -q schedule.json "${{ github.workspace }}/$SCHEDULE_FILE" >/dev/null; then
61-
echo "Source and destination have identical contents – nothing to move."
62-
else
63-
mv schedule.json "${{ github.workspace }}/$SCHEDULE_FILE"
64-
fi
65-
else
66-
echo "Schedule file already exists at $SCHEDULE_FILE"
67-
fi
68-
49+
- name: Fetch Schedule from release
50+
uses: robinraju/[email protected]
51+
with:
52+
repository: "savente93/SPEC0-schedule"
53+
latest: true
54+
fileName: "schedule.json"
6955
- name: Run update script
7056
shell: bash
7157
run: |
7258
set -e
73-
echo "Updating ${{inputs.project_file_name}} using schedule ${{inputs.schedule_path}}"
74-
pixi run --manifest-path ${{ github.action_path }}/pyproject.toml update-dependencies "${{ github.workspace }}/${{ inputs.project_file_name }}" "${{ github.workspace }}/${{ inputs.schedule_path }}"
75-
76-
- name: Show changes (dry-run)
77-
if: ${{ inputs.create_pr != 'true' }}
59+
echo "Updating ${{ inputs.project_file_name }} using schedule ${{ inputs.schedule_path }}"
60+
pixi run --manifest-path ${{ github.action_path }}/pyproject.toml update-dependencies "${{ github.workspace }}/${{ inputs.project_file_name }}" "${{ github.workspace }}/${{ inputs.schedule_path }}"
61+
- name: Changes
62+
id: changes
7863
shell: bash
7964
run: |
80-
echo "Dry run: showing changes that would be committed"
65+
echo "Showing changes that would be committed"
8166
git --no-pager diff ${{ inputs.project_file_name }}
82-
67+
if git diff --quiet ${{ inputs.project_file_name }}; then
68+
echo "changes_detected=false" >> "$GITHUB_OUTPUT"
69+
else
70+
echo "changes_detected=true" >> "$GITHUB_OUTPUT"
71+
fi
8372
- name: Create Pull Request
84-
if: ${{ inputs.create_pr == 'true' }}
73+
if: ${{ fromJSON(inputs.create_pr) && fromJSON(steps.changes.outputs.changes_detected) }}
8574
uses: peter-evans/create-pull-request@v7
8675
with:
8776
token: ${{ inputs.token }}
8877
commit-message: ${{ inputs.commit_msg }}
89-
path: ${{ inputs.project_file_name }}
9078
title: ${{ inputs.pr_title }}
9179
body: "This PR was created automatically"
9280
base: ${{ inputs.target_branch }}
9381
branch: update-spec0-dependencies-${{ github.run_id }}
82+
add-paths: |
83+
${{ inputs.project_file_name }}
9484
9585
branding:
9686
icon: "check-square"

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ It should update any of the packages listed in the `dependency`, or `tool.pixi.*
4141
For examples of before and after you can see [./tests/test_data/pyproject.toml](./tests/test_data/pyproject.toml) and [./tests/test_data/pyproject_updated.toml](./tests/test_data/pyproject_updated.toml) respectively.
4242
Other tools are not yet supported, but we are open to feature requests.
4343

44-
The newest lower bounds will be downloaded from [https://github.com/savente93/SPEC0-schedule](https://github.com/savente93/SPEC0-schedule) but you should not have to worry about this.
44+
The newest lower bounds will be downloaded from [https://github.com/scientific-python/spec0-action](https://github.com/scientific-python/spec0-action) but you should not have to worry about this.
4545

4646
### Parameters
4747

spec0_action/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ def update_pyproject_toml(
112112
pyproject_data["project"]["requires-python"] = repr_spec_set(
113113
parse_version_spec(new_version["packages"]["python"])
114114
)
115-
116115
update_pyproject_dependencies(
117116
pyproject_data["project"]["dependencies"], new_version
118117
)

spec0_versions.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from datetime import datetime, timedelta
55

66
import pandas as pd
7-
from packaging.version import Version
7+
from packaging.version import Version, InvalidVersion
88

99

1010
PY_RELEASES = {
@@ -14,6 +14,7 @@
1414
"3.11": "Oct 24, 2022",
1515
"3.12": "Oct 2, 2023",
1616
"3.13": "Oct 7, 2024",
17+
"3.14": "Oct 7, 2025",
1718
}
1819
CORE_PACKAGES = [
1920
"ipython",
@@ -56,11 +57,17 @@ def get_release_dates(package, support_time=PLUS_24_MONTHS):
5657
ver = f["filename"].split("-")[1]
5758
try:
5859
version = Version(ver)
59-
except Exception:
60+
except InvalidVersion as e:
61+
print(f"Error: '{ver}' is an invalid version for '{package}'. Reason: {e}")
6062
continue
6163
if version.is_prerelease or version.micro != 0:
6264
continue
63-
release_date = pd.Timestamp(f["upload-time"]).tz_localize(None)
65+
release_date = None
66+
for format in ["%Y-%m-%dT%H:%M:%S.%fZ", "%Y-%m-%dT%H:%M:%SZ"]:
67+
try:
68+
release_date = datetime.strptime(f["upload-time"], format)
69+
except ValueError as e:
70+
print(f"Error parsing invalid date: {e}")
6471
if not release_date:
6572
continue
6673
file_date[version].append(release_date)

tests/test_data/pyproject.toml

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,16 @@
1-
[project]
2-
authors = [{ name = "Scientific Python Developers"}]
3-
name = "tests"
4-
description = "This is just a dummy package for testing the spec 0 update github action and should not be used"
5-
requires-python = ">=3.10"
6-
version = "0.1.0"
7-
dependencies = ["ipython>=8.7.0,<4", "numpy[foo,bar]>=1.10.0,<2"]
8-
91
[build-system]
10-
build-backend = "hatchling.build"
11-
requires = ["hatchling"]
12-
13-
[tool.pixi.workspace]
14-
channels = ["conda-forge"]
15-
platforms = ["linux-64"]
16-
17-
[tool.pixi.pypi-dependencies]
18-
tests = { path = ".", editable = true }
19-
scikit-learn = ">=1.2.0"
2+
requires = [
3+
"setuptools>=62.1",
4+
"setuptools_scm[toml]>=8.0.0",
5+
"wheel",
6+
]
7+
build-backend = "setuptools.build_meta"
208

21-
[tool.pixi.tasks]
22-
23-
[tool.pixi.feature.foo.dependencies]
24-
xarray = "*"
25-
26-
[tool.pixi.environments]
27-
bar = ["foo"]
28-
29-
[tool.pixi.dependencies]
30-
numpy = ">=1.10.0,<2"
9+
[project]
10+
name = "setuptools_test"
11+
requires-python = ">=3.11"
12+
dependencies = [
13+
'numpy>=1.20.0,<2',
14+
'pandas>=1.0.0,<3',
15+
'xarray>=2021.1.0',
16+
]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[project]
2+
authors = [{ name = "Scientific Python Developers"}]
3+
name = "tests"
4+
description = "This is just a dummy package for testing the spec 0 update github action and should not be used"
5+
requires-python = ">=3.10"
6+
version = "0.1.0"
7+
dependencies = ["ipython>=8.7.0,<4", "numpy[foo,bar]>=1.10.0,<2"]
8+
9+
[build-system]
10+
build-backend = "hatchling.build"
11+
requires = ["hatchling"]
12+
13+
[tool.pixi.workspace]
14+
channels = ["conda-forge"]
15+
platforms = ["linux-64"]
16+
17+
[tool.pixi.pypi-dependencies]
18+
tests = { path = ".", editable = true }
19+
scikit-learn = ">=1.2.0"
20+
21+
[tool.pixi.tasks]
22+
23+
[tool.pixi.feature.foo.dependencies]
24+
xarray = "*"
25+
26+
[tool.pixi.environments]
27+
bar = ["foo"]
28+
29+
[tool.pixi.dependencies]
30+
numpy = ">=1.10.0,<2"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[project]
2+
authors = [{ name = "Scientific Python Developers"}]
3+
name = "tests"
4+
description = "This is just a dummy package for testing the spec 0 update github action and should not be used"
5+
requires-python = ">=3.11"
6+
version = "0.1.0"
7+
dependencies = ["ipython>=8.8.0,<4", "numpy[foo,bar]>=1.25.0,<2"]
8+
9+
[build-system]
10+
build-backend = "hatchling.build"
11+
requires = ["hatchling"]
12+
13+
[tool.pixi.workspace]
14+
channels = ["conda-forge"]
15+
platforms = ["linux-64"]
16+
17+
[tool.pixi.pypi-dependencies]
18+
tests = { path = ".", editable = true }
19+
scikit-learn = ">=1.3.0"
20+
21+
[tool.pixi.tasks]
22+
23+
[tool.pixi.feature.foo.dependencies]
24+
xarray = ">=2023.1.0"
25+
26+
[tool.pixi.environments]
27+
bar = ["foo"]
28+
29+
[tool.pixi.dependencies]
30+
numpy = ">=1.25.0,<2"

0 commit comments

Comments
 (0)