|
| 1 | +# SPEC 0 Version Action |
| 2 | + |
| 3 | +This repository contains a GitHub Action to generate the |
| 4 | + |
| 5 | +### Drop Schedule |
| 6 | + |
| 7 | +Below is an auto generated schedule with recommended dates for dropping support. We suggest that the next release in a given quarter is |
| 8 | +considered as the one removing support for a given item. |
| 9 | + |
| 10 | +You may want to delay the removal of support of an older Python version until your package fully works on the newly released Python, thus keeping the number of supported minor versions of Python the same for your package. |
| 11 | + |
| 12 | +{{< include-md "schedule.md" >}} |
| 13 | + |
| 14 | +### Automatically updating dependencies |
| 15 | + |
| 16 | +To help projects stay compliant with this spec, we additionally provide a `schedule.json` file that can be used by CI systems to deterime new version boundaries. The structure of the file is as follows: |
| 17 | + |
| 18 | +```json |
| 19 | +[ |
| 20 | + { |
| 21 | + "start_date": "iso8601_timestamp", |
| 22 | + "packages": { |
| 23 | + "package_name": "version" |
| 24 | + } |
| 25 | + } |
| 26 | +] |
| 27 | +``` |
| 28 | + |
| 29 | +All information in the json file is in a string format that should be easy to use. The date is the first timestamp of the relevant quarter. Thus a workflow for using this file could be: |
| 30 | + |
| 31 | +1. fetch `schedule.json` |
| 32 | +2. determine maximum date that is smaller than current date |
| 33 | +3. update packages listed with new minimum versions |
| 34 | + |
| 35 | +You can obtain the new versions you should set by using this `jq` expression: |
| 36 | + |
| 37 | +```sh |
| 38 | + |
| 39 | +jq 'map(select(.start_date |fromdateiso8601 |tonumber < now))| sort_by("start_date") | reverse | .[0].packages ' schedule.json |
| 40 | + |
| 41 | +``` |
| 42 | + |
| 43 | +If you use a package manager like pixi you could update the dependencies with a bash script like this: |
| 44 | + |
| 45 | +```sh |
| 46 | +curl -Ls -o schedule.json https://raw.githubusercontent.com/scientific-python/specs/main/spec-0000/schedule.json |
| 47 | +for line in $(jq 'map(select(.start_date |fromdateiso8601 |tonumber < now))| sort_by("start_date") | reverse | .[0].packages | to_entries | map(.key + ":" + .value)[]' --raw-output schedule.json); do |
| 48 | + package=$(echo "$line" | cut -d ':' -f 1) |
| 49 | + version=$(echo "$line" | cut -d ':' -f 2) |
| 50 | + if pixi list -x "^$package" &>/dev/null| grep "No packages" -q; then |
| 51 | + pixi add "$package>=$version"; |
| 52 | + fi |
| 53 | +done |
| 54 | + |
| 55 | +``` |
0 commit comments