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

Set python version to 3.8 #494

Merged
merged 1 commit into from
Jun 25, 2024
Merged

Set python version to 3.8 #494

merged 1 commit into from
Jun 25, 2024

Conversation

ludeeus
Copy link
Member

@ludeeus ludeeus commented Jun 25, 2024

No description provided.

Copy link
Contributor

coderabbitai bot commented Jun 25, 2024

Walkthrough

Walkthrough

The changes involve downgrading the Python version from 3.12 to 3.8 across different configurations, including Docker and GitHub Actions. The control flow in specific source files is refactored from using match statements to if-else statements for better readability and maintainability.

Changes

File(s) Change Summary
.devcontainer.json, .python-version Updated Docker image and added a new .python-version file to specify Python 3.8.
.github/workflows/actions.yml Added steps for setting up Python 3.8 and caching pip dependencies.
source/hooks/.../html_tag_modifier.py, Refactored logic in the Processor class from using match statements to if-else statements.
source/hooks/.../shortcodes.py Simplified shortcode processing logic from match statements to if-else constructs, improving readability.

Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 12dd5f5 and de55dc6.

Files selected for processing (5)
  • .devcontainer.json (1 hunks)
  • .github/workflows/actions.yml (1 hunks)
  • .python-version (1 hunks)
  • source/hooks/html_tag_modifier.py (2 hunks)
  • source/hooks/shortcodes.py (1 hunks)
Additional context used
Ruff
source/hooks/shortcodes.py

7-7: Missing return type annotation for public function get_dict (ANN201)


7-7: Missing type annotation for function argument s (ANN001)


12-12: Missing return type annotation for public function on_page_markdown (ANN201)


12-12: Missing type annotation for *args (ANN002)


12-12: Unused function argument: args (ARG001)


12-12: Missing type annotation for **kwargs (ANN003)


12-12: Unused function argument: kwargs (ARG001)


13-13: Missing return type annotation for private function replace (ANN202)


19-19: Unnecessary else after break statement (RET508)


26-26: Unnecessary else after return statement (RET505)


27-27: Avoid specifying long messages outside the exception class (TRY003)

source/hooks/html_tag_modifier.py

11-11: Missing type annotation for self in method (ANN101)


24-24: Missing return type annotation for public function extendMarkdown (ANN201)

Add return type annotation: None


24-24: Missing type annotation for self in method (ANN101)


28-28: Missing return type annotation for public function on_config (ANN201)


28-28: Missing type annotation for **kwargs (ANN003)


28-28: Unused function argument: kwargs (ARG001)

Additional comments not posted (4)
.python-version (1)

1-1: Python version set to 3.8

The .python-version file is correctly introduced with the Python version set to 3.8, aligning with the PR objectives to standardize the Python version across the project.

.devcontainer.json (1)

3-3: Python version downgraded in Docker image

The Docker image version is correctly downgraded to python:3.8. This change is consistent with the project's decision to standardize on Python 3.8.

.github/workflows/actions.yml (1)

31-37: Setup Python step added to GitHub Actions

A new step to set up Python has been correctly added to the GitHub Actions workflow. It uses the .python-version file to specify the Python version, enabling consistent versioning across different environments and caching pip dependencies, which should improve the build time.

source/hooks/html_tag_modifier.py (1)

13-20: Refactored HTML tag processing logic

The refactoring from a match statement to if-elif conditions in the Processor class enhances control flow and readability when processing HTML tags.


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:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

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

@ludeeus ludeeus merged commit de73390 into next Jun 25, 2024
4 checks passed
@ludeeus ludeeus deleted the py38 branch June 25, 2024 05:53
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 comments (2)
source/hooks/shortcodes.py (1)

Line range hint 12-12: Add missing annotations and handle unused arguments

The function on_page_markdown lacks some type annotations and has unused arguments. Here's a suggested fix:

- def on_page_markdown(markdown: str, *args, **kwargs):
+ def on_page_markdown(markdown: str) -> str:

This refactoring removes unused parameters and adds a missing return type annotation.

Tools
Ruff

26-26: Unnecessary else after return statement (RET505)


27-27: Avoid specifying long messages outside the exception class (TRY003)

source/hooks/html_tag_modifier.py (1)

Line range hint 24-28: Add missing annotations in Extension class methods

The extendMarkdown and on_config methods are missing some type annotations and have unused arguments. Here's how to address these issues:

- def extendMarkdown(self, md: markdown.Markdown):
+ def extendMarkdown(self, md: markdown.Markdown) -> None:

- def on_config(config: MkDocsConfig, **kwargs):
+ def on_config(config: MkDocsConfig) -> MkDocsConfig:

This change adds the necessary type annotations and simplifies the function signatures by removing unused parameters.

Comment on lines +24 to +27
if tag == "my":
return _my_link(args, **kwargs)
else:
raise RuntimeError(f"Unknown shortcode: {tag}")
Copy link
Contributor

Choose a reason for hiding this comment

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

Refactored error handling in shortcode processing

The refactoring to use if-else instead of a match statement and the addition of an explicit error for unknown shortcode tags improves error handling and code clarity.

- else:
-     raise RuntimeError(f"Unknown shortcode: {tag}")
+ else:
+     raise RuntimeError("Unknown shortcode: {}".format(tag))

This change simplifies the exception message to avoid specifying the tag in the message directly, which aligns with best practices for exception messages.

Committable suggestion was skipped due to low confidence.

Tools
Ruff

26-26: Unnecessary else after return statement (RET505)


27-27: Avoid specifying long messages outside the exception class (TRY003)

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