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

Fixed bug in the MacOS version check #2819

Merged
merged 13 commits into from
Jul 8, 2024
Merged

Conversation

strickvl
Copy link
Contributor

@strickvl strickvl commented Jul 2, 2024

The version check wasn't handling the difference between OS versions with three vs two numbers. I also added some tests to ensure that it works as expected.

Summary by CodeRabbit

  • Refactor

    • Simplified logic for macOS version detection and environment variable presence to improve readability and maintainability.
  • Tests

    • Added a new test for macOS environment variable warning.
    • Enhanced existing test cases to include additional scenarios.

@strickvl strickvl added bug Something isn't working internal To filter out internal PRs and issues labels Jul 2, 2024
@strickvl strickvl requested a review from avishniakov July 2, 2024 10:07
Copy link
Contributor

coderabbitai bot commented Jul 2, 2024

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Walkthrough

The updates streamline the requires_mac_env_var_warning function in src/zenml/cli/utils.py by simplifying macOS version detection and environment variable checks for better readability and maintainability. To ensure these changes work as intended, corresponding tests have been added in tests/integration/functional/cli/test_utils.py.

Changes

File Change Summary
src/zenml/cli/utils.py Refactored the requires_mac_env_var_warning function to simplify conditional checks related to macOS version detection and environment variable presence.
tests/integration/functional/cli/... Added imports for os and patch, and updated tests including a new test function test_requires_mac_env_var_warning and additional cases in test_validate_keys.

Poem

In the land of code where functions play,
We’ve cleaned some checks to pave the way.
With tests anew for clarity's sake,
Our utils now are more awake!
Here’s to progress in lines refined,
A crisper, clearer, brighter kind. 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@strickvl
Copy link
Contributor Author

strickvl commented Jul 2, 2024

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented Jul 2, 2024

Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6e60094 and b7c6617.

Files selected for processing (2)
  • src/zenml/cli/utils.py (1 hunks)
  • tests/integration/functional/cli/test_utils.py (2 hunks)
Files skipped from review due to trivial changes (1)
  • src/zenml/cli/utils.py
Additional context used
Path-based instructions (1)
tests/integration/functional/cli/test_utils.py (1)

Pattern tests/**/*.py: "Assess the unit test code employing the PyTest testing framework. Confirm that:

  • The tests adhere to PyTest's established best practices.
  • Test descriptions are sufficiently detailed to clarify the purpose of each test."
Ruff
tests/integration/functional/cli/test_utils.py

145-145: Missing docstring in public function

(D103)


156-156: Missing docstring in public function

(D103)


158-158: Avoid equality comparisons to False; use if not requires_mac_env_var_warning(): for false checks

Replace with not requires_mac_env_var_warning()

(E712)

tests/integration/functional/cli/test_utils.py Outdated Show resolved Hide resolved
Comment on lines 156 to 158
def test_requires_mac_env_var_warning_non_mac():
with patch("sys.platform", "linux"):
assert requires_mac_env_var_warning() == False
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a docstring and fix the equality comparison.

The function test_requires_mac_env_var_warning_non_mac is missing a docstring. Additionally, avoid equality comparisons to False; use if not requires_mac_env_var_warning(): instead.

def test_requires_mac_env_var_warning_non_mac():
    """Test the requires_mac_env_var_warning function on non-macOS platforms."""
    with patch("sys.platform", "linux"):
        assert not requires_mac_env_var_warning()
Tools
Ruff

156-156: Missing docstring in public function

(D103)


158-158: Avoid equality comparisons to False; use if not requires_mac_env_var_warning(): for false checks

Replace with not requires_mac_env_var_warning()

(E712)

@@ -149,7 +149,7 @@ class KubeflowOrchestratorConfig(

kubeflow_hostname: Optional[str] = None
kubeflow_namespace: str = "kubeflow"
kubernetes_context: Optional[str] = None # TODO: Potential setting
kubernetes_context: Optional[str] = None # TODO: Potential setting
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This came in from ruff when I merged in develop.

Copy link
Contributor

@bcdurak bcdurak left a comment

Choose a reason for hiding this comment

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

Just tested it and the problem with zenml up does not occur on my end anymore 👍

@strickvl strickvl merged commit 3d66842 into develop Jul 8, 2024
71 of 77 checks passed
@strickvl strickvl deleted the bugfix/fix-platform-check-mac branch July 8, 2024 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working internal To filter out internal PRs and issues run-slow-ci
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants