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

Reproducibility Feature by Adding python_version #172

Merged
merged 7 commits into from Jan 6, 2023

Conversation

sadrasabouri
Copy link
Collaborator

Reference Issues/PRs

#171

What does this implement/fix? Explain your changes.

This PR added the python_version attributes to the GenerativeImage object which is saved in both config and data files. At the same time, loading these files Python version would be checked to see if it's the same as the current Python version.

@sadrasabouri sadrasabouri added bug Something isn't working enhancement New feature or request labels Dec 19, 2022
@sadrasabouri sadrasabouri added this to the samila v1.1 milestone Dec 19, 2022
@sadrasabouri sadrasabouri self-assigned this Dec 19, 2022
@sadrasabouri
Copy link
Collaborator Author

@sepandhaghighi please take a look at this PR.

Copy link
Owner

@sepandhaghighi sepandhaghighi left a comment

Choose a reason for hiding this comment

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

@sadrasabouri Please take a look at my comments 💯
And also I suggest adding a test to overall_test.py and checking python_version, something like this:

>>> g.python_version == sys.version.split()[0]
True

self.matplotlib_version),
VERSION_WARNING.format(
self.matplotlib_version,
get_python_version()),
Copy link
Owner

Choose a reason for hiding this comment

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

I think it should be self.python_version

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You are right

@@ -13,12 +13,20 @@
>>> g_.data2 == g.data2
True
>>> with open('data.json', 'w') as fp:
... json.dump({'data1': [0], 'data2': [0], 'python_version': '0'}, fp)
>>> with warns(RuntimeWarning, match=r"Source matplotlib version(.*) or Python version(.*) is different from yours, plots may be different."):
... g = GenerativeImage(lambda x,y: 0, lambda x,y: 0, data=open('data.json', 'r'))
Copy link
Owner

Choose a reason for hiding this comment

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

g = GenerativeImage(data=open('data.json', 'r'))

... json.dump({'data1': [0], 'data2': [0], 'matplotlib_version': '0'}, fp)
>>> with warns(RuntimeWarning, match=r"Source matplotlib version(.*) is different from yours, plots may be different."):
>>> with warns(RuntimeWarning, match=r"Source matplotlib version(.*) or Python version(.*) is different from yours, plots may be different."):
... g = GenerativeImage(lambda x,y: 0, lambda x,y: 0, data=open('data.json', 'r'))
Copy link
Owner

Choose a reason for hiding this comment

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

g = GenerativeImage(data=open('data.json', 'r'))

@codecov-commenter
Copy link

Codecov Report

Merging #172 (628502b) into dev (7e66936) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##               dev      #172   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines          575       587   +12     
  Branches        88        90    +2     
=========================================
+ Hits           575       587   +12     
Impacted Files Coverage Δ
samila/functions.py 100.00% <100.00%> (ø)
samila/genimage.py 100.00% <100.00%> (ø)
samila/params.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Owner

@sepandhaghighi sepandhaghighi left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@sepandhaghighi sepandhaghighi merged commit a9e2323 into dev Jan 6, 2023
@sepandhaghighi sepandhaghighi deleted the reproducibility branch January 6, 2023 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants