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

NXDRIVE-2967: Upgrade deprecated methods #5257

Closed

Conversation

gitofanindya
Copy link
Collaborator

@gitofanindya gitofanindya commented Sep 18, 2024

NXDRIVE-2967: Upgrade deprecated methods

Summary by Sourcery

Upgrade deprecated methods by replacing datetime.utcnow() with datetime.now(tz=timezone.utc) and update locale methods. Increase Python version to 3.12 in CI workflows and documentation to align with the latest Python release. Adjust test configurations to handle new deprecation warnings.

Enhancements:

  • Replace deprecated datetime.utcnow() with datetime.now(tz=timezone.utc) across multiple files to ensure timezone-aware datetime objects.
  • Update locale retrieval method from locale.getdefaultlocale() to locale.getlocale() for improved accuracy.

CI:

  • Upgrade Python version from 3.9 to 3.12 in all GitHub Actions workflows to ensure compatibility with the latest Python features and improvements.

Documentation:

  • Update documentation to reflect the support and usage of Python 3.12.3 instead of Python 3.9.5.

Tests:

  • Modify test configuration to ignore new deprecation warnings related to datetime adapters in Python 3.12.

Copy link
Contributor

sourcery-ai bot commented Sep 18, 2024

Reviewer's Guide by Sourcery

This pull request upgrades deprecated methods and updates the Python version from 3.9 to 3.12 across multiple files. The main changes involve updating datetime usage, modifying GitHub workflow files, and adjusting various configuration and documentation files to reflect the new Python version.

File-Level Changes

Change Details Files
Update datetime usage to use timezone-aware methods
  • Replace datetime.utcnow() with datetime.now(tz=timezone.utc)
  • Import timezone from datetime module where necessary
nxdrive/dao/engine.py
nxdrive/utils.py
nxdrive/engine/engine.py
nxdrive/engine/watcher/remote_watcher.py
Update Python version from 3.9 to 3.12 in GitHub workflows
  • Change python-version from 3.9 to 3.12 in all GitHub workflow files
.github/workflows/functional_tests.yml
.github/workflows/functional_tests_2023.yml
.github/workflows/unit_tests.yml
.github/workflows/dead_code.yml
.github/workflows/integration_tests.yml
.github/workflows/lint.yml
.github/workflows/spell.yml
.github/workflows/style.yml
.github/workflows/translations.yml
.github/workflows/types.yml
Update Python version references in documentation and deployment scripts
  • Update Python version from 3.9.5 to 3.12.3 in documentation files
  • Update Python version in deployment scripts for Windows and POSIX systems
docs/deployment.md
docs/gnu_linux.md
docs/support.md
tools/posix/deploy_ci_agent.sh
tools/windows/deploy_ci_agent.ps1
Update locale-related functions in utils.py
  • Replace getdefaultlocale() with getlocale()
  • Update comments related to Python version compatibility
nxdrive/utils.py
Add warning suppressions for new deprecation warnings in Python 3.12
  • Add suppressions for warnings related to datetime adapter deprecation
tests/conftest.py

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @gitofanindya - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟡 Documentation: 2 issues found

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

@@ -28,7 +28,7 @@ sudo mount -o remount,user_xattr /dev/sda3

[//]: # (XXX_PYTHON)

Nuxeo Drive is officially supported on **Python 3.9.1+**.
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (documentation): Consider using consistent version notation across all files

Other files use exact versions (e.g., 3.12.3) without the '+' symbol. Consider aligning this for consistency.

Suggested change
Nuxeo Drive is officially supported on **Python 3.9.1+**.
Nuxeo Drive is officially supported on **Python 3.12.3**.

@@ -45,7 +45,7 @@ It may evolve quickly without notification as we are following the Python develo

[//]: # (XXX_PYTHON)

As of now, we are using the __Python 3.9.5__.
As of now, we are using the __Python 3.12.3__.
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (documentation): Consider updating the History section

The visible part of the file mentions a History section. Consider updating it to reflect this Python version change.

As of now, we are using __Python 3.12.3__.

History:
- 2023-10-03: Updated to Python 3.12.3
- [Previous version changes...]

@gitofanindya gitofanindya deleted the wip-NXDRIVE-2967-upgrade-deprecated-methods branch September 18, 2024 04:04
@gitofanindya gitofanindya restored the wip-NXDRIVE-2967-upgrade-deprecated-methods branch September 18, 2024 04:05
Copy link

codecov bot commented Sep 18, 2024

Codecov Report

Attention: Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.

Project coverage is 50.58%. Comparing base (74fc14e) to head (ec780d4).
Report is 28 commits behind head on master.

Files with missing lines Patch % Lines
nxdrive/engine/engine.py 50.00% 1 Missing ⚠️
nxdrive/engine/watcher/remote_watcher.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5257      +/-   ##
==========================================
+ Coverage   49.24%   50.58%   +1.34%     
==========================================
  Files          94       96       +2     
  Lines       15699    16109     +410     
==========================================
+ Hits         7731     8149     +418     
+ Misses       7968     7960       -8     
Flag Coverage Δ
functional 42.84% <66.66%> (+4.76%) ⬆️
integration 2.01% <0.00%> (-0.06%) ⬇️
unit 38.66% <77.77%> (+1.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gitofanindya gitofanindya deleted the wip-NXDRIVE-2967-upgrade-deprecated-methods branch September 18, 2024 04:07
@gitofanindya gitofanindya restored the wip-NXDRIVE-2967-upgrade-deprecated-methods branch September 18, 2024 04:07
@gitofanindya gitofanindya deleted the wip-NXDRIVE-2967-upgrade-deprecated-methods branch September 18, 2024 04:08
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