Closed rjaiser closed 1 week ago
Thanks for this Ralf. I'll have a look. I thought I had set habanero up so bibtexparser is optional, but I guess it's only optional if you don't use the default format
value of "bibtex"
My guess is that you need to check the version of bibtexparser or the availability of bibtexparser.parse_string()
and bibtexparser.write_string()
. Both functions are only available in the v2 branch of bibtexparser. At the moment you are just checking if bibtexparser is available at all, but you need a specific feature that is not in every version. Since v2 is not yet the stable branch, anyone installing it from pip or conda will get v1. And as I said, v2 and v1 are not compatible. In my case, I have a valid bibtex input, so I do not need to fix_bibtex()
. Actually, this is because the input comes from bibtexparser v1 🤷♂️
Sorry, the last two sentences do not make sense. It runs into bibtexparser v1 afterwards.
@rjaiser sorry for delay.
See change in commit above.
I'm not sure if that change is a good approach with respect to checking bibtexparser
version or if we should maybe throw a warning about a version < 2 - I left an approach commented out below that change - but then every run of content negitation would throw a warning which seems annoying. Any ideas?
According to https://docs.python.org/3/library/warnings.html warnings should not be repeated, right?
Basically, this would have been my idea: Issue a warning if bibtexparser is not available or not present in the right version, but let it run through in good hope that there are no problems with the acquired bibtex content. As I mentioned for my use case, it works with habanero 1.2.3, when bibtexparser was not yet implemented. I guess you had a good reason to implement it. You could go the hard way and make bibtextparser>=2 a dependency for habanero>1.2.3 (or whatever version). That would be a clean and easy way?
I am sorry that I cannot help more, as I am not familiar with the best practices around version checking. Unfortunately, I wasn't able to do a quick and dirty test on your new code either, as it threw more errors at me - surely because I did something wrong.
ok, closing this out. I removed bibtexparser as a required dependency - now is an optional dependency, and if used v2 is required, so standard install of habanero doesn't use bibtexparser at all.
Hi
the integration of bibtexparser can lead to conflicts. As default pip and conda install v1 of bibtexparser. By default pip and conda install v1 of bibtexparser. Unfortunately,
bibtexparser.parse_string
is only available in v2 of bibtexparser. More problematically, v1 and v2 are not compatible. If someone is using bibtexparser v1 in their own project, and also using habanero, they will have to stick with versions prior to 1.2.6.Thanks for looking into this Ralf