-
Notifications
You must be signed in to change notification settings - Fork 0
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
lint and upgrade #122
lint and upgrade #122
Conversation
WalkthroughThe changes in this pull request involve updates to several files, primarily focusing on type annotations and dependency versions. The Changes
Poem
Warning Rate limit exceeded@jschlyter has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 21 minutes and 27 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (3)
pyproject.toml (1)
Line range hint
89-106
: Consider enabling additional Ruff rulesWith Ruff 0.8.0, you could enhance code quality by enabling additional rule sets:
RUF
for Ruff-specific rulesTCH
for type-checkingPLC
for pylint conventionsPT
for pytest styleConsider adding these to your
select
list in the Ruff configuration:select = [ # pycodestyle "E", # Pyflakes "F", # pyupgrade "UP", # flake8-bugbear "B", # flake8-simplify "SIM", # isort "I", + # Ruff-specific rules + "RUF", + # Type checking + "TCH", + # Pylint conventions + "PLC", + # Pytest style + "PT", ]aggrec/aggregates.py (2)
Line range hint
64-93
: LGTM! Well-structured response modelThe
AggregateMetadataResponse
class is well-designed with:
- Clear field definitions with descriptive titles
- Proper type hints including optional fields
- Clean conversion from DB model
Consider adding examples to the field descriptions for better API documentation.
Add example values to the Field descriptions:
- aggregate_id: str = Field(title="Aggregate identifier") + aggregate_id: str = Field(title="Aggregate identifier", example="507f1f77bcf86cd799439011") - content_type: str = Field(title="Content MIME type") + content_type: str = Field(title="Content MIME type", example="application/vnd.apache.parquet")
Line range hint
213-277
: LGTM! Enhanced parameter documentationThe function's parameter documentation has been improved with:
- Clear type annotations using Annotated
- Detailed descriptions for signature requirements
- Example values where appropriate
Consider enhancing the error message for invalid aggregate intervals.
Make the error message more descriptive:
- raise HTTPException(status.HTTP_422_UNPROCESSABLE_ENTITY, "Invalid Aggregate-Interval") + raise HTTPException( + status.HTTP_422_UNPROCESSABLE_ENTITY, + "Invalid Aggregate-Interval: must be an ISO 8601 time interval (e.g., '2024-01-01T12:00:00Z/PT1M')" + )
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (1)
poetry.lock
is excluded by!**/*.lock
📒 Files selected for processing (4)
.pre-commit-config.yaml
(1 hunks)aggrec/aggregates.py
(2 hunks)aggrec/settings.py
(2 hunks)pyproject.toml
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- .pre-commit-config.yaml
🔇 Additional comments (4)
pyproject.toml (1)
32-32
: Verify Ruff upgrade compatibility
The Ruff upgrade from >=0.6.3
to >=0.8.0
is significant. While the change looks good, please ensure compatibility with the existing configuration.
Let's verify the compatibility and check for any breaking changes:
✅ Verification successful
Let's gather more information about the project's Ruff configuration and usage to ensure compatibility.
Ruff upgrade is safe to proceed
The upgrade from Ruff 0.6.3 to 0.8.0 is compatible with the current configuration:
- The project uses standard ruff rules (E, F, UP, B, SIM, I) which are core rules supported across versions
- The configuration is simple and doesn't use any advanced features
- pytest-ruff requires
ruff>=0.0.242
, making it fully compatible with 0.8.0
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check Ruff changelog for breaking changes and verify pytest-ruff compatibility
# Get Ruff changelog for versions between 0.6.3 and 0.8.0
echo "Checking Ruff changelog for breaking changes..."
gh api repos/astral-sh/ruff/releases --paginate | \
jq -r '.[] | select(.tag_name | startswith("v0.")) | select(.tag_name >= "v0.6.3" and .tag_name <= "v0.8.0") | "\(.tag_name)\n\(.body)"'
# Check if current pytest-ruff version supports Ruff 0.8.0
echo "Checking pytest-ruff compatibility..."
curl -s https://pypi.org/pypi/pytest-ruff/json | jq -r '.info.requires_dist[] | select(contains("ruff"))'
Length of output: 500
Script:
#!/bin/bash
# Check Ruff configuration in pyproject.toml and any potential usage patterns
echo "Checking Ruff configuration..."
cat pyproject.toml | grep -A 20 "\[tool.ruff\]"
# Look for any Ruff-specific rule configurations or plugins
echo -e "\nChecking for Ruff rule usage..."
rg "ruff: " -A 2
# Check for any Ruff configuration files
echo -e "\nChecking for additional Ruff config files..."
fd -e toml -e ini -e yaml -e yml | grep -i "ruff"
Length of output: 645
aggrec/settings.py (1)
60-60
: LGTM! Type hint modernization looks good.
The changes align with PEP 585, using built-in collection types (type
, tuple
) instead of their typing
module counterparts. This is a good modernization that maintains compatibility while reducing imports.
Let's verify if there are any remaining outdated type hints that could be modernized:
Also applies to: 65-65
✅ Verification successful
Type hint modernization is complete and consistent
The verification confirms that there are no remaining instances of typing.Type
or typing.Tuple
in the codebase, indicating that the type hint modernization has been thoroughly applied. The changes in aggrec/settings.py
are part of a complete modernization effort.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for usage of typing.Type and typing.Tuple in the codebase
# that could potentially be modernized to use built-in types.
echo "Checking for remaining usage of typing.Type and typing.Tuple..."
rg -l "from typing import .*(?:Type|Tuple)" || true
echo "Checking for direct usage of Type[] or Tuple[]..."
rg "(?:Type|Tuple)\[" || true
Length of output: 329
aggrec/aggregates.py (2)
7-7
: LGTM! Modern type hint imports
The changes appropriately modernize the type hint imports by:
- Using built-in collection types directly (e.g.,
list
,dict
) instead oftyping
imports - Adding
Annotated
for enhanced type metadata in FastAPI parameters
106-106
: LGTM! Updated type hints
The function signature has been appropriately modernized to use built-in collection types for type hints while maintaining the same robust functionality.
Summary by CodeRabbit
New Features
AggregateMetadataResponse
class with example values for better API documentation clarity.Bug Fixes
Chores