Skip to content

Conversation

@agamm
Copy link
Owner

@agamm agamm commented Aug 12, 2025

Adds save_to_json() method to JobResult for easy JSON saving.

Changes:

  • New JobResult.save_to_json(filepath, indent=2) method
  • Updated README with usage examples
  • Added comprehensive test
  • Minimal implementation using existing to_dict()

Usage:
for result in results['completed']:
result.save_to_json(f'output/{result.job_id}.json')

Benefits:

  • Handles Citation serialization automatically
  • Creates directories as needed
  • Simple and pythonic API

agamm added 2 commits August 11, 2025 20:02
- Add simple save_to_json() method that handles Citation serialization automatically
- Creates directories as needed and uses existing to_dict() method internally
- Updated README.md with usage examples
- Added comprehensive test with tmp_path fixture
- Minimal code addition (~10 lines) for maximum user convenience

Fixes the need for users to manually handle Citation serialization when saving results.
- Remove unused __json__() method from Citation class
- Remove unused BatchataJSONEncoder and json_encoder.py file
- Clean up utils/__init__.py imports
- Revert version back to 0.4.4 (no version bump yet)
- Keep minimal, clean save_to_json() implementation
@agamm agamm merged commit 4dad1b1 into main Aug 12, 2025
1 check passed
@agamm agamm deleted the feature/job-result-save-json branch August 12, 2025 01:11
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 this pull request may close these issues.

2 participants