MicheleCotrufo / pdf2doi

A python library/command-line tool to extract the DOI or other identifiers of a scientific paper from a pdf file.
101 stars 18 forks source link

Make config file optional #30

Open benmuth opened 5 months ago

benmuth commented 5 months ago

This fixes #29.

Problems this solves:

Hopefully this doesn't break any use-cases/workflows. Let me know if there's anything you're skeptical about.

MicheleCotrufo commented 3 months ago

Hey, sorry that it took me so long to look at this. I was looking at your suggested code, and I noticed that you moved the call of the function config.ReadParamsINIfile(config_path) to the main() function inside the main.py file. This should work well when pdf2doi is invoked via command line, but I'm not sure if it would work well when pdf2doi is used as a library by other scripts (for example, from pdf2bib or pdf-renamer. Can you run some test?

benmuth commented 3 months ago

When pdf2doi is used as a library, I think the calling code can just call pdf2doi.config.ReadParamsINIfile(config_path) during initialization (for instance, just before where pdf2bib and pdf-renamer are calling pdf2doi.config.set right now).

MicheleCotrufo commented 3 weeks ago

When pdf2doi is used as a library, I think the calling code can just call pdf2doi.config.ReadParamsINIfile(config_path) during initialization (for instance, just before where pdf2bib and pdf-renamer are calling pdf2doi.config.set right now).

Yes, but this would break backward compatibility (i.e. scripts made for previous versions of pdf2doi would not work anymore)