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

Upgrade to 3.11 #545

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Upgrade to 3.11 #545

wants to merge 1 commit into from

Conversation

Joshdpaul
Copy link
Contributor

This PR upgrades the API to Python 3.11, as the current 3.8 spec is EOL. Closes #506

In order for this to work, I had to remove the netcdf4 package, and I unpinned the requests version too. After testing all endpoints with non-cached coordinates, everything appears to work as before. I anticipated more problems, but removing that package seemed to have no effect.

To test:

create a new conda environment with Python 3.11 like so (or just use an existing environment with 3.11):

conda create -n "api_311" python=3.11

Activate that environment, delete any old Pipfile.lock file (this step might be unecessary), and reinstall the pip environment:

pipenv install

Then run the API as usual. If successful , all endpoints should work as before. Is there anything I missed here? Any additional testing we could do?

Copy link
Contributor

@cstephen cstephen left a comment

Choose a reason for hiding this comment

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

I installed this branch's pipenv environment like this:

pipenv --rm
pipenv install

And confirmed that I was getting the right version of Python:

$ pipenv run python -V
Python 3.11.9

I ran into problems running pipenv using a Python 3.11.9 conda environment for some reason, but I think as long as the pipenv command above is reporting Python 3.11.9, everything is working as expected.

I then ran the Data API from this branch and pointed local instances of the following webapps against it:

  • Northern Climate Reports
  • Arctic-EDS
  • Historical Sea Ice Atlas
  • ARDAC Explorer

And everything is working as it should! This covers a ton of test cases all at once, so I think all functionality survived the Python upgrade (and removal of the netcdf4 package too).

I searched through the code and the only references I can see to the netcdf4 package are in the Pipfile, Pipfile.lock, and requirements.txt files. So, I think this was probably a package we stopped using and forgot to remove from the Pipfile. That would explain why all functionality seems to be intact without it.

So, everything looks good with this branch! But we may need to also generate a new requirements.txt file with the following command to make sure our Elastic Beanstalk instance uses package versions compatible with Python 3.11.9:

pip freeze > requirements.txt

I'll defer to @BobTorgerson on this since he has more experience with this kind of thing.

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.

Upgrade Python version
2 participants