Update mypy to 2.0.0 - #574
Conversation
📝 WalkthroughWalkthroughDevelopment dependency ChangesMypy Dependency Upgrade
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/requirements_dev.txt`:
- Line 2: requirements_dev.txt pins mypy==2.0.0 which is incompatible with the
CI Python 3.6 environment; either upgrade CI to Python 3.10+ and enable
installing requirements_dev.txt in the Dockerfile, or change
requirements_dev.txt to a mypy release that supports Python 3.6 (e.g., mypy
0.x), or remove mypy from requirements_dev.txt if it is not used. Locate the
mypy entry in requirements_dev.txt and update the version or remove it, and then
update .travis.yml to use Python 3.10+ and uncomment the requirements_dev.txt
installation in the Dockerfile if you choose to upgrade the CI; ensure any
chosen option is documented in the PR description.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| @@ -1,3 +1,3 @@ | |||
| pytest | |||
| mypy==0.670 | |||
| mypy==2.0.0 | |||
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Find Python version constraints in the project
echo "=== Checking Python version in setup files ==="
fd -e py -e cfg -e toml -e txt setup pyproject requirements | xargs rg -n "python_requires|Programming Language :: Python :: 3\." 2>/dev/null || echo "No explicit Python version found"
echo -e "\n=== Checking .python-version or runtime configs ==="
fd -H "^\.python-version$|^runtime\.txt$|^\.tool-versions$" -x cat {} \;
echo -e "\n=== Checking for Python version in CI configs ==="
fd -e yml -e yaml -g "*ci*" -g "*workflow*" -x rg -n "python-version|python_version" {} \;Repository: salimfadhley/dockerized_python_playground
Length of output: 541
🏁 Script executed:
#!/bin/bash
# Description: Find mypy configuration files and settings
echo "=== Checking for mypy config files ==="
fd -H "^mypy\.ini$|^\.mypy\.ini$|^setup\.cfg$|^pyproject\.toml$" -x echo "Found: {}" \;
echo -e "\n=== Checking mypy settings in config files ==="
fd -H "^mypy\.ini$|^\.mypy\.ini$" -x cat {} \;
rg -n "^\[mypy" setup.cfg pyproject.toml 2>/dev/null || echo "No mypy config found in setup.cfg or pyproject.toml"
echo -e "\n=== Checking for strict_bytes, local_partial_types, allow_redefinition usage ==="
rg -n "strict_bytes|local_partial_types|allow_redefinition" 2>/dev/null || echo "No existing config for new defaults found"Repository: salimfadhley/dockerized_python_playground
Length of output: 348
🏁 Script executed:
#!/bin/bash
# Description: Check if mypy is run in CI and recent pipeline status
echo "=== Checking for mypy in CI configs ==="
fd -e yml -e yaml -g "*ci*" -g "*workflow*" -g "*travis*" -g "*circle*" | xargs rg -n "mypy" 2>/dev/null || echo "No mypy found in CI configs"
echo -e "\n=== Checking recent CI status for this PR ==="
gh pr view 574 --json statusCheckRollup --jq '.statusCheckRollup[] | select(.context | test("mypy|type|lint|test"; "i")) | {context: .context, state: .state, conclusion: .conclusion}'Repository: salimfadhley/dockerized_python_playground
Length of output: 437
🏁 Script executed:
# Find and examine Python project configuration files
cd /tmp && git -C /tmp 2>/dev/null || true
find . -maxdepth 2 -type f \( -name "setup.py" -o -name "pyproject.toml" -o -name "setup.cfg" -o -name "tox.ini" \) 2>/dev/null | head -10Repository: salimfadhley/dockerized_python_playground
Length of output: 2246
🏁 Script executed:
# Get file listings to understand structure better
ls -la | head -20
find . -maxdepth 2 -type d | head -20Repository: salimfadhley/dockerized_python_playground
Length of output: 1001
🏁 Script executed:
# Search for CI/CD configuration files properly
find . -type f \( -name "*.yml" -o -name "*.yaml" \) 2>/dev/null | grep -E "(github|gitlab|travis|circle|jenkins)" | head -10
ls -la .github/workflows/ 2>/dev/null || echo "No .github/workflows directory"Repository: salimfadhley/dockerized_python_playground
Length of output: 130
🏁 Script executed:
# Check if mypy is imported or used anywhere in the codebase
rg "mypy|type.*check" --type py | head -20Repository: salimfadhley/dockerized_python_playground
Length of output: 67
🏁 Script executed:
# Read .travis.yml to see Python version and mypy setup
cat .travis.ymlRepository: salimfadhley/dockerized_python_playground
Length of output: 218
🏁 Script executed:
# Read Dockerfile to see Python version
cat DockerfileRepository: salimfadhley/dockerized_python_playground
Length of output: 266
🏁 Script executed:
# Read requirements_dev.txt to see full context
cat src/requirements_dev.txtRepository: salimfadhley/dockerized_python_playground
Length of output: 117
🏁 Script executed:
# Search for setup.py anywhere
find . -name "setup.py" -o -name "setup.cfg" -o -name "pyproject.toml"Repository: salimfadhley/dockerized_python_playground
Length of output: 100
🏁 Script executed:
# Check docker-compose for Python version hint
cat docker-compose.yamlRepository: salimfadhley/dockerized_python_playground
Length of output: 420
🏁 Script executed:
# Read setup.py to see Python version constraints
cat src/setup.pyRepository: salimfadhley/dockerized_python_playground
Length of output: 1166
🏁 Script executed:
# Verify if requirements_dev.txt is actually used in CI/Dockerfile
grep -r "requirements_dev" . --include="*.py" --include="*.yml" --include="*.yaml" --include="Dockerfile*"Repository: salimfadhley/dockerized_python_playground
Length of output: 162
mypy 2.0.0 is incompatible with project's Python 3.6 CI environment.
The upgrade to mypy 2.0.0 introduces a critical version mismatch: mypy 2.0 requires Python 3.10+, but .travis.yml configures the CI environment to use Python 3.6. Additionally, the requirements_dev.txt installation is currently commented out in the Dockerfile, masking this incompatibility.
Before merging, decide on one of the following:
- Update Python: Upgrade CI to Python 3.10+ and uncomment the
requirements_dev.txtinstallation in the Dockerfile - Downgrade mypy: Use a version compatible with Python 3.6 (e.g., mypy 0.x)
- Keep disabled: If mypy is intentionally not being used, remove it from
requirements_dev.txtto avoid confusion
Note: mypy 2.0 also enables stricter defaults (--strict-bytes, --local-partial-types) that may surface new type errors once enabled.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/requirements_dev.txt` at line 2, requirements_dev.txt pins mypy==2.0.0
which is incompatible with the CI Python 3.6 environment; either upgrade CI to
Python 3.10+ and enable installing requirements_dev.txt in the Dockerfile, or
change requirements_dev.txt to a mypy release that supports Python 3.6 (e.g.,
mypy 0.x), or remove mypy from requirements_dev.txt if it is not used. Locate
the mypy entry in requirements_dev.txt and update the version or remove it, and
then update .travis.yml to use Python 3.10+ and uncomment the
requirements_dev.txt installation in the Dockerfile if you choose to upgrade the
CI; ensure any chosen option is documented in the PR description.
|
Closing this in favor of #575 |
This PR updates mypy from 0.670 to 2.0.0.
Changelog
2.0
1.20.2
1.20.1
1.20
1.19.1
1.19