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

Fix for Incorrect OS Version Displayed for Windows 11 in marimo env Command #1410

Merged
merged 11 commits into from
May 20, 2024

Conversation

Haleshot
Copy link
Contributor

Fixes #1409

PR Title

Fix OS Version Display for Windows 11 in marimo env Command

Description

The current implementation of the get_system_info function in envinfo.py incorrectly retrieves the OS version using platform.release(), which does not differentiate between Windows 10 and Windows 11.. This PR addresses this issue by implementing a check for Windows 11 using sys.getwindowsversion().build and updating the OS Version field accordingly.
More information on this here.

Changes Made

  • Introduced a new function is_win11() to determine if the OS is Windows 11 based on the build number (sys.getwindowsversion().build >= 22000).
  • Modified get_system_info to use the is_win11() function to set the OS Version to "11" if running on Windows 11.

Example Output

Before PR:

{
  "marimo": "0.3.7",
  "OS": "Windows",
  "OS Version": "10",
  "Processor": "AMD64 Family 25 Model 80 Stepping 0, AuthenticAMD",
  "Python Version": "3.11.4",
  "Binaries": {
    "Browser": "--",
    "Node": "v18.17.0"
  },
  "Requirements": {
    "click": "8.1.6",
    "importlib-resources": "6.3.2",
    "jedi": "0.19.0",
    "markdown": "3.6",
    "pymdown-extensions": "10.7.1",
    "pygments": "2.15.1",
    "tomlkit": "0.12.4",
    "uvicorn": "0.29.0",
    "starlette": "0.37.2",
    "websocket": "missing",
    "typing-extensions": "4.10.0",
    "black": "24.3.0"
  }
}

After PR:

{
  "marimo": "0.3.7", 
  "OS": "Windows",
  "OS Version": "11",
  "Processor": "AMD64 Family 25 Model 80 Stepping 0, AuthenticAMD",
  "Python Version": "3.11.4",
  "Binaries": {
    "Browser": "--",
    "Node": "v18.17.0"
  },
  "Requirements": {
    "click": "8.1.6",
    "importlib-resources": "6.3.2",
    "jedi": "0.19.0",
    "markdown": "3.6",
    "pymdown-extensions": "10.7.1",
    "pygments": "2.15.1",
    "tomlkit": "0.12.4",
    "uvicorn": "0.29.0",
    "starlette": "0.37.2",
    "websocket": "missing",
    "typing-extensions": "4.10.0",
    "black": "24.3.0"
  }
}

Checklist

  • Implemented is_win11() function to correctly identify Windows 11.
  • Updated get_system_info to use is_win11() for determining the OS version.
  • Tested on Windows 11 to ensure correct functionality.

Copy link

vercel bot commented May 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
marimo-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 20, 2024 6:08am
marimo-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 20, 2024 6:08am

Copy link

github-actions bot commented May 19, 2024

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @Haleshot - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 3 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

marimo/_cli/envinfo.py Outdated Show resolved Hide resolved

def get_system_info() -> dict[str, Union[str, dict[str, str]]]:
os_version = platform.release()
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Variable os_version might be redundant.

The os_version variable is only used once and could be inlined directly into the dictionary assignment for OS Version. This would reduce the number of lines and improve readability.


def get_system_info() -> dict[str, Union[str, dict[str, str]]]:
os_version = platform.release()
if platform.system() == "Windows" and is_win11():
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (performance): Consider combining platform.system() checks.

The platform.system() check is performed twice in the function. Consider storing the result in a variable to avoid redundant calls and improve performance.

Suggested change
if platform.system() == "Windows" and is_win11():
system = platform.system()
if system == "Windows" and is_win11():

@Haleshot Haleshot changed the title Fix for Incorrect OS Version Displayed for Windows 11 in marimo env Command Fix for Incorrect OS Version Displayed for Windows 11 in marimo env Command May 19, 2024
@mscolnick
Copy link
Contributor

@Haleshot thanks for the contribution! i think some of the code-suggestions would be good to add, and there is a lint error (make py-check fixes this, and we have pre-commit too if you want to use that)

gvarnavi and others added 3 commits May 19, 2024 13:16
* adding reactive_html export

* doctype to avoid quirks mode

* respect config width

* clarified help message

* islands from_file static method

* switching cli export to static method

* adding ; between styles

* removing exposing cli option

---------

Co-authored-by: Myles Scolnick <myles@marimo.io>
@Haleshot
Copy link
Contributor Author

recheck

@mscolnick
Copy link
Contributor

@Haleshot main is currently failing so ill force merge, but you'll still need to sign the CLA aggrement (by commenting on this PR)

@Haleshot
Copy link
Contributor Author

@Haleshot main is currently failing so ill force merge, but you'll still need to sign the CLA aggrement (by commenting on this PR)

Thanks. I seem to have combined another PR (didn't pull before committing) and even that commit got added here. Looking into removing that commit.

Apologize for the inconvenience caused.

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
@Haleshot
Copy link
Contributor Author

@mscolnick Hope it's alright now. Reverted the commit and now made the final changes. Do let me know if it's alright/anything to be done from my side.

@mscolnick
Copy link
Contributor

@Haleshot you'll still need to sign the CLA - by pasting the text from above (it should be the first message in this thread)

@Haleshot
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@Haleshot
Copy link
Contributor Author

Haleshot commented May 20, 2024

Added PR template in the same. Fixes #1413
Do let me know if I should create a new PR for the above issue.

mscolnick
mscolnick previously approved these changes May 20, 2024
@Haleshot Haleshot dismissed mscolnick’s stale review May 20, 2024 13:01

The merge-base changed after approval.

@mscolnick
Copy link
Contributor

this PR template is great! Thank you. And thank you for the windows fix

@mscolnick mscolnick merged commit 43a07c4 into marimo-team:main May 20, 2024
7 of 13 checks passed
Copy link

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.6.1-dev7

@gvarnavi
Copy link
Contributor

@mscolnick @akshayka This PR seems to have reverted the new MarimoIslandGenerator features.

@mscolnick
Copy link
Contributor

@gvarnavi it looks like it did for a commit, but then that was unreverted. The PR diff still looks fine. Is the new feature not in the published version?

@gvarnavi
Copy link
Contributor

It's not, no --that's how I caught it.
Here's the file history in main which shows that this was the last commit. Note it also affected marimo/_server/export/init.py.

@akshayka
Copy link
Contributor

Weird .. I can revert it.

@akshayka
Copy link
Contributor

It's not, no --that's how I caught it. Here's the file history in main which shows that this was the last commit. Note it also affected marimo/_server/export/init.py.

Let me know if #1471 looks good

@Haleshot
Copy link
Contributor Author

Apologize for the above confusion and inconvenience caused due to this PR. Not sure how my commits got cluttered in the first place; learning to be more comfortable with using just git CLI than the VS integration.

Hope to be more careful when contributing next time.

@gvarnavi
Copy link
Contributor

Oh no worries at all -- git merging can often feel like dark magic!

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.

Incorrect OS Version Displayed for Windows 11 in marimo env Command
4 participants