Releases: JNikolo/valheim-save-tools-py
Releases · JNikolo/valheim-save-tools-py
0.4.1 - 2025-12-02
Fixed
- File-like object reusability - File-like objects can now be reused multiple times without errors
_resolve_input()now saves and restores the original file position after reading- Prevents
BytesIOand other file-like objects from being left at EOF - Allows the same file-like object to be passed to multiple method calls
- File type detection for file-like objects - Automatic detection of file type from filename attributes
- Auto-detects file extension from
.filenameattribute (FastAPIUploadFile, FlaskFileStorage) - Falls back to
.nameattribute (standard Python file objects, DjangoUploadedFile) - Prevents JAR parsing errors when wrong file extension is used
- FastAPI
UploadFilenow fully supported without manual type hints
- Auto-detects file extension from
- File extension preservation - Temp files now created with correct extensions based on input
- Fixes
BufferUnderflowExceptionerrors when passing.fwlor.fchfiles as file-like objects - JAR tool correctly identifies file type from extension
- Fixes
Added
input_file_typeoptional parameter toto_json()for explicit file type hints- Supports
'db','fwl','fch'values - Overrides automatic detection when needed
- Useful when filename attribute has incorrect extension
- Supports
- Comprehensive test coverage for file-like object features
- Added test for file-like object reuse (
test_resolve_input_bytesio_reuse) - Added test for file type hint parameter (
test_to_json_with_file_type_hint) - Added test for FastAPI
UploadFilecompatibility (test_to_json_with_filename_attribute)
- Added test for file-like object reuse (
Changed
_resolve_input()method now includesauto_detect_suffixparameter- Automatically detects file type from
.filenameor.nameattributes - More intelligent temp file creation with correct extensions
- Improved compatibility with web framework upload handlers
- Automatically detects file type from
0.4.0 - 2025-11-24
Added
- File-like object support - All methods now accept file-like objects (BytesIO, file handles) in addition to file paths
to_json(),from_json()- Convert to/from JSON using BytesIOlist_global_keys()- List keys from file-like objectsadd_global_key(),remove_global_key(),clear_all_global_keys()- Modify keys in memoryclean_structures(),reset_world()- Process files in memory- In-place modification support for file-like objects
- Mix file paths and file-like objects in workflows
- New example:
file_like_objects.pydemonstrating in-memory processing - Comprehensive test suite for file-like object support (15 new tests)
- Updated documentation with file-like object examples in README, API docs, and examples
Changed
- Method signatures updated to accept
Union[str, BinaryIO]for file inputs/outputs - Return types updated: methods return
Nonewhen writing to file-like objects - Added
iomodule import for file-like object detection
0.3.0 - 2025-11-23
What's Changed
Added
- New
ValheimItemReaderclass for parsing binary item dataparse_items_from_base64()- Parse base64-encoded inventory data- Binary data reader methods:
read_byte(),read_int32(),read_int64(),read_float(),read_bool(),read_string() read_item()- Parse complete Valheim item structures
- Comprehensive test suite for item reader (19 additional tests)
- Unit tests for all binary parsing methods
- Tests for single and multiple item parsing
- Edge case and error handling tests
- Item reader module exported in public API
Full Changelog: v0.2.0...v0.3.0
0.2.0 - 2025-11-19
Changed
- BREAKING:
to_json()now returns parsed JSON data as a dictionary instead of file path- Both
ValheimSaveTools.to_json()andSaveFileProcessor.to_json()affected - Allows direct access to save file data without additional file I/O
- If
output_fileparameter is provided, still saves to that file - Migration: Replace
path = vst.to_json(...)withdata = vst.to_json(...)
- Both
Fixed
- Fixed
UnboundLocalErrorinto_json()when using explicit output file path - Improved temporary file cleanup in
to_json()method
0.1.0 - 2025-11-16
Added
- Initial release of Valheim Save Tools Python API
- File conversion support (binary ↔ JSON)
to_json()- Convert .db, .fwl, .fch to JSONfrom_json()- Convert JSON back to binary format
- Global keys management
list_global_keys()- List all global keysadd_global_key()- Add boss defeats, events, etc.remove_global_key()- Remove specific keysclear_all_global_keys()- Clear all keys
- Structure processing
clean_structures()- Remove abandoned structuresreset_world()- Reset world to initial state
- Builder pattern support via
SaveFileProcessor- Method chaining for complex operations
- Fluent API:
.process().clean().reset().save()
- Context manager support
- Automatic temp file cleanup
- Exception-safe resource management
- Input validation and error handling
- Custom exceptions (JarNotFoundError, JavaNotFoundError, CommandExecutionError)
- File type validation
- Descriptive error messages
- Static file detection methods
is_db_file(),is_fwl_file(),is_fch_file(),is_json_file()detect_file_type(),is_valheim_file()
- Comprehensive test suite
- 55 tests with 100% pass rate
- Unit tests for all functionality
- Mocked subprocess calls for isolation
- Documentation
- Complete README with examples
- API reference documentation
- Builder pattern guide
- 4 comprehensive example scripts
- Configuration options
- Verbose mode
- Fail on unsupported version
- Skip resolve names
- Custom JAR/Java paths
Features
- Python 3.8+ support
- Type hints throughout codebase
- Auto-detection of bundled JAR file
- Auto-detection of Java runtime
- Cross-platform compatibility (Windows, macOS, Linux)