haasad / EcoInventDownLoader

Download, unpack and import ecoinvent into your brightway2 project in one simple step
MIT License
13 stars 6 forks source link

add auto_write option to get_ecoinvent #5

Closed pjamesjoyce closed 6 years ago

pjamesjoyce commented 6 years ago

Hi Adrian,

This is an excellent and extremely useful utility for Brightway!

Just a small pull request to add an option to automatically write the database (if there are no unlinked processes), without asking the user.

I think eidl would be a really good way to make setting up lcopt to speak to Brightway foolproof by forcing the user to download and install the 'right' version of ecoinvent. Adding the auto_write option allows a partial function to do it on one go. e.g.:

from functools import partial

auto_ecoinvent = partial(eidl.get_ecoinvent, db_name='Ecoinvent3_3_cutoff', auto_write=True, version='3.3', system_model='cutoff')

auto_ecoinvent(username='username', password='password') # password can be encrypted environment variable for CI testing

#or just

auto_ecoinvent() # and enter credentials when prompted
pjamesjoyce commented 6 years ago

Sorry - just spotted #2... Looks like you're already on this!

haasad commented 6 years ago

Hi James,

thanks a lot for this PR! I'm sorry that it took me so long to react, I was doing military service for the last four weeks. PR is merged and the new version is on my channel.