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

upgrade to flask_restx, werkzeug 3 #335

Merged
merged 3 commits into from
Jul 21, 2024
Merged

upgrade to flask_restx, werkzeug 3 #335

merged 3 commits into from
Jul 21, 2024

Conversation

rhanka
Copy link
Member

@rhanka rhanka commented Jul 18, 2024

Summary by CodeRabbit

  • Chores

    • Updated dependencies to ensure compatibility and maintain security:
      • Replaced flask_restplus with flask_restx.
      • Upgraded Werkzeug to version 3.0.3.
      • Updated rsa to a minimum version of 4.7.
  • Bug Fixes

    • Resolved import issues by updating the way json_normalize is imported from pandas.
    • Adjusted function parameters in data processing to improve functionality.

Copy link

coderabbitai bot commented Jul 18, 2024

Walkthrough

The updates primarily involve transitioning import statements from older libraries to newer ones within the code/api.py, code/parsers.py, and code/recipes.py files. Specifically, pandas.io.json is replaced by pandas for json_normalize, and flask_restplus is replaced by flask_restx for various modules. Additionally, related package versions in requirements.txt have been updated to ensure compatibility.

Changes

File Change Summary
code/api.py, code/recipes.py Updated import statements to use pandas for json_normalize instead of pandas.io.json, and removed the prefix parameter in iterator_from_files.
code/parsers.py Changed import from flask_restplus to flask_restx.
requirements.txt Replaced flask_restplus with flask_restx, updated version for Werkzeug, and adjusted rsa to >=4.7.

Poem

In code, we see the old make way,
For new imports to save the day.
pandas and flask_restx align,
Ensuring our builds are just fine.
With Werkzeug and rsa up to date,
Our project’s future is looking great! 🚀


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

@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 UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between aa2cff4 and 9e93841.

Files selected for processing (4)
  • code/api.py (2 hunks)
  • code/parsers.py (1 hunks)
  • code/recipes.py (1 hunks)
  • requirements.txt (2 hunks)
Additional context used
Ruff
code/api.py

25-25: pandas.json_normalize imported but unused

Remove unused import: pandas.json_normalize

(F401)


47-47: flask_restx.reqparse imported but unused

Remove unused import: flask_restx.reqparse

(F401)

code/recipes.py

30-30: pandas.json_normalize imported but unused

Remove unused import: pandas.json_normalize

(F401)

Additional comments not posted (6)
requirements.txt (3)

7-7: Upgrade to flask_restx.

The package flask_restplus has been replaced with flask_restx. Ensure that all related code changes have been made to accommodate this new package.


24-24: Upgrade to Werkzeug==3.0.3.

The version of Werkzeug has been updated from 0.16.1 to 3.0.3. Verify that this version is compatible with the rest of the codebase and dependencies.


25-25: Update pinned version of rsa.

The pinned version of rsa has been updated to >=4.7 to avoid a vulnerability. Ensure that this update does not introduce any compatibility issues.

code/parsers.py (1)

2-2: Update import from flask_restplus to flask_restx.

The import statement has been updated to use flask_restx instead of flask_restplus. Ensure that all related code changes have been made to accommodate this new package.

code/api.py (2)

25-25: Update import for json_normalize.

The import statement has been updated to use pandas instead of pandas.io.json for json_normalize. Ensure that this change is compatible with the rest of the code.

Tools
Ruff

25-25: pandas.json_normalize imported but unused

Remove unused import: pandas.json_normalize

(F401)


47-47: Update import from flask_restplus to flask_restx.

The import statement has been updated to use flask_restx instead of flask_restplus. Ensure that all related code changes have been made to accommodate this new package.

Tools
Ruff

47-47: flask_restx.reqparse imported but unused

Remove unused import: flask_restx.reqparse

(F401)

code/recipes.py Outdated
@@ -27,7 +27,7 @@
import simplejson
from collections import Iterable
from collections import OrderedDict
from pandas.io.json import json_normalize
from pandas import json_normalize
Copy link

Choose a reason for hiding this comment

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

Remove unused import.

The json_normalize import from pandas is not used in this file and should be removed to clean up the code.

- from pandas import json_normalize
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
from pandas import json_normalize
Tools
Ruff

30-30: pandas.json_normalize imported but unused

Remove unused import: pandas.json_normalize

(F401)

code/api.py Outdated
@@ -22,7 +22,7 @@
import simplejson
from collections.abc import Iterable
from collections import OrderedDict
from pandas.io.json import json_normalize
from pandas import json_normalize
Copy link

Choose a reason for hiding this comment

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

Remove unused imports.

Static analysis indicates that json_normalize and reqparse are imported but not used. Consider removing these imports to clean up the code.

- from pandas import json_normalize
- from flask_restx import reqparse

Also applies to: 47-47

Tools
Ruff

25-25: pandas.json_normalize imported but unused

Remove unused import: pandas.json_normalize

(F401)

Copy link

@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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9e93841 and 230a552.

Files selected for processing (2)
  • code/api.py (2 hunks)
  • code/recipes.py (2 hunks)
Files skipped from review as they are similar to previous changes (2)
  • code/api.py
  • code/recipes.py

@rhanka rhanka merged commit a42bf0e into dev Jul 21, 2024
3 checks passed
@rhanka rhanka mentioned this pull request Jul 26, 2024
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.

1 participant