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

Update python version #233

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

rvandewater
Copy link
Contributor

@rvandewater rvandewater commented Dec 11, 2024

Doing the MIMIC-IV example in Python 3.11 gives me:

Traceback (most recent call last):
  File "/Users/robin/Documents/git/MEDS_transforms/MIMIC-IV_Example/pre_MEDS.py", line 266, in main
    relative_in_fp = fp.relative_to(out_fp.resolve().parent, walk_up=True)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: PurePath.relative_to() got an unexpected keyword argument 'walk_up'

Summary by CodeRabbit

  • New Features

    • Updated minimum supported Python version to 3.12.
  • Bug Fixes

    • Adjusted compatibility requirements for existing environments using Python 3.11 or earlier.

Walkup is not supported in python 3.11:
  File "/Users/robin/Documents/git/MEDS_transforms/MIMIC-IV_Example/pre_MEDS.py", line 266, in main
    relative_in_fp = fp.relative_to(out_fp.resolve().parent, walk_up=True)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Copy link
Contributor

coderabbitai bot commented Dec 11, 2024

Walkthrough

The pull request modifies the pyproject.toml file, specifically updating the requires-python field from ">=3.11" to ">=3.12". This adjustment indicates that the project now requires Python version 3.12 or higher, potentially impacting compatibility with environments using Python 3.11 or earlier. No other significant changes were made to the file's structure, dependencies, or project metadata.

Changes

File Change Summary
pyproject.toml Updated requires-python from ">=3.11" to ">=3.12"

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant System
    User->>System: Requests to run project
    System-->>User: Checks Python version
    alt Python version >= 3.12
        System-->>User: Runs project successfully
    else Python version < 3.12
        System-->>User: Error - Python version not supported
    end
Loading

🐰 In the garden, where bunnies play,
A change was made, hip-hip-hooray!
From Python 3.11, we hop and leap,
To 3.12, our code runs deep.
With every update, we grow and thrive,
In the world of code, we come alive! 🌼


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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 generate docstrings to generate docstrings for this PR. (Experiment)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

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: 1

🧹 Outside diff range and nitpick comments (2)
pyproject.toml (2)

13-13: Update documentation to reflect Python version requirement

The Python version requirement change should be documented to help users understand the upgrade path.

Please ensure this change is reflected in:

  1. README.md
  2. Installation instructions
  3. Migration guide (if applicable)

Would you like me to help create a migration guide that includes:

  • Reason for the version update
  • Steps to upgrade
  • Known compatibility issues
  • Workarounds for users who cannot upgrade immediately

13-13: Consider adding upper bound to Python version requirement

The current specification ">=3.12" allows any future Python version, which might lead to compatibility issues.

Consider using a more specific version range:

-requires-python = ">=3.12"
+requires-python = ">=3.12,<3.13"

This ensures compatibility is maintained until the code is verified with Python 3.13.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 2f88863 and 1682e5a.

📒 Files selected for processing (1)
  • pyproject.toml (1 hunks)
🔇 Additional comments (1)
pyproject.toml (1)

13-13: Verify if Python 3.12 resolves the walk_up parameter issue

While updating to Python 3.12 might resolve the issue, let's verify if this is the most appropriate solution for the walk_up parameter problem in relative_to.

Consider documenting alternative approaches for Python 3.11 users or providing a compatibility layer, as forcing an upgrade to 3.12 might be disruptive for some users.

✅ Verification successful

Python 3.12 requirement is justified for the walk_up parameter

The codebase shows a direct dependency on the walk_up parameter in MIMIC-IV_Example/pre_MEDS.py, where it's used for creating relative symlinks. This parameter was introduced in Python 3.12's Path.relative_to() method, making the Python 3.12 requirement necessary for the functionality to work correctly.

  • MIMIC-IV_Example/pre_MEDS.py: Uses relative_to(out_fp.resolve().parent, walk_up=True) for symlink creation
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for relative_to usage and related issues

# Search for relative_to usage in the codebase
echo "Searching for relative_to usage..."
rg "relative_to\(" -A 2 -B 2

# Check if there are any existing workarounds or alternative approaches
echo "Checking for potential alternative approaches..."
rg "walk_up|walkup" -A 2 -B 2

Length of output: 10419

@@ -10,7 +10,7 @@ authors = [
]
description = "MEDS ETL and transformation functions leveraging a sharding-based parallelism model & polars."
readme = "README.md"
requires-python = ">=3.11"
requires-python = ">=3.12"
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Python 3.12 requirement needs reconsideration

The version update to Python 3.12 raises several concerns:

  • All core dependencies (polars, pyarrow, nested_ragged_tensors) are compatible with Python 3.11
  • The walk_up parameter for Path.relative_to() was actually introduced in Python 3.12, but it's only used in an example file (MIMIC-IV_Example/pre_MEDS.py)
  • Forcing Python 3.12 might unnecessarily restrict users when the codebase could work with 3.11

Recommendations:

  • Keep Python 3.11 requirement and modify the example file to use a different approach for relative path handling
  • Or document the Python 3.12 requirement specifically for the MIMIC-IV example in its README
🔗 Analysis chain

Verify dependency compatibility with Python 3.12

The update to Python 3.12 might impact compatibility with project dependencies. Let's verify the compatibility status of critical dependencies.


Let me check the actual dependencies specified in the project to ensure we have a complete picture.


Let me check if the walkup parameter issue in Path.relative_to is actually resolved in Python 3.12, as this is the stated reason for the version bump.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check Python 3.12 compatibility for key dependencies

# Extract dependencies and check their metadata
for pkg in polars pyarrow nested_ragged_tensors meds; do
  echo "Checking $pkg..."
  curl -s "https://pypi.org/pypi/$pkg/json" | \
    jq -r '.info | "Latest version: " + .version + "\nPython requires: " + .requires_python'
done

Length of output: 1165


Script:

#!/bin/bash
# Get all dependencies from pyproject.toml
cat pyproject.toml | grep -A 50 "dependencies = \["

Length of output: 2631


Script:

#!/bin/bash
# Search for usage of relative_to with walk_up parameter
rg "relative_to.*walk_up" -A 2

Length of output: 269

@mmcdermott
Copy link
Owner

@rvandewater as we deprecate these example folders and move to the ETL template repos like this for MIMIC, do we still need to address this issue? https://github.com/mmcdermott/MIMIC_IV_MEDS

@rvandewater
Copy link
Contributor Author

In case the MIMIC_IV pipeline has not changed we would need to specify python 3.12 for that specific etl. Otherwise, no we do not.

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.

2 participants