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 from Python 3.7 to 3.9 #1624

Merged
merged 2 commits into from
Mar 24, 2022
Merged

Update from Python 3.7 to 3.9 #1624

merged 2 commits into from
Mar 24, 2022

Conversation

jwhitlock
Copy link
Member

@jwhitlock jwhitlock commented Mar 9, 2022

Update to Python 3.9.10 in the Dockerfile and Heroku. This PR fixes #1591

How to test:

  • Use pyenv or similar to install Python 3.9.10, create a new virtual environment, and install the requirements
  • Run tests in developer mode: python3.9 -X dev -m pytest
  • Run the server in developer mode, and poke around: python3.9 -X dev -m ./manage.py runserver

There was a warning about unclosed files in GetAttachmentTests:

ResourceWarning: unclosed file <_io.BufferedRandom name=14>

This is fixed by closing the temporary attachment stream during test teardown.

This leaves a few warnings that can be ignored for now:

pytest.yield_fixture warning

During test setup:

.../site-packages/pytest_django/fixtures.py:356: PytestDeprecationWarning: @pytest.yield_fixture is deprecated.
Use @pytest.fixture instead; they are the same.

This should be fixed by upgrading to pytest-django 4.0.0 or later, which support Python 3.9 and drops support for pytest before 5.4

yaml.dump warning

Collected during test run:

api/tests/views_tests.py::test_swagger_format[yaml]
  .../site-packages/drf_yasg/codecs.py:202: PendingDeprecationWarning: 
  dump will be removed, use
  
    yaml=YAML(typ='unsafe', pure=True)
    yaml.dump(...)
  
  instead
    return yaml.dump(data, Dumper=SaneYamlDumper, default_flow_style=False, encoding='utf-8' if binary else None)

api/tests/views_tests.py::test_swagger_format[yaml]
  .../site-packages/ruamel/yaml/main.py:1364: PendingDeprecationWarning: 
  dump_all will be removed, use
  
    yaml=YAML(typ='unsafe', pure=True)
    yaml.dump_all(...)
  
  instead
    return dump_all(

This was filed upstream (axnsan12/drf-yasg#765), but there has been no response in two months.

Unclosed .env warning

When starting the development server:

.../site-packages/env_tools.py:48: ResourceWarning: unclosed file <_io.TextIOWrapper name='.env' mode='r' encoding='UTF-8'>
  env = '[root]\n' + io.open(filename, 'r').read()
ResourceWarning: Enable tracemalloc to get the object allocation traceback

This is included by django-gulp. There's no issue filed, but also the projects haven't been update for years...

This avoids a warning with `-W default`:

ResourceWarning: unclosed file <_io.BufferedRandom name=14>
@netlify
Copy link

netlify bot commented Mar 23, 2022

Deploy Preview for fx-relay-demo canceled.

Name Link
🔨 Latest commit 1814229
🔍 Latest deploy log https://app.netlify.com/sites/fx-relay-demo/deploys/623b6b60f71fd0000968b0d8

@jwhitlock
Copy link
Member Author

Rebased on main

Copy link
Member

@groovecoder groovecoder left a comment

Choose a reason for hiding this comment

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

Code looks good and spot-checks work: tests passed, and I spot-checked sending and receiving emails, replies, and with attachments too.

@jwhitlock jwhitlock requested a review from Vinnl March 23, 2022 21:12
@jwhitlock
Copy link
Member Author

@Vinnl - this turned out to be fairly easy, but it still may cause conflicts or merge issues with the React changes, so please review and merge on your schedule.

Copy link
Collaborator

@Vinnl Vinnl left a comment

Choose a reason for hiding this comment

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

@jwhitlock React changes have already been merged in, and I don't see anything in here that should conflict with it, so feel free to merge! (And after the migration we can move away from Gulp, so that should resolve the django-gulp error as well.)

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.

Update to Python 3.9
3 participants