Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Using bibtexparser instead of pybtex for bibtex. #3740
Using bibtexparser instead of pybtex for bibtex. #3740
Changes from 11 commits
fb6075a
9e3d7ed
210bfc7
0d377c8
b67b9c2
07306e3
558f262
4c3ed06
5aa706b
ab745c3
d25cde0
ab99ac8
fe5dc3b
b6662c5
f8dce39
d43f02e
a71ce1d
98121fc
c43805d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does
bibtexparser
also have some attribute corresponding toPybtexError
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it doesn't. The only thing close to exception handling in bibtexparser is this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should remove this option currently. Is there a way to convert to BibTeX, and if there isn't, is it possible that such a way be devised?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we can convert it into bibtex.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not be removed unless it is necessary to do so since this counts as a breaking change. I don't mind it a lot though since this is not a commonly used feature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing that we can do now is having an additional option like
filtered_output
along withbibtex
. This option can print the essential hardcoded values (inside init) which might lead to data loss but we can provide much cleaner output if that's what user is more concerned about. Additionally we can also have a optionraw
which outputs the parsed bibtex as is (which is out only current output).With this we can solve both problems. Not having data loss and also providing cleaner output.
Check warning on line 244 in pybamm/citations.py
pybamm/citations.py#L244
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage is failing as this is not covered by tests, would be nice to add some test case covering this part too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, and a helpful error message would be nice as well – a
TypeError
in itself is not descriptive enoughThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if we can test this –
pybtex
is quite inactive and did not work on Google Colab, butbibtexparser
might work wellThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try this out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be removed now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did have to think a bit about this because it wasn't really prominent in the first read. We are using the
assertRaisesRegex
context manager clause to test theModuleNotFoundError
message, andpybamm.print_citations
used to call thehave_optional_dependency
utility function forpybtex
, which was removed – which means that the function is not called and subsequently an error was not raised.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is the case indeed. If you feel this should be changed to some other stable optional dependency then it can also be looked into.