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

Empty tool.bumpversion.files section in pyproject.toml causes stack trace. #312

Closed
rob-smallshire opened this issue Mar 7, 2025 · 1 comment · Fixed by #314
Closed
Labels
bug Something isn't working

Comments

@rob-smallshire
Copy link

If pyproject.toml contains an empty [[tool.bumpversion.files]] section, the following stack trace results,

Traceback (most recent call last):
  File "/root/.cache/uv/archive-v0/4wZfeXLnnHN7-t_-H-Y3f/bin/bump-my-version", line 12, in <module>
    sys.exit(cli())
             ^^^^^
  File "/root/.cache/uv/archive-v0/4wZfeXLnnHN7-t_-H-Y3f/lib/python3.11/site-packages/rich_click/rich_command.py", line 367, in __call__
    return super().__call__(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.cache/uv/archive-v0/4wZfeXLnnHN7-t_-H-Y3f/lib/python3.11/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.cache/uv/archive-v0/4wZfeXLnnHN7-t_-H-Y3f/lib/python3.11/site-packages/rich_click/rich_command.py", line 152, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/root/.cache/uv/archive-v0/4wZfeXLnnHN7-t_-H-Y3f/lib/python3.11/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.cache/uv/archive-v0/4wZfeXLnnHN7-t_-H-Y3f/lib/python3.11/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.cache/uv/archive-v0/4wZfeXLnnHN7-t_-H-Y3f/lib/python3.11/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.cache/uv/archive-v0/4wZfeXLnnHN7-t_-H-Y3f/lib/python3.11/site-packages/bumpversion/cli.py", line 307, in bump
    do_bump(version_part, new_version, config, found_config_file, dry_run)
  File "/root/.cache/uv/archive-v0/4wZfeXLnnHN7-t_-H-Y3f/lib/python3.11/site-packages/bumpversion/bump.py", line 109, in do_bump
    modify_files(configured_files, version, next_version, ctx, dry_run)
  File "/root/.cache/uv/archive-v0/4wZfeXLnnHN7-t_-H-Y3f/lib/python3.11/site-packages/bumpversion/files.py", line 269, in modify_files
    f.make_file_change(current_version, new_version, context, dry_run)
  File "/root/.cache/uv/archive-v0/4wZfeXLnnHN7-t_-H-Y3f/lib/python3.11/site-packages/bumpversion/files.py", line 182, in make_file_change
    if not os.path.exists(self.file_change.filename):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen genericpath>", line 19, in exists
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType
@coordt
Copy link
Member

coordt commented Mar 7, 2025

Ooops! Guess I missed a test case. Thanks for bringing this up.

@coordt coordt added the bug Something isn't working label Mar 7, 2025
coordt added a commit that referenced this issue Mar 8, 2025
Consolidated and restructured tests for `modify_files` into classes for better organization and clarity. Fixed an issue where empty file configurations were not properly ignored and enhanced filtering logic in configuration handling.

Fixes #312
@coordt coordt mentioned this issue Mar 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants