plone / plone/repoplone

Better error message when passing an invalid version to deps upgrade

Open
#84 0 comments 0 reactions 1 assignee View on GitHub

@ericof is already working on this.

Since Jul 6, 2026.

Dominant language
Python
Stars
5
Forks
2
Avg merge
9m
Merged PRs (30d)
1

Description

Passing an invalid version to deps upgrade (uvx repoplone deps upgrade frontend 2.0.0b3) will display the entire traceback. We should handle that in a better way

╭─────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ───────────────────────────────────────────────────────────────────────╮
│ /Users/ericof/Library/Caches/uv/archive-v0/bn2rc6wXFenQTlCJ/lib/python3.14/site-packages/repoplone/commands/dependencies/__init__.py:206 in upgrade                             │
│                                                                                                                                                                                 │
│   203 │   package_title = f"{package_name} ({component.title()})"                                                                                                               │
│   204 │   if version != current_version:                                                                                                                                        │
│   205 │   │   typer.echo(f"Upgrade {package_title} from {current_version} to {version}")                                                                                        │
│ ❱ 206 │   │   if upgrade_func(settings, version):                                                                                                                               │
│   207 │   │   │   typer.echo(f"- {package_title} at version {version}.")                                                                                                        │
│   208 │   │   │   _sync_dependencies(settings, component)                                                                                                                       │
│   209 │   │   else:                                                                                                                                                             │
│                                                                                                                                                                                 │
│ /Users/ericof/Library/Caches/uv/archive-v0/bn2rc6wXFenQTlCJ/lib/python3.14/site-packages/repoplone/commands/dependencies/__init__.py:76 in _upgrade_frontend                    │
│                                                                                                                                                                                 │
│    73 def _upgrade_frontend(settings: t.RepositorySettings, version: str) -> bool:                                                                                              │
│    74 │   """Upgrade a base dependency to a newer version."""                                                                                                                   │
│    75 │   package_name: str = settings.frontend.base_package                                                                                                                    │
│ ❱  76 │   return dependencies.update_frontend_base_package(settings, package_name, version)                                                                                     │
│    77                                                                                                                                                                           │
│    78                                                                                                                                                                           │
│    79 def _sync_dependencies(settings: t.RepositorySettings, component: str):                                                                                                   │
│                                                                                                                                                                                 │
│ /Users/ericof/Library/Caches/uv/archive-v0/bn2rc6wXFenQTlCJ/lib/python3.14/site-packages/repoplone/utils/dependencies/frontend.py:157 in update_base_package                    │
│                                                                                                                                                                                 │
│   154 │   │   pass                                                                                                                                                              │
│   155 │   else:                                                                                                                                                                 │
│   156 │   │   func = _update_version_mrs_developer                                                                                                                              │
│ ❱ 157 │   status = func(settings, package_name, version)                                                                                                                        │
│   158 │   return status                                                                                                                                                         │
│   159                                                                                                                                                                           │
│                                                                                                                                                                                 │
│ /Users/ericof/Library/Caches/uv/archive-v0/bn2rc6wXFenQTlCJ/lib/python3.14/site-packages/repoplone/utils/dependencies/frontend.py:120 in _update_version_mrs_developer          │
│                                                                                                                                                                                 │
│   117 │   if current_version != version:                                                                                                                                        │
│   118 │   │   if current_version_raw != current_version:                                                                                                                        │
│   119 │   │   │   # Use Python version format                                                                                                                                   │
│ ❱ 120 │   │   │   version = v_utils.convert_node_python_version(version)                                                                                                        │
│   121 │   │   checkout_entry["tag"] = version                                                                                                                                   │
│   122 │   │   _save_mrs_developer(frontend_root_path, data)                                                                                                                     │
│   123 │   │   return True                                                                                                                                                       │
│                                                                                                                                                                                 │
│ /Users/ericof/Library/Caches/uv/archive-v0/bn2rc6wXFenQTlCJ/lib/python3.14/site-packages/repoplone/utils/versions/__init__.py:63 in convert_node_python_version                 │
│                                                                                                                                                                                 │
│    60 │   :return: a PyPI version                                                                                                                                               │
│    61 │   """                                                                                                                                                                   │
│    62 │   # Parse the semver version                                                                                                                                            │
│ ❱  63 │   parsed = semver.Version.parse(version)                                                                                                                                │
│    64 │   major = parsed.major                                                                                                                                                  │
│    65 │   minor = parsed.minor                                                                                                                                                  │
│    66 │   patch = parsed.patch                                                                                                                                                  │
│                                                                                                                                                                                 │
│ /Users/ericof/Library/Caches/uv/archive-v0/bn2rc6wXFenQTlCJ/lib/python3.14/site-packages/semver/version.py:644 in parse                                                         │
│                                                                                                                                                                                 │
│   641 │   │   else:                                                                                                                                                             │
│   642 │   │   │   match = cls._REGEX.match(version)                                                                                                                             │
│   643 │   │   if match is None:                                                                                                                                                 │
│ ❱ 644 │   │   │   raise ValueError(f"{version} is not valid SemVer string")                                                                                                     │
│   645 │   │                                                                                                                                                                     │
│   646 │   │   matched_version_parts: Dict[str, Any] = match.groupdict()                                                                                                         │
│   647 │   │   if not matched_version_parts["minor"]:                                                                                                                            │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: 2.0.0b3 is not valid SemVer string

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.