Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement path to make mesop work in Windows #415

Merged
merged 19 commits into from
Oct 18, 2024
Merged

Conversation

kumaranvpl
Copy link
Collaborator

Description

MesopUI is not working in Windows with weird error. Flask was complaining that wakeup_component.js. After a short conversation with @davorinrusevljan, I have learnt about the patching we do for mesop. This patching is not working in Windows.

I have investigated further and discovered a bug in mesop.labs.web_component - https://github.com/google/mesop/blob/main/mesop/labs/web_component.py#L34-L35. Here a / is prepended to a path but this piece of code forgets the fact that the windows uses \ instead of /.

I have fixed it by introducing a patched function and using that patched function. Ideally this bug fix should be made at mesop repo itself but I don't want to wait till they make the fix as we have some potential Windows users.

Fixes #413

Type of change

  • Documentation (typos, code examples, or any documentation updates)
  • Bug fix (a non-breaking change that resolves an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a fix or feature that would disrupt existing functionality)
  • This change requires a documentation update

Checklist

  • I have conducted a self-review of my own code
  • I have made the necessary changes to the documentation
  • My changes do not generate any new warnings
  • I have added tests to validate the effectiveness of my fix or the functionality of my new feature
  • I have included code examples to illustrate the modifications

Copy link

codecov bot commented Oct 16, 2024

Codecov Report

Attention: Patch coverage is 71.42857% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
fastagency/ui/mesop/timer.py 71.42% 5 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
fastagency/ui/mesop/timer.py 60.00% <71.42%> (+18.33%) ⬆️

... and 3 files with indirect coverage changes

@davorrunje davorrunje added this pull request to the merge queue Oct 16, 2024
@davorrunje davorrunje removed this pull request from the merge queue due to a manual request Oct 16, 2024
Copy link
Contributor

@davorrunje davorrunje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me check something first

@kumaranvpl kumaranvpl changed the title Fix mesop web_component to make it work in Windows Implement path to make mesop work in Windows Oct 17, 2024
@kumaranvpl kumaranvpl requested a review from davorrunje October 17, 2024 12:43
Copy link
Collaborator

@davorinrusevljan davorinrusevljan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.



@contextmanager
def patch_os_and_str() -> Iterator[None]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have to worry if 2 threads attempt to execute this at the same time? In that case the one that finishes first would possibly remove patch for the second one at too early stage.

But I am not sure if we could have 2 threads hitting this code at the same time.

@kumaranvpl kumaranvpl added this pull request to the merge queue Oct 18, 2024
Merged via the queue into main with commit 89d6bc1 Oct 18, 2024
22 checks passed
@kumaranvpl kumaranvpl deleted the fix-mesop-in-windows branch October 18, 2024 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MesopUI is not working in Windows
3 participants