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

[COST-4514] Upgrade to django 4.0 #4839

Merged
merged 8 commits into from
Dec 20, 2023
Merged

Conversation

djnakabaale
Copy link
Contributor

@djnakabaale djnakabaale commented Dec 15, 2023

Jira Ticket

COST-4514

Description

This change upgrades Django to 4.0 and DRF to 3.14 versions

Testing

  1. Checkout Branch
  2. Restart Koku
  3. Load test data
  4. See that ingestion and summary complete successfully

Notes

...

@djnakabaale djnakabaale self-assigned this Dec 15, 2023
@djnakabaale djnakabaale requested review from a team as code owners December 15, 2023 17:31
@djnakabaale djnakabaale added the smoke-tests pr_check will build the image and run minimal required smokes label Dec 15, 2023
@djnakabaale djnakabaale changed the title [COST-2231] Update to django 4.x [COST-2231] Update to django 4.0 Dec 15, 2023
@djnakabaale djnakabaale changed the title [COST-2231] Update to django 4.0 [COST-2231] Upgrade to django 4.0 Dec 15, 2023
Copy link

codecov bot commented Dec 15, 2023

Codecov Report

Merging #4839 (b85c333) into cost-2231-django-4 (6b31bb1) will decrease coverage by 0.0%.
Report is 5 commits behind head on cost-2231-django-4.
The diff coverage is 92.5%.

Additional details and impacted files
@@                 Coverage Diff                  @@
##           cost-2231-django-4   #4839     +/-   ##
====================================================
- Coverage                94.0%   93.9%   -0.0%     
====================================================
  Files                     364     364             
  Lines                   30204   30216     +12     
  Branches                 3598    3602      +4     
====================================================
+ Hits                    28380   28385      +5     
- Misses                   1162    1172     +10     
+ Partials                  662     659      -3     

@djnakabaale djnakabaale changed the title [COST-2231] Upgrade to django 4.0 [COST-4514] Upgrade to django 4.0 Dec 15, 2023
Copy link

sonarcloud bot commented Dec 18, 2023

Copy link
Contributor

@samdoran samdoran left a comment

Choose a reason for hiding this comment

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

Looking very good so far.

@djnakabaale djnakabaale merged commit 71fdb6a into cost-2231-django-4 Dec 20, 2023
9 checks passed
@djnakabaale djnakabaale deleted the cost-2231-django-4.0 branch December 20, 2023 18:12
@djnakabaale djnakabaale mentioned this pull request Dec 20, 2023
3 tasks
@djnakabaale djnakabaale restored the cost-2231-django-4.0 branch December 20, 2023 18:28
@samdoran samdoran deleted the cost-2231-django-4.0 branch January 10, 2024 21:22
samdoran pushed a commit that referenced this pull request Jan 30, 2024
* update django to 4.0 and update relevant method names

* update pipfile.lock and remove gettext alias

* mock get_response

* more mocks for get_response required by middlewaremixin

* use method_decorator to apply neevr_cache on class method

* method set_context deprecated in DRF 3.12 in favor of requires_context

* user django RedisCache and remove django_redis pkg
samdoran pushed a commit that referenced this pull request Jan 30, 2024
* update django to 4.0 and update relevant method names

* update pipfile.lock and remove gettext alias

* mock get_response

* more mocks for get_response required by middlewaremixin

* use method_decorator to apply neevr_cache on class method

* method set_context deprecated in DRF 3.12 in favor of requires_context

* user django RedisCache and remove django_redis pkg
samdoran pushed a commit that referenced this pull request Jan 31, 2024
* update django to 4.0 and update relevant method names

* update pipfile.lock and remove gettext alias

* mock get_response

* more mocks for get_response required by middlewaremixin

* use method_decorator to apply neevr_cache on class method

* method set_context deprecated in DRF 3.12 in favor of requires_context

* user django RedisCache and remove django_redis pkg
samdoran pushed a commit that referenced this pull request Feb 1, 2024
* update django to 4.0 and update relevant method names

* update pipfile.lock and remove gettext alias

* mock get_response

* more mocks for get_response required by middlewaremixin

* use method_decorator to apply neevr_cache on class method

* method set_context deprecated in DRF 3.12 in favor of requires_context

* user django RedisCache and remove django_redis pkg
samdoran pushed a commit that referenced this pull request Feb 2, 2024
* update django to 4.0 and update relevant method names

* update pipfile.lock and remove gettext alias

* mock get_response

* more mocks for get_response required by middlewaremixin

* use method_decorator to apply neevr_cache on class method

* method set_context deprecated in DRF 3.12 in favor of requires_context

* user django RedisCache and remove django_redis pkg
samdoran pushed a commit that referenced this pull request Feb 9, 2024
* update django to 4.0 and update relevant method names

* update pipfile.lock and remove gettext alias

* mock get_response

* more mocks for get_response required by middlewaremixin

* use method_decorator to apply neevr_cache on class method

* method set_context deprecated in DRF 3.12 in favor of requires_context

* user django RedisCache and remove django_redis pkg
samdoran pushed a commit that referenced this pull request Feb 12, 2024
* update django to 4.0 and update relevant method names

* update pipfile.lock and remove gettext alias

* mock get_response

* more mocks for get_response required by middlewaremixin

* use method_decorator to apply neevr_cache on class method

* method set_context deprecated in DRF 3.12 in favor of requires_context

* user django RedisCache and remove django_redis pkg
samdoran pushed a commit that referenced this pull request Feb 13, 2024
* update django to 4.0 and update relevant method names

* update pipfile.lock and remove gettext alias

* mock get_response

* more mocks for get_response required by middlewaremixin

* use method_decorator to apply neevr_cache on class method

* method set_context deprecated in DRF 3.12 in favor of requires_context

* user django RedisCache and remove django_redis pkg
samdoran pushed a commit that referenced this pull request Feb 13, 2024
* update django to 4.0 and update relevant method names

* update pipfile.lock and remove gettext alias

* mock get_response

* more mocks for get_response required by middlewaremixin

* use method_decorator to apply neevr_cache on class method

* method set_context deprecated in DRF 3.12 in favor of requires_context

* user django RedisCache and remove django_redis pkg
samdoran pushed a commit that referenced this pull request Feb 14, 2024
* update django to 4.0 and update relevant method names

* update pipfile.lock and remove gettext alias

* mock get_response

* more mocks for get_response required by middlewaremixin

* use method_decorator to apply neevr_cache on class method

* method set_context deprecated in DRF 3.12 in favor of requires_context

* user django RedisCache and remove django_redis pkg
samdoran pushed a commit that referenced this pull request Feb 15, 2024
* Remove gettext alias
* Mocks for get_response required by middlewaremixin
* Use method_decorator to apply neevr_cache on class method
* Method set_context deprecated in DRF 3.12 in favor of requires_context
* User Django RedisCache and remove django_redis library
samdoran added a commit that referenced this pull request Feb 16, 2024
* Remove gettext alias
* Mocks for get_response required by middlewaremixin
* Use method_decorator to apply neevr_cache on class method
* Method set_context deprecated in DRF 3.12 in favor of requires_context
* User Django RedisCache and remove django_redis library
samdoran pushed a commit that referenced this pull request Feb 19, 2024
The upgrade from Django 3.2 → 4.2 was done in stages

Upgrade to Django 4.0 (#4839)
  - Remove gettext alias
  - Mocks for get_response required by middlewaremixin
  - Use method_decorator to apply neevr_cache on class method
  - Method set_context deprecated in DRF 3.12 in favor of requires_context
  - User Django RedisCache and remove django_redis library


Upgrade to Django 4.1 (#4853)
  - Update deprecated ‘warn’ method
  - Remove deprecated test case method
  - Remove deprecated Series.bool method
  - Correct docstring and class attribute name
  - Cleanup file handle
  - Fix flaky test
  
    This assert statement will always fail since the template schema does not yet
    exists. This test will only pass if another test runs before this test creates
    the template schema.
  
  - Update clone_schema.sql
  
    Do not define a custom sequence object since that is no longer required with the
    move to identity columns.
  
    Do not define a custom sequence object since that is no longer required with the
    move to identity columns.
  
  - Avoid unnecessary globals
  - Add management command to migrate serial ID columns to identity
  
  - Update license information
  
    Add correct copyright and license information to management command.
  
    Create project level licenses to reflect the use of multiple licenses within
    the project.
  
  - Improvements to serial to identity management command
  
    Use SQL composition rather than format strings to protect against SQL injection
    attacks. The risk is quite low, but it’s best to just do the right thing.
    Reorganize the code to avoid a nested function definiton and an unnecessary
    global variable that only needed to be local.
  
  - Add migration to update clone_schema function


Upgrade to Django 4.2 (#4893)
  - Clean up unittest  test_execute_query_with_group_by_tag_and_limit
  - Move Window after aggregation in group_by annotation
  
    Since the Window is used only to provide row numbers and there is no additional
    filtering done on the data in the Window, moving it after the ArrayAgg fixes the
    error encountered in Django 4.2 and returns the same data in the same order.
  
  - Check correct log level in test
    This works in Python 3.9 due to a bug in unittest.
  
  - Use test database name from settings instead of hard coding it
  - Use consistent name for test database
  - Correct patching in test
  - Update clone_schema function in managament command
  - Stop using deprecated .bool() method
  
    https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.bool.html
  
  - Explicitly set the test database name
  
    Currently we are relying on Django’s internal test setup to add a `test_` prefix
    to the default database name. This works fine most of the time but it’s better
    to be explicit.
  
  - Use method call instead of operator
  
    This prevents tripping up flake8 and the need for an ignore or parenthesis
  
  - Reduce to a final boolean value
  
    https://pandas.pydata.org/pandas-docs/stable/user_guide/basics.html#boolean-reductions
  
  - Remove migration that updates clone_schema SQL function
  
    Handling this exclusively with the migrate_serial_to_identity_columns
    management command
  
  - Move to STORAGES from deprecated options
  - Remove deprecated L10_N setting

---------

Co-authored-by: Michael Skarbek <mskarbek@redhat.com>
Co-authored-by: David Nakabaale <dnakabaa@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
smoke-tests pr_check will build the image and run minimal required smokes smokes-required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants