Skip to content

file extensions in Save() and Load() methods are optional#728

Merged
manuschneider merged 4 commits intomasterfrom
file_extension
Apr 1, 2026
Merged

file extensions in Save() and Load() methods are optional#728
manuschneider merged 4 commits intomasterfrom
file_extension

Conversation

@manuschneider
Copy link
Copy Markdown
Collaborator

Fixes #727.

If no file extension is given, the standard extension for the corresponding object type is added to the filename.

This is backwards compatible with the previous behavior but allows to use custom file extensions and call Save() and Load() with the exact same arguments.

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 5, 2025

Codecov Report

❌ Patch coverage is 8.69565% with 42 lines in your changes missing coverage. Please review.
✅ Project coverage is 35.47%. Comparing base (fa015d4) to head (42e86b1).
⚠️ Report is 19 commits behind head on master.

Files with missing lines Patch % Lines
src/backend/Storage.cpp 0.00% 10 Missing ⚠️
src/Symmetry.cpp 0.00% 8 Missing ⚠️
src/Tensor.cpp 12.50% 7 Missing ⚠️
src/tn_algo/MPS.cpp 0.00% 7 Missing ⚠️
src/Bond.cpp 0.00% 6 Missing ⚠️
src/UniTensor.cpp 42.85% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #728      +/-   ##
==========================================
+ Coverage   35.44%   35.47%   +0.02%     
==========================================
  Files         215      214       -1     
  Lines       33071    33007      -64     
  Branches    13170    13130      -40     
==========================================
- Hits        11723    11709      -14     
+ Misses      19424    19376      -48     
+ Partials     1924     1922       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Collaborator

@IvanaGyro IvanaGyro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest deprecate the feature that automatically adds file extension while saving and keep the function for loading unchanged. Automatically appending file extension while saving and loading files is uncommon practice.

Additionally, can you squash the two commits in this PR?

@manuschneider
Copy link
Copy Markdown
Collaborator Author

I suggest deprecate the feature that automatically adds file extension while saving and keep the function for loading unchanged. Automatically appending file extension while saving and loading files is uncommon practice.

I thought it might actually be handy to just provide the base name and cytnx will add the common extension for this type of object. We can have a separate issue on deprecating this, but this might affect basically all unit tests.

Additionally, can you squash the two commits in this PR?

How do I best squash them with git?

@IvanaGyro
Copy link
Copy Markdown
Collaborator

How do I best squash them with git?

Using git rebase -i is the most intuitive way. See: https://stackoverflow.com/a/5189600

if no file extension is given, the standard extension for the corresponding object type is added to the filename
this is backwards compatible with the previous behavior but allows to use custom file extensions and call Save() and Load() with the exact same arguments
@manuschneider manuschneider added this to the v1.1.0 milestone Dec 11, 2025
Comment thread src/backend/Storage.cpp
Comment thread src/tn_algo/MPS.cpp Outdated
added file endings to all filenames when Save is used
corrected include order
@manuschneider manuschneider added the Pending check/approval Issue fixed, and need feedback label Apr 1, 2026
@manuschneider manuschneider merged commit 22aab5f into master Apr 1, 2026
6 of 7 checks passed
@manuschneider manuschneider deleted the file_extension branch April 1, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Pending check/approval Issue fixed, and need feedback

Projects

None yet

Development

Successfully merging this pull request may close these issues.

File extension with Save and Load

2 participants