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 test workflow to python3.13 and poetry1.8.4 #175

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

bluet
Copy link
Owner

@bluet bluet commented Oct 14, 2024

Important

Update Python to 3.13 and Poetry to 1.8.4 in workflows, Dockerfile, and project configuration, and introduce async server handling.

  • Workflows:
    • Update Python to 3.13 and Poetry to 1.8.4 in py-to-exe.yml.
    • Update Python versions to 3.9, 3.10, 3.12, 3.13 and Poetry versions to 1.7.1, 1.8.4 in python-test-versions.yml.
  • Docker:
    • Update base image to python:3.13-slim in Dockerfile.
    • Update version to v2.0.0-alpha7 in docker-build.sh.
  • Project Configuration:
    • Update Python version to ^3.9 in pyproject.toml.
    • Add Python 3.11, 3.12, 3.13 to classifiers in pyproject.toml.
  • Code Changes:
    • Change serve() in api.py to use async server start.
    • Change start() in server.py to be async.

This description was created by Ellipsis for aa0f8e9. It will automatically update as commits are pushed.


Summary by CodeRabbit

  • Chores
    • Updated Python and Poetry versions in the testing workflow for improved compatibility and performance.
    • Enhanced support for newer Python versions in project classifiers.
    • Updated Dockerfile to use a newer base image for better performance and compatibility.
    • Revised versioning in the Docker build script to reflect the latest release.
  • New Features
    • Improved asynchronous handling in the server's operation for enhanced performance and responsiveness.
    • Enhanced control flow and error handling in the proxy finding process.

Copy link

coderabbitai bot commented Oct 14, 2024

Walkthrough

The GitHub Actions workflow configuration has been updated to reflect changes in the Python and Poetry versions used for testing. The Python versions have been revised from five to four, specifically removing "3.8" and "3.11," while adding "3.13." The Poetry versions have also been updated, now including "1.7.1" and "1.8.4," replacing the previous versions. The overall workflow structure remains unchanged, maintaining the same steps for code checkout, Poetry installation, Python setup, library installation, linting, and testing. Additionally, the Dockerfile and related scripts have been modified to accommodate these version changes, and significant adjustments have been made to enhance the asynchronous capabilities of the server.

Changes

File Change Summary
.github/workflows/python-test-versions.yml Updated Python versions from ["3.8", "3.9", "3.10", "3.11", "3.12"] to ["3.9", "3.10", "3.12", "3.13"] and Poetry versions from ["1.2.2", "1.3.1"] to ["1.7.1", "1.8.4"].
.github/workflows/py-to-exe.yml Updated python-version from 3.9 to 3.13 and poetry-version from 1.3.1 to 1.8.4.
pyproject.toml Updated classifiers to include Python versions 3.11, 3.12, and 3.13; removed support for 3.8, and changed Python requirement from ^3.8 to ^3.9.
Dockerfile Changed base image from python:3.9-slim to python:3.13-slim, removed commented-out system dependencies, and updated the installation order for packages.
docker-build.sh Updated version variable from v2.0.0-alpha6 to v2.0.0-alpha7 affecting Docker image tagging and prompts.
proxybroker/api.py Modified serve method to use an asynchronous function run_server for starting the server and finding proxies.
proxybroker/server.py Changed start method to asynchronous, updated _accept method to call _handle for managing client connections.

Poem

In the garden where code does play,
New Python blooms in a vibrant array.
With Poetry's verses, we craft and create,
A workflow refreshed, oh, isn't it great?
Hopping along with each test we run,
A rabbit's delight in the coding fun! 🐇✨


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

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to bf095df in 17 seconds

More details
  • Looked at 15 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. .github/workflows/python-test-versions.yml:18
  • Draft comment:
    Python 3.13 is not officially released yet. Consider removing it from the test matrix until it is stable.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The comment is relevant to the change made in the diff, which added Python 3.13 to the test matrix. The concern about using an unreleased Python version in the test matrix is valid, as it could lead to instability or unexpected issues. The comment is actionable, suggesting a specific change to remove Python 3.13 until it is stable.
    I might be overestimating the importance of the comment. The author might have a reason for including Python 3.13, such as testing future compatibility, which the comment does not consider.
    Even if the author has a reason for including Python 3.13, the comment highlights a potential risk that should be considered. It is better to address this risk explicitly.
    The comment is valid and should be kept as it addresses a potential issue with including an unreleased Python version in the test matrix.

Workflow ID: wflow_MN2pZKN2hAA0Uv0I


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

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

🧹 Outside diff range and nitpick comments (1)
.github/workflows/python-test-versions.yml (1)

19-19: Approve Poetry version updates with a minor suggestion

The updates to the Poetry versions are well-considered:

  1. Removing the older 1.2.2 version is appropriate.
  2. Adding 1.7.1 and 1.8.4 ensures compatibility with recent Poetry releases.
  3. The range of versions (1.3.1 to 1.8.4) provides good coverage for compatibility testing.

Minor suggestion: Consider using the latest patch version for each minor version to ensure you're testing with the most up-to-date bugfixes. You can use the following script to fetch the latest Poetry versions:

#!/bin/bash
# Fetch the latest Poetry versions
curl -sSL https://api.github.com/repos/python-poetry/poetry/releases | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sort -rV | head -n 3

This will help ensure you're always testing against the latest stable versions of Poetry.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 18dbc17 and bf095df.

📒 Files selected for processing (1)
  • .github/workflows/python-test-versions.yml (1 hunks)
🧰 Additional context used
🔇 Additional comments (2)
.github/workflows/python-test-versions.yml (2)

Line range hint 1-46: Address PR objectives: Updating test workflow to Python 13

The PR successfully updates the test workflow to include Python 3.13, addressing the main objective. However, there are some concerns about the Python version selection that should be addressed before merging:

  1. The removal of Python 3.11 might limit coverage of currently used Python versions.
  2. The addition of Python 3.13 might be premature, as it's not yet officially released.

The Poetry version updates are well-considered and improve the testing coverage for different Poetry versions.

To ensure the PR fully meets its objectives and maintains broad compatibility, please review the earlier comments on Python and Poetry version selections. Consider running the provided scripts to verify the latest stable versions for both Python and Poetry.


18-18: ⚠️ Potential issue

Reconsider Python version selection

The changes to the Python versions raise a few concerns:

  1. Removing Python 3.11 is unusual as it's a recent stable version widely used in production.
  2. Adding Python 3.13 is forward-looking but might be premature as it's not yet released and could be unstable.
  3. The gap between 3.10 and 3.12 (missing 3.11) might lead to compatibility issues.

Consider the following recommendations:

  1. Retain Python 3.11 in the test matrix to ensure compatibility with this widely-used version.
  2. Hold off on adding Python 3.13 until it's officially released and stable.
  3. Ensure your code is compatible with all versions between 3.9 and 3.12.

To verify the latest stable Python versions, you can run:

This will help ensure you're testing against the most relevant Python versions.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Skipped PR review on 740a464 because no changed files had a supported extension. If you think this was in error, please contact us and we'll fix it right away.


Generated with ❤️ by ellipsis.dev

@bluet bluet changed the title update test workflow to python13 update test workflow to python3.13 and poetry1.8.4 Oct 14, 2024
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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between bf095df and 740a464.

⛔ Files ignored due to path filters (1)
  • poetry.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • pyproject.toml (1 hunks)
🧰 Additional context used
🔇 Additional comments (1)
pyproject.toml (1)

21-23: LGTM: Addition of new Python version classifiers

The addition of classifiers for Python 3.11, 3.12, and 3.13 is consistent with the PR objectives to update the test workflow to support newer Python versions.

pyproject.toml Show resolved Hide resolved
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 287b041 in 16 seconds

More details
  • Looked at 29 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. .github/workflows/py-to-exe.yml:20
  • Draft comment:
    Python 3.13 is not yet officially supported by the actions/setup-python GitHub Action. Consider using a stable version like 3.12 until official support is available.
  • Reason this comment was not posted:
    Comment did not seem useful.
2. pyproject.toml:34
  • Draft comment:
    Ensure all dependencies are compatible with Python 3.13 before updating the version constraint. Consider keeping the version constraint at 3.12 until compatibility is confirmed.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_6x69lOEFszxr0vbx


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Skipped PR review on c1ed3e5 because no changed files had a supported extension. If you think this was in error, please contact us and we'll fix it right away.


Generated with ❤️ by ellipsis.dev

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on a689d6d in 14 seconds

More details
  • Looked at 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. .github/workflows/python-test-versions.yml:18
  • Draft comment:
    Python 3.11 is missing from the matrix. Consider adding it for consistency with the project configuration updates.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_jq8AElIyuYXOE3o3


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on f67a646 in 13 seconds

More details
  • Looked at 39 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. Dockerfile:15
  • Draft comment:
    The commented-out section for installing dependencies (lines 11-13) is redundant and can be removed for clarity, as the same dependencies are installed later in the file.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The Dockerfile has a commented-out section for installing dependencies that is not needed since the same dependencies are installed later. This can be removed to clean up the file.

Workflow ID: wflow_gYN1KiAcRlHgXykv


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

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

🧹 Outside diff range and nitpick comments (1)
Dockerfile (1)

Line range hint 11-11: Pin Poetry version to 1.8.4 as per PR objectives.

The PR objectives mention updating to Poetry 1.8.4, but this is not reflected in the Dockerfile. Installing the latest version of Poetry without specifying a version can lead to inconsistencies between builds.

Consider pinning the Poetry version to 1.8.4:

-RUN \
-    pip install -U poetry
+RUN pip install poetry==1.8.4

This change ensures consistency with the PR objectives and between different builds of the Docker image.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between c1ed3e5 and f67a646.

📒 Files selected for processing (5)
  • .github/workflows/python-test-versions.yml (1 hunks)
  • Dockerfile (2 hunks)
  • docker-build.sh (1 hunks)
  • proxybroker/api.py (1 hunks)
  • proxybroker/server.py (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/python-test-versions.yml
🧰 Additional context used
🔇 Additional comments (5)
Dockerfile (1)

1-1: ⚠️ Potential issue

Consider using a stable Python version for the base image.

While updating to newer Python versions is good, Python 3.13 is currently in alpha stage and not recommended for production use. Using an alpha version in a Dockerfile may lead to instability and compatibility issues.

Consider using a stable version of Python, such as 3.11 or 3.12, which are the latest stable releases:

-FROM python:3.13-slim AS base
+FROM python:3.12-slim AS base

Let's verify the current stable Python versions:

docker-build.sh (2)

Line range hint 1-37: Script consistency maintained with version update.

The updated VERSION variable (v2.0.0-alpha7) is correctly used throughout the script, including in Docker tagging commands and user prompts. The script's logic and structure remain unchanged, maintaining consistency with the version update.


3-3: Version update looks good, verify project-wide consistency.

The version bump from v2.0.0-alpha6 to v2.0.0-alpha7 is appropriate and follows semantic versioning for pre-release versions. This change aligns well with the updates to Python and Poetry versions mentioned in the PR objectives.

To ensure consistency, please verify that this version update is reflected in other relevant files across the project, such as pyproject.toml, README.md, or any other documentation files. Run the following script to check for any inconsistencies:

Please review the output and ensure all version references are updated consistently.

proxybroker/server.py (2)

425-425: ⚠️ Potential issue

Ensure the returned data from _inject_headers is utilized

With the addition of return data, the _inject_headers method now returns the modified data. Please verify that all calls to _inject_headers are updated to use the returned value, ensuring that header injections take effect as intended.

Run the following script to find all calls to _inject_headers and check if the returned value is being used:

#!/bin/bash
# Description: Find calls to `_inject_headers` and verify if the returned data is used.

# Search for calls to '_inject_headers(' and check if they are part of an assignment
rg --type py --no-heading --line-number \
    '^[^#]*\b_inject_headers\(' \
    --replace '$0' \
    | while read -r line; do
        # Check if the line contains an assignment
        if ! echo "$line" | grep -q '='; then
            echo "Potential issue at $line: Return value of '_inject_headers' may not be used."
        fi
      done

Manually review any reported lines to ensure that the return value is properly utilized.


148-153: Ensure all invocations of start are awaited

By changing start to an asynchronous method (async def start(self):), any code that calls this method must now use await. Please verify that all calls to start have been updated to await self.start() to prevent RuntimeWarning: coroutine 'start' was never awaited and ensure proper asynchronous execution.

Run the following script to identify places where start is called without await:

Also applies to: 155-155

✅ Verification successful

All invocations of start are properly awaited

No instances of start being called without await were found. The asynchronous execution is correctly handled across the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find calls to `start` that may need to be updated to use `await`

# Search for lines calling 'start(' that are not commented out and do not contain 'await'
rg --type py '^[^#]*\bstart\(' --invert-match 'await\s+\bstart\('

Length of output: 685


Script:

#!/bin/bash
# Description: Find calls to `start` that may need to be updated to use `await`

# Search for lines calling 'start(' that are not commented out and do not contain 'await'
rg --type py '^[^#]*\bstart\(' | grep -Pv 'await\s+\bstart\('

Length of output: 170


Script:

#!/bin/bash
# Description: Find calls to `start` that may need to be updated to use `await`

# Search for lines calling 'start(' that are not commented out and do not contain 'await'
rg --type py '\bstart\(' | grep -Pv 'await\s+\bstart\('

Length of output: 164

Dockerfile Outdated Show resolved Hide resolved
proxybroker/api.py Outdated Show resolved Hide resolved
bluet and others added 2 commits October 15, 2024 03:42
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Incremental review on af7c28b in 22 seconds

More details
  • Looked at 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_ONO13d2pXKnDR76b


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Dockerfile Outdated Show resolved Hide resolved
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on aa0f8e9 in 12 seconds

More details
  • Looked at 14 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. Dockerfile:28
  • Draft comment:
    Consider adding a step to install the project dependencies in the final image to ensure they are available at runtime.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_AvXdjiRytDYyXw0j


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

sonarcloud bot commented Oct 19, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

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

🧹 Outside diff range and nitpick comments (1)
Dockerfile (1)

23-28: Approved with suggestion: Optimized RUN command

The new RUN command effectively combines multiple steps, including cleanup, which addresses previous review comments and optimizes the Dockerfile. Great job on implementing these improvements!

Consider removing the --no-dev flag from the poetry install command in the builder stage:

-    poetry install --no-interaction --no-ansi --no-dev && \
+    poetry install --no-interaction --no-ansi && \

This change ensures that development dependencies are available in the builder stage, which can be useful for running tests or other development tasks. You can exclude dev dependencies in a later stage if needed.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between af7c28b and aa0f8e9.

📒 Files selected for processing (1)
  • Dockerfile (2 hunks)
🧰 Additional context used
🔇 Additional comments (3)
Dockerfile (3)

18-18: Approved: Build stage label capitalized

The capitalization of "AS" in the build stage label is a minor style improvement that aligns with Docker best practices.


Line range hint 1-28: Overall assessment: Dockerfile improvements are well-implemented

The changes to the Dockerfile align well with the PR objectives and address previous review comments effectively. The update to Python 3.13, optimization of RUN commands, and inclusion of cleanup steps all contribute to a more efficient and up-to-date Docker image. The minor suggestion regarding the --no-dev flag is the only point for consideration. Great work on these improvements!


1-1: Approved: Base image updated to Python 3.13

The update to python:3.13-slim aligns with the PR objective and provides access to the latest Python features and improvements.

Please ensure all project dependencies are compatible with Python 3.13. You can verify this by running:

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