diff --git a/.github/scripts/check_template_versions.py b/.github/scripts/check_template_versions.py index 9cdf010..9311116 100644 --- a/.github/scripts/check_template_versions.py +++ b/.github/scripts/check_template_versions.py @@ -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: @@ -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) @@ -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 ' diff --git a/.github/workflows/compatibility.yml b/.github/workflows/compatibility.yml index 3779c46..84fa5bb 100644 --- a/.github/workflows/compatibility.yml +++ b/.github/workflows/compatibility.yml @@ -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: @@ -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 diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 2b1d214..15dd738 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -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: @@ -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 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4291bb9..2c0539b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 diff --git a/AGENTS.md b/AGENTS.md index e168ffb..00adc33 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -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. diff --git a/README.rst b/README.rst index af3b819..d579d43 100644 --- a/README.rst +++ b/README.rst @@ -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 ======= diff --git a/pyproject.toml b/pyproject.toml index 8ea4105..65e7974 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 ]