CDLUC3 / ezid

CDLUC3 ezid
MIT License
11 stars 4 forks source link

Upgrade Python to 3.11 for EZID #468

Open jsjiang opened 9 months ago

jsjiang commented 9 months ago

Upgrade Python to 3.11 for EZID.

Test list:

jsjiang commented 2 months ago

Status of Python versions

jsjiang commented 1 month ago

The last bugfix release of the Python 3.11 series: 3.11.9 Release date: April 2, 2024

jsjiang commented 1 month ago

@ashleygould Hi Ashley, can you create a Python 3.11.9 virtual environment on ezid-dev for testing.
Thank you

Jing

jsjiang commented 1 month ago

On my local Mac:

Install Python 3.11.9

pyenv install 3.11.9
cd ezid-dev/ezid
pyenv local 3.11.9 (or ask VS Code to use 3.11.9)
pip install -r requirements-dev.txt

Prepare test database

./prepare_test_db.sh

Run tests

pytest --ds=settings.tests  tests
ashleygould commented 1 month ago

This is from a slack chat with Jing. I'm including it here for context:

[4:42 PM](https://cdlib.slack.com/archives/D04MRT68FAM/p1715730162469609)
ansible task configure_ezid is failing when running setup.py.  here is snippet:

TASK [ezid : run setup.py] ***************************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": true, "cmd": ["/ezid/.pyenv/versions/3.11.9/bin/python", "/ezid/ezid/setup.py", "develop"], "delta": "0:05:20.448763", "end": "2024-05-14 16:27:02.171546", "msg": "non-zero return code", "rc": 1, "start": "2024-05-14 16:21:41.722783", "stderr": "/ezid/.pyenv/versions/3.11.9/lib/python3.11/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.\n  warnings.warn(\n/ezid/.pyenv/versions/3.11.9/lib/python3.11/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.

This is after commenting out my KLUGE tasks I added last month to get this to run on AL2023, which were also failing.When I run git list, I see a very long set of deprication warning like this one:

ezid@uc3-ezidui-dev01:16:32:33:~$ pip list
DEPRECATION: Loading egg at /apps/ezid/.pyenv/versions/3.11.9/lib/python3.11/site-packages/billiard-4.2.0-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330

The recommended solution on the provided link is

pip has dropped support for installing .egg distributions when it stopped invoking setup.py install.
At some point pip will abandon support for detecting and uninstalling legacy .egg distributions too.

If you reach this issue from the pip deprecation message, it is likely that your Python environment has distributions that have been installed with setup.py install, easy_install, or an older pip version.

The recommended action is to uninstall the distribution and reinstall it with a recent pip.

The take away is we need to upgrade our deployment process which still uses setup.py to install packages. We are now exploring poetry.

ashleygould commented 1 month ago

Initial draft of poetry config file pyproject.toml based on existing requirements.txt and setup.py: https://github.com/CDLUC3/ezid/blob/poetry-ashley/pyproject.toml