Closed haasad closed 6 years ago
Hi @haasad, there were a couple of reasons, but nothing that would prevent this being an option in theory.
The first reason is that from the docs and examples I gathered it was Brightway2 best practice to keep projects separate. The examples all seem to begin either with a new project being set up, or the Brightway introduction
project being copied.
The second reason is it seemed a bit tidier to keep each lcopt project separate. An .lcopt
file is essentially a blueprint of how to create a brightway project. If you email someone a 6MB lcopt project, they can use it to automatically generate an identical brightway project.
I've been playing with the idea of a config or settings file so that 'power-users' could persistantly change certain options (the first thing in there is a way to save your ecoinvent login). I'll look into having an option in there to choose to save all new lcopt projects as a database in a single project instead of creating a new project every time
Having this option to choose to store all models in a single project would be great.
I saw in your projects tab that you're still deciding where to store the config file. We just had this discussion for the AB and I strongly recommend appdirs: https://github.com/LCA-ActivityBrowser/activity-browser/pull/176. It solves a lot of platform-specific headache and it's also what Chris uses for brightway. I would even suggest to store the models in an appdirs directory instead of the current directory. I can make a small PR for this if you're interested.
Thanks @haasad - appdirs looks like a great option. If you have time to put together a small PR that would be fantastic!
@haasad take a look at the config
branch (still not fully tested so i've not pulled it into dev
yet)
This uses your appdirs PR to add the option to specify in the config file where the lcopt models sent to brightway get put.
The config file is yaml and looks like this:
ecoinvent: # optional
password: super_secret_password # optional
username: my_login # optional
model_storage:
location: appdir # alternative is 'currdir' to keep previous behaviour
project: single # alternative (and default) is 'unique' to create unique projects for each model
single_project_name: My_LCOPT_Projects # optional (defaults to 'LCOPT_Models')
Note: appdirr
vs currdir
isn't implemented yet
Note: appdirr vs currdir isn't implemented yet
It is now, hopefully...
Works flawlessly :+1: This is great, thanks for taking the time to implement this!
Is the user supposed to change the config via text editor or do you plan to add some kind of interface (helper-functions) to change the config values? Maybe it's there and i missed it, but I think both options are fine.
Excellent!
Is the user supposed to change the config via text editor or do you plan to add some kind of interface (helper-functions) to change the config values?
At the moment its only possible via a text editor, but a 'settings' interface is a good idea. I'll start a new issue for that.
Is there a reason why the default project is copied every time I run a new model? Would it be possible to just store the foreground processes as a model-database without copying the background ecoinvent db to a new project?
I feel like the current behaviour is not sustainable concerning disk-space. Eg. just by running the example model once, it uses 1.2 GB: