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

Get backend working with Python 3.12 #876

Merged
merged 9 commits into from
Jan 24, 2024
Merged

Get backend working with Python 3.12 #876

merged 9 commits into from
Jan 24, 2024

Conversation

jbirddog
Copy link
Contributor

@jbirddog jbirddog commented Jan 10, 2024

Work on #871

Fair amount of dependency updates needed to get the backend to launch and pass tests with Python 3.12:

Update greenlet to 3.0.3
Update pyyaml to 6.0.1
Update libxml to 4.9.4
Update APScheduler to 3.10.4
Update sentry_sdk to 1.39.2
Update dateparser to 1.2.0
Update pytz to 2023.3.post1
Update types-dateparser to 1.1.4.20240106

dateutil has an open issue for the DepreactionWarning that is filtered out - dateutil/dateutil#1314

Also fixed one instance of the deprecation warning in FileSystemService.

Summary by CodeRabbit

  • New Features

    • Updated the application to support Python 3.12.1.
    • Enhanced timestamp handling to use timezone-aware datetime objects.
  • Tests

    • Added new test sessions for compatibility with multiple databases and Python 3.12.

Copy link
Contributor

coderabbitai bot commented Jan 10, 2024

Walkthrough

The changes reflect an update to support Python 3.12.1, including modifying the Python version in configuration files and adjusting code to use the timezone aware datetime function. These updates are part of a broader effort to ensure compatibility with the latest Python version.

Changes

File Path Change Summary
.spiffworkflow-backend/.tool-versions Updated Python version from 3.11.0 to 3.12.1
.spiffworkflow-backend/src/spiffworkflow_backend/services/file_system_service.py Imported timezone and updated datetime usage
.github/workflows/tests.yml Added Python 3.12 test sessions for various databases

Related issues

  • Python 3.12 Support #871: This PR seems to address the update of the Python version in .tool-versions and the addition of Python 3.12 to CI jobs, which are tasks listed under the "Backend" section of the issue.

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-tests for this file.
  • 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 tests 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 from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@jbirddog jbirddog marked this pull request as ready for review January 10, 2024 20:44
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.

Review Status

Actionable comments generated: 1

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between 12f929f and 8ac97e0.
Files ignored due to filter (2)
  • spiffworkflow-backend/poetry.lock
  • spiffworkflow-backend/pyproject.toml
Files selected for processing (3)
  • .github/workflows/tests.yml (3 hunks)
  • spiffworkflow-backend/.tool-versions (1 hunks)
  • spiffworkflow-backend/src/spiffworkflow_backend/services/file_system_service.py (2 hunks)
Files skipped from review due to trivial changes (1)
  • spiffworkflow-backend/.tool-versions
Additional comments: 6
spiffworkflow-backend/src/spiffworkflow_backend/services/file_system_service.py (1)
  • 6-6: The addition of the timezone import from the datetime module is consistent with the PR's objective to handle timezone-aware datetimes in Python 3.12.
.github/workflows/tests.yml (5)
  • 19-20: New test sessions for Python 3.12 with safety and mypy checks have been added. This is in line with the PR's objective to ensure compatibility with Python 3.12.

  • 31-37: New test sessions for Python 3.12 with MySQL database have been added. The configuration appears correct and includes the upload_coverage flag.

  • 44-49: New test sessions for Python 3.12 with PostgreSQL database have been added. The configuration is consistent with the existing test setup for other Python versions.

  • 56-61: New test sessions for Python 3.12 with SQLite database have been added. The configuration is consistent with the existing test setup for other Python versions.

  • 92-100: New test sessions for Python 3.12 with typeguard have been added. The comment about typeguard 2.13.3 being broken with TypeDict in Python 3.11 is informative, but it might be beneficial to check if this issue persists in Python 3.12 or if it has been resolved.

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.

Review Status

Actionable comments generated: 0

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between 8ac97e0 and 0d87379.
Files selected for processing (1)
  • spiffworkflow-backend/src/spiffworkflow_backend/services/file_system_service.py (2 hunks)
Additional comments: 2
spiffworkflow-backend/src/spiffworkflow_backend/services/file_system_service.py (2)
  • 6-6: The import of timezone from the datetime module is correct and necessary for the subsequent changes in the file to handle timezone-aware datetime objects in Python 3.12.

  • 226-226: The change from datetime.utcfromtimestamp to datetime.fromtimestamp with timezone.utc is correct and aligns with the Python 3.12 update for timezone-aware datetime objects. This change ensures that the timestamps are correctly handled as UTC.

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.

Review Status

Actionable comments generated: 2

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between 0d87379 and d502431.
Files ignored due to filter (2)
  • spiffworkflow-backend/poetry.lock
  • spiffworkflow-backend/pyproject.toml
Files selected for processing (1)
  • .github/workflows/tests.yml (3 hunks)
Additional comments: 1
.github/workflows/tests.yml (1)
  • 28-64: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [19-61]

The addition of Python 3.12 test configurations for different databases and sessions is consistent with the PR objectives to ensure compatibility with Python 3.12. It's important to verify that these new configurations work as expected and that the tests pass for Python 3.12.

Verification successful

The grep command confirmed the presence of Python 3.12 configurations in the .github/workflows/tests.yml file, which aligns with the PR objectives and the AI-generated summary. However, the attempt to execute ./run_tests.sh was not successful because the file does not exist in the repository's root directory. This part of the script was a placeholder and not an actual command to run tests. The verification of the workflow file changes is complete, and the review comment is consistent with the changes made in the PR.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the new test configurations for Python 3.12 are working correctly.
# This script assumes that the test suite can be run locally or in a CI environment.
# Replace `./run_tests.sh` with the actual command to run the tests.

# Check for Python 3.12 test configurations
grep -E 'python: "3.12"' .github/workflows/tests.yml

# Run the tests for Python 3.12 configurations
# This is a placeholder command and should be replaced with the actual test command.
./run_tests.sh --python-version="3.12"

Length of output: 444

Comment on lines +92 to +100
- {
# typeguard 2.13.3 is broken with TypeDict in 3.11.
# probably the next release fixes it.
# https://github.com/agronholm/typeguard/issues/242
python: "3.12",
os: "ubuntu-latest",
session: "typeguard",
database: "sqlite",
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The comments regarding the typeguard issue with Python 3.11 are still present in the Python 3.12 configuration. If the issue with typeguard has been resolved in Python 3.12, these comments should be updated or removed to avoid confusion.


The comments about typeguard being broken with TypeDict in Python 3.11 are copied to the Python 3.12 section. If this issue persists in Python 3.12, the comment is valid; otherwise, it should be updated or removed to reflect the current state.

Copy link
Contributor

@burnettk burnettk left a comment

Choose a reason for hiding this comment

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

awesome, thank you

@jbirddog jbirddog merged commit 858e8ea into main Jan 24, 2024
42 checks passed
@jbirddog jbirddog deleted the py312 branch January 24, 2024 13:00
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.

2 participants