Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1305 from DiamondLightSource/819_add_dodal_nexgen…
Browse files Browse the repository at this point in the history
…_version_to_release_notes_part_2

819 add dodal and nexgen versions to release notes
  • Loading branch information
d-perl authored May 17, 2024
2 parents 968cb3f + b901258 commit d140662
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 38 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/pin_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from functools import partial
from sys import stderr, stdout

SETUP_CFG_PATTERN = re.compile("(.*?)\\s*(@(.*))?\n")
SETUP_UNPINNED_PATTERN = re.compile("(.*?)\\s*([<>=]+(.*))?\n")
SETUP_CFG_PATTERN = re.compile("(.*?\\S)\\s*(@(.*))?$")
SETUP_UNPINNED_PATTERN = re.compile("(.*?\\S)\\s*([<>=]+(.*))?$")
PIP = "pip"


Expand Down Expand Up @@ -57,22 +57,25 @@ def process_files(input_file, output_file, dependency_processor):
output_file.write(line)
if line.startswith("install_requires"):
break
while (line := input_file.readline()) and not line.isspace():
dependency_processor(line, output_file)
while (line := input_file.readline()) and not line.startswith("["):
if line.isspace():
output_file.write(line)
else:
dependency_processor(line, output_file)
output_file.write(line)
while line := input_file.readline():
output_file.write(line)


def strip_comment(line: str):
split = line.split("#", 1)
split = line.rstrip("\n").split("#", 1)
return split[0], (split[1] if len(split) > 1 else None)


def write_with_comment(comment, text, output_file):
output_file.write(text)
if comment:
output_file.write("#" + comment)
output_file.write(" #" + comment)
output_file.write("\n")


Expand All @@ -88,7 +91,7 @@ def update_setup_cfg_line(version_map: dict[str, str], line, output_file):

write_with_comment(
comment,
f" {normalized_name} @ {version_map[normalized_name]}",
f" {normalized_name} == {version_map[normalized_name]}",
output_file,
)
else:
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/pre_release_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ on:
jobs:
pin_dependency_versions:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
steps:
- name: Setup Python
uses: actions/setup-python@v5
Expand All @@ -28,11 +30,19 @@ jobs:
MSG=$(.github/workflows/pin_versions.py)
echo "COMMIT_MESSAGE=\"$MSG\"" >> "$GITHUB_OUTPUT"
- name: Add setup.cfg
run: git add setup.cfg
run: |
git add setup.cfg
- name: Commit changes
run: |
git config --global user.name "GitHub Workflow"
git config --global user.email "[email protected]"
git commit -m ${{steps.pin_versions.outputs.COMMIT_MESSAGE}}
git tag ${{inputs.tagName}}
git push origin ${{inputs.tagName}}
- name: Create Release
run: gh release create --generate-notes --draft ${{inputs.tagName}}
- name: Edit Release Notes
run: |
echo -e "${{ steps.pin_versions.outputs.COMMIT_MESSAGE }}\n\n" > "$RUNNER_TEMP/relnotes.txt"
gh release view ${{ inputs.tagName }} | sed '0,/^--$/d' >> "$RUNNER_TEMP/relnotes.txt"
gh release edit ${{ inputs.tagName }} --notes-file "$RUNNER_TEMP/relnotes.txt"
42 changes: 21 additions & 21 deletions .github/workflows/test_data/setup.cfg.pinned
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,28 @@ packages = find:
package_dir =
=src
install_requires =
bluesky @ 1.12.0
pyepics @ 3.5.2
blueapi @ 0.3.15
flask-restful @ 0.3.10
ispyb @ 10.0.0
scanspec @ 0.6.5
numpy @ 1.26.3
nexgen @ 0.8.4
opentelemetry-distro @ 0.43b0
opentelemetry-exporter-jaeger @ 1.21.0
ophyd @ 1.9.0
semver @ 3.0.2
bluesky == 1.12.0
pyepics == 3.5.2
blueapi == 0.3.15
flask-restful == 0.3.10
ispyb == 10.0.0
scanspec == 0.6.5
numpy == 1.26.3
nexgen == 0.8.4
opentelemetry-distro == 0.43b0
opentelemetry-exporter-jaeger == 1.21.0
ophyd == 1.9.0
semver == 3.0.2
# For databroker
humanize @ 4.9.0
pandas @ 2.2.0
xarray @ 2024.1.1
doct @ 1.1.0
databroker @ 1.2.5
dls-dodal @ 1.13.1
pydantic<2.0 # See https://github.com/DiamondLightSource/hyperion/issues/774
scipy @ 1.12.0
pyzmq<25 # See https://github.com/DiamondLightSource/hyperion/issues/1103
humanize == 4.9.0
pandas == 2.2.0
xarray == 2024.1.1
doct == 1.1.0
databroker == 1.2.5
dls-dodal == 1.13.1
pydantic == 1.10.14 # See https://github.com/DiamondLightSource/hyperion/issues/774
scipy == 1.12.0
pyzmq == 25.1.2 # See https://github.com/DiamondLightSource/hyperion/issues/1103

[options.entry_points]
console_scripts =
Expand Down
27 changes: 18 additions & 9 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,37 @@ packages = find:
package_dir =
=src
install_requires =
bluesky
pyepics
blueapi
#
# If a constraint is not set here or if the dependency is pinned to a hash
# it will be auto-pinned to the latest release version by the pre-release workflow
#
flask-restful
ispyb
scanspec
numpy
nexgen>=0.9.1
opentelemetry-distro
opentelemetry-exporter-jaeger
ophyd
semver
# For databroker
humanize
pandas
xarray
doct
databroker
dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git
pydantic<2.0 # See https://github.com/DiamondLightSource/hyperion/issues/774
scipy
pyzmq
scanspec
numpy
pyepics
ispyb
nexgen
#
# These dependencies may be issued as pre-release versions and should have a pin constraint
# as by default pip-install will not upgrade to a pre-release.
#
ophyd == 1.9.0
ophyd-async >= 0.3a3
bluesky >= 1.13.0a3
blueapi >= 0.4.3-a1
dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git

[options.entry_points]
console_scripts =
Expand Down

0 comments on commit d140662

Please sign in to comment.