spine-tools / Spine-Toolbox

Spine Toolbox is an open source Python package to manage data, scenarios and workflows for modelling and simulation. You can have your local workflow, but work as a team through version control and SQL databases.
https://www.tools-for-energy-system-modelling.org/
GNU Lesser General Public License v3.0
72 stars 17 forks source link

Updating Toolbox from within the GUI #2347

Open soininen opened 1 year ago

soininen commented 1 year ago

Somebody proposed this idea to me a while ago.

At least in my circles, most users install Toolbox from Git. Then they need to learn commands like git pull and python -mpip install --upgrade -r requirements.txt to update (and to run them in the correct directory). We could lessen the burden of users by adding a 'Update Toolbox' action e.g. to the Help menu which would run these commands automatically, then prompt the user to close and restart Toolbox. The action could be grayed out if Toolbox home directory was not a Git repository or maybe an update using Pip could be tried instead. In any case, this might improve user experience when updating Toolbox.

ptsavol commented 1 year ago

I'm not sure this will work as described above. Windows will probably complain about PermissionError or similar if you try and update the same files that are currently in memory.

However, I can see this working if the Help->Update Toolbox button first closes toolbox, and then updates the Git files.

soininen commented 1 year ago

Windows will probably complain about PermissionError or similar if you try and update the same files that are currently in memory.

I think Python actually uses the .pyc files while running so the .py files should remain modifiable.

That being said, I believe many updaters are actually separate programs from the main one so perhaps that is what we need to implement in the end as well.

ptsavol commented 1 year ago

I think we had this feature a long long time ago. I don't remember if we updated the whole spine toolbox or just some part of it. I think it was dropped because it did not work reliably on Windows, so that's why I'm a bit hesitant with this one. @manuelma may remember more?

That being said, I believe many updaters are actually separate programs from the main one so perhaps that is what we need to implement in the end as well.

Good point. Maybe this approach works better than what we previously had.

soininen commented 1 year ago

The big picture here is that once we can update Toolbox from within itself (maybe using a separate updater), we could try to implement an installer that would install the latest Toolbox (Git head or latest version tag). If Toolbox was able to update itself, we would not need to release updates to the installer, at least not too often.

soininen commented 11 months ago

Some application updater frameworks readily exist for Python, for example tufup. PyUpdater, on the other hand, seems to have become unmaintained.