LLNL / scraper

Python library for getting metadata from source code hosting tools
MIT License
49 stars 23 forks source link

Call in Python not command line #69

Open stuchalk opened 1 year ago

stuchalk commented 1 year ago

Can you add documentation how to call scraper in Python code rather than the command line? This would be very helpful for a new project I am working on that goes even further than this - which is awesome by the way...:)

leebrian commented 1 year ago

I don't know how useful or generally desired that is as the tool is intended to be called from the command line.

If you want to call it from another python program, you can look at the main method in the package and invoke the parts you would like to use, https://github.com/LLNL/scraper/blob/aabc24fbe6e38d8de996fc40b5fdc8b2bd9b24b9/scraper/gen_code_gov_json.py#L15

stuchalk commented 1 year ago

Thanks for quick reply. Took a quick look at main and I will see what I can do. Would you consider a PR to add this functionality?

leebrian commented 1 year ago

Definitely, I think a PR that refactors this to be more program callable would be nice. It should be possible to refactor this and keep the command line functionality the same.

stuchalk commented 1 year ago

OK, I will fork the repo and work on it.

IanLee1521 commented 1 year ago

@stuchalk just to chime in with @leebrian -- yes, would definitely consider a PR that changes things around, but at a glance if you didn't want to do that, I think this is the meat you'd be looking for:

https://github.com/LLNL/scraper/blob/aabc24fbe6e38d8de996fc40b5fdc8b2bd9b24b9/scraper/gen_code_gov_json.py#L141-L154