writer-framework icon indicating copy to clipboard operation
writer-framework copied to clipboard

feat: prevent writer framework version mismatch between local & deploy - WF-67

Open FabienArcellier opened this issue 1 year ago • 8 comments

  • when using writer deploy, it check the version set in poetry during a cloud deployment is the one used in development

image

  • when using writer run, it show a warning when the version used is obsolete regards to the development version

image

  • when using writer edit, it show a warning when the version used is obsolete regards to the development version

image

FabienArcellier avatar Nov 11 '24 10:11 FabienArcellier

Hey, I didn't read the whole PR, but relying only on the version pinned in requirements.txt or pyproject.toml is problematic. And I think that's the case.

As we discussed with @raaymax requirements.txt will be optional. Also, there should be no need to pin a Framework version. We should assume that if nothing is specified the latest stable version in PyPi is used.

What I was planning, also why I added

include the version in the front end for easier troubleshooting (probably not visible, but easily checked via chrome Dev tools/Inspect Element)

is... serve the version via an endpoint, e.g. myapp.com/metadata

then compare that during deployment, AFTER the app has been deployed and issue a warning if it's not the same. I guess the main disadvantage of this it's that it's Writer-specific, but I think it covers this need very well and gives you a much needed way of checking the actual Framework version from the frontend.

ramedina86 avatar Nov 11 '24 10:11 ramedina86

For version comparison the best option seems to be https://packaging.pypa.io/en/latest/version.html#packaging.version.Version

ramedina86 avatar Nov 11 '24 11:11 ramedina86

For version comparison the best option seems to be https://packaging.pypa.io/en/latest/version.html#packaging.version.Version

I will move to it

FabienArcellier avatar Nov 11 '24 11:11 FabienArcellier

then compare that during deployment, AFTER the app has been deployed and issue a warning if it's not the same. I guess the main disadvantage of this it's that it's Writer-specific, but I think it covers this need very well and gives you a much needed way of checking the actual Framework version from the frontend.

Currently it is doing that. It show a warning in the application logs. It not depends on anything for that. I will look for a way to show the warning in writer deploy when it happens.

FabienArcellier avatar Nov 11 '24 11:11 FabienArcellier

Please make sure to get the effective version and not search for it on requirements.txt or pyproject.toml, otherwise I'm not too sure how we can cover the scenario where writer version isn't specified.

ramedina86 avatar Nov 11 '24 12:11 ramedina86

Please make sure to get the effective version and not search for it on requirements.txt or pyproject.toml, otherwise I'm not too sure how we can cover the scenario where writer version isn't specified.

It search for poetry only for one specific edge case (poetry on cloud deploy) to give the user the best recommandation. In the other cases, It rely on the comparison package version (VERSION) and ./wf/metadata.json. It just give hint to user where to declare it's dependencies depending of the present strategy

FabienArcellier avatar Nov 11 '24 12:11 FabienArcellier

Ah sorry, that's great!

ramedina86 avatar Nov 11 '24 12:11 ramedina86

Can this be merged without any changes in the Writer's deployment service repo?

ramedina86 avatar Dec 10 '24 16:12 ramedina86