Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 1.0.0 fails on Python 3.8 with: TypeError: 'type' object is not subscriptable #310

Closed
andy-maier opened this issue Mar 4, 2025 · 1 comment · Fixed by #311
Closed

Comments

@andy-maier
Copy link

andy-maier commented Mar 4, 2025

PR #297 fixed my earlier problem on Python 3.8, but it did that by just adding Python 3.8 as a supported version to package versions 0.32.2 and later.

When using the latest version 1.0.0 on Python 3.8, we encountered the following error:

$ python3 -m bumpversion bump --new-version 25.3.3-a262.dev6 patch --no-tag --no-commit --allow-dirty --verbose
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/jenkins/.local/lib/python3.8/site-packages/bumpversion/__main__.py", line 3, in <module>
    from bumpversion.cli import cli
  File "/home/jenkins/.local/lib/python3.8/site-packages/bumpversion/cli.py", line 12, in <module>
    from bumpversion.bump import do_bump
  File "/home/jenkins/.local/lib/python3.8/site-packages/bumpversion/bump.py", line 6, in <module>
    from bumpversion.hooks import run_post_commit_hooks, run_pre_commit_hooks, run_setup_hooks
  File "/home/jenkins/.local/lib/python3.8/site-packages/bumpversion/hooks.py", line 8, in <module>
    from bumpversion.config.models import Config
  File "/home/jenkins/.local/lib/python3.8/site-packages/bumpversion/config/__init__.py", line 7, in <module>
    from bumpversion.config.files import get_pep621_info, read_config_file
  File "/home/jenkins/.local/lib/python3.8/site-packages/bumpversion/config/files.py", line 9, in <module>
    from bumpversion.config.models import PEP621Info
  File "/home/jenkins/.local/lib/python3.8/site-packages/bumpversion/config/models.py", line 14, in <module>
    from bumpversion.scm.models import SCMInfo  # NOQA: TC001
  File "/home/jenkins/.local/lib/python3.8/site-packages/bumpversion/scm/models.py", line 18, in <module>
    class SCMConfig:
  File "/home/jenkins/.local/lib/python3.8/site-packages/bumpversion/scm/models.py", line 30, in SCMConfig
    moveable_tags: list[str] = field(default_factory=list)
TypeError: 'type' object is not subscriptable

This happened in a Jenkins environment, and I was not able to reproduce it locally. But the source code location that failed at the bottom end of the traceback uses a construct that was introduced only in Python 3.9, according to https://stackoverflow.com/a/75202688/1424462 and https://docs.python.org/3.9/whatsnew/3.9.html#type-hinting-generics-in-standard-collections.

We are currently circumventing the issue by pinning bump-my-version to 0.29.0 on Python 3.8.

I'm afraid I have to pull up my earlier suggestion again to yank the older versions that claim Python 3.8 support but don't work there.

@andy-maier andy-maier changed the title Version 1.0.0 fails on Python 3.8 Version 1.0.0 fails on Python 3.8 with: TypeError: 'type' object is not subscriptable Mar 4, 2025
@coordt
Copy link
Member

coordt commented Mar 5, 2025

This is so frustrating that the 3.8 tests pass with this obvious issue. Fix coming.

@coordt coordt linked a pull request Mar 5, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants