Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions .github/scripts/check_template_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,18 @@ def minor(version: str) -> tuple:
return tuple(int(p) for p in version.split('.')[:2])


VERSION = re.compile(r'(\d+)\.(\d+)\.(\d+)(?:(a|b|rc)(\d+))?') # releases and their a/b/rc pre-releases
PRE_RANK = {'a': 0, 'b': 1, 'rc': 2, None: 3}


def is_release(version: str) -> bool:
return re.fullmatch(r'\d+\.\d+\.\d+', version) is not None
"""A final release or an alpha/beta/rc (not .dev or .post): pre-releases count while a new minor is not final"""
return VERSION.fullmatch(version) is not None


def version_key(version: str) -> tuple:
major, minor_, patch, pre, number = VERSION.fullmatch(version).groups()
return int(major), int(minor_), int(patch), PRE_RANK[pre], int(number or 0)


def python_minors(classifiers: list) -> list:
Expand All @@ -47,11 +57,11 @@ def main() -> int:

floors = {}
for dep in project['dependencies']:
match = re.match(r'(pymodaq(?:_utils|_gui|_data)?)>=(\d+\.\d+\.\d+)', dep)
match = re.match(r'(pymodaq(?:_utils|_gui|_data)?)>=(\d+\.\d+\.\d+(?:(?:a|b|rc)\d+)?)', dep)
if match:
floors[match.group(1)] = match.group(2)
if 'pymodaq' not in floors:
problems.append('pyproject.toml has no "pymodaq>=X.Y.Z" dependency: nothing to compare to')
problems.append('pyproject.toml has no "pymodaq>=X.Y.Z" (or X.Y.ZaN) dependency: nothing to compare to')
return report(problems)
branch_minor = minor(floors['pymodaq'])
branch = '{}.{}'.format(*branch_minor)
Expand All @@ -68,7 +78,7 @@ def main() -> int:

# 2. a new PyMoDAQ minor means a new template branch
latest = pypi_info('pymodaq')
versions = sorted((v for v in latest['releases'] if is_release(v)), key=lambda v: tuple(map(int, v.split('.'))))
versions = sorted((v for v in latest['releases'] if is_release(v)), key=version_key)
newest = versions[-1]
if minor(newest) > branch_minor:
problems.append(f'PyMoDAQ {newest} is out but this template targets {branch}.x: create the {"{}.{}".format(*minor(newest))}.x '
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/compatibility.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Everything is defined once in PyMoDAQ/pymodaq_plugins_template (reusable-*.yml). The template is never released, so the ref after @ is its 5.3.x branch.
# Everything is defined once in PyMoDAQ/pymodaq_plugins_template (reusable-*.yml). The template is never released, so the ref after @ is its 5.4.x branch.
name: Compatibility with pymodaq (latest release)

on:
Expand All @@ -12,4 +12,4 @@ concurrency:

jobs:
compatibility:
uses: PyMoDAQ/pymodaq_plugins_template/.github/workflows/reusable-compatibility.yml@5.3.x
uses: PyMoDAQ/pymodaq_plugins_template/.github/workflows/reusable-compatibility.yml@5.4.x
4 changes: 2 additions & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Everything is defined once in PyMoDAQ/pymodaq_plugins_template (reusable-*.yml). The template is never released, so the ref after @ is its 5.3.x branch.
# Everything is defined once in PyMoDAQ/pymodaq_plugins_template (reusable-*.yml). The template is never released, so the ref after @ is its 5.4.x branch.
name: Upload Python Package

on:
Expand All @@ -7,5 +7,5 @@ on:

jobs:
publish:
uses: PyMoDAQ/pymodaq_plugins_template/.github/workflows/reusable-publish.yml@5.3.x
uses: PyMoDAQ/pymodaq_plugins_template/.github/workflows/reusable-publish.yml@5.4.x
secrets: inherit
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Everything is defined once in PyMoDAQ/pymodaq_plugins_template (reusable-*.yml). The template is never released, so the ref after @ is its 5.3.x branch.
# Everything is defined once in PyMoDAQ/pymodaq_plugins_template (reusable-*.yml). The template is never released, so the ref after @ is its 5.4.x branch.
name: Tests

on: [push, pull_request]

jobs:
tests:
uses: PyMoDAQ/pymodaq_plugins_template/.github/workflows/reusable-tests.yml@5.3.x
uses: PyMoDAQ/pymodaq_plugins_template/.github/workflows/reusable-tests.yml@5.4.x
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AGENTS.md

Guidance for AI coding assistants (and humans) building on **PyMoDAQ 5.3.x** from this template.
Guidance for AI coding assistants (and humans) building on **PyMoDAQ 5.4.x** from this template.
PyMoDAQ is a Qt framework that drives lab experiments: hardware is added through small *plugins*, and PyMoDAQ
provides the GUI, threading, data model, scans and HDF5 saving. Python 3.11 to 3.14.

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pymodaq_plugins_template

Use this template to create a repository on your account and start the development of your own PyMoDAQ plugin!

This branch targets **PyMoDAQ 5.3.x** (Python 3.11 to 3.14). Use the branch matching your PyMoDAQ version.
This branch targets **PyMoDAQ 5.4.x** (Python 3.11 to 3.14). Use the branch matching your PyMoDAQ version.

Authors
=======
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ keywords = [
#todo: add the instrument, manufacturer and measurement type (camera, stage, spectrometer...)
]
dependencies = [
"pymodaq>=5.3.7",
"pymodaq_utils>=5.3.1",
"pymodaq_gui>=5.3.0",
"pymodaq_data>=5.3.0",
"pymodaq>=5.4.0a0",
"pymodaq_utils>=5.4.0a0",
"pymodaq_gui>=5.4.0a0",
"pymodaq_data>=5.4.0a0",
#todo: list here all dependencies your package may have
]

Expand Down
Loading