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

bibtexparser integration #185

Closed
rjaiser opened this issue Jun 25, 2024 · 6 comments
Closed

bibtexparser integration #185

rjaiser opened this issue Jun 25, 2024 · 6 comments
Milestone

Comments

@rjaiser
Copy link

rjaiser commented Jun 25, 2024

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

@sckott
Copy link
Owner

sckott commented Jun 26, 2024

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"

@rjaiser
Copy link
Author

rjaiser commented Jun 27, 2024

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 🤷‍♂️

@rjaiser
Copy link
Author

rjaiser commented Jun 27, 2024

Sorry, the last two sentences do not make sense. It runs into bibtexparser v1 afterwards.

@sckott sckott added this to the v2.0 milestone Jul 28, 2024
@sckott
Copy link
Owner

sckott commented Jul 28, 2024

@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?

@sckott sckott closed this as completed Jul 28, 2024
@sckott sckott reopened this Jul 28, 2024
@rjaiser
Copy link
Author

rjaiser commented Jul 31, 2024

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.

sckott added a commit that referenced this issue Nov 25, 2024
…imum, skip fixing bibtex if vers not > 2 just in case
@sckott
Copy link
Owner

sckott commented Nov 25, 2024

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.

@sckott sckott closed this as completed Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants