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

Fix JSON serialization #223

Merged
merged 3 commits into from
Aug 11, 2024
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
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# Changelog

## Unreleased (2024-08-08)
[Compare the full difference.](https://github.com/callowayproject/bump-my-version/compare/0.25.1...HEAD)

### Fixes

- Fix JSON serialization. [d3f3022](https://github.com/callowayproject/bump-my-version/commit/d3f3022bd4c8b8d6e41fa7b5b6ccfc2aa6cf7878)

Extended the default_encoder function to handle Path objects by converting them to their string representation. This ensures that Path objects can be properly serialized to JSON format.

## 0.25.1 (2024-08-07)
[Compare the full difference.](https://github.com/callowayproject/bump-my-version/compare/0.25.0...0.25.1)

### Fixes

- Fixes mypy pre-commit checking. [f7d0909](https://github.com/callowayproject/bump-my-version/commit/f7d0909deb8d0cf06607c4d51090ca23f7d92664)

- Fixes repository path checks. [ff3f72a](https://github.com/callowayproject/bump-my-version/commit/ff3f72a9a922dfbb61eea9325fc9dba7c12c7f62)

Checked for relative paths when determining if the file was part of the repo or not.
- Fixed test to use globs. [72f9841](https://github.com/callowayproject/bump-my-version/commit/72f9841a9628e26c6cf06518b0428d3990a08421)

### Other

- [pre-commit.ci] pre-commit autoupdate. [58cc73e](https://github.com/callowayproject/bump-my-version/commit/58cc73ed041f978fddd9f81e995901596f6ac722)

**updates:** - [github.com/astral-sh/ruff-pre-commit: v0.5.5 → v0.5.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.5...v0.5.6)


## 0.25.0 (2024-08-06)
[Compare the full difference.](https://github.com/callowayproject/bump-my-version/compare/0.24.3...0.25.0)

Expand Down
2 changes: 1 addition & 1 deletion bumpversion/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Top-level package for bump-my-version."""

__version__: str = "0.25.0"
__version__: str = "0.25.1"
3 changes: 3 additions & 0 deletions bumpversion/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import dataclasses
from io import StringIO
from pathlib import Path
from pprint import pprint
from typing import Any, Optional

Expand Down Expand Up @@ -39,6 +40,8 @@
return str(obj)
elif isinstance(obj, type):
return obj.__name__
elif isinstance(obj, Path):
return str(obj)

Check warning on line 44 in bumpversion/show.py

View check run for this annotation

Codecov / codecov/patch

bumpversion/show.py#L44

Added line #L44 was not covered by tests
raise TypeError(f"Object of type {type(obj), str(obj)} is not JSON serializable")

print_info(json.dumps(value, sort_keys=True, indent=2, default=default_encoder))
Expand Down
Loading