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

Python 3.11 upgrade #279

Merged
merged 38 commits into from
Oct 5, 2023
Merged

Python 3.11 upgrade #279

merged 38 commits into from
Oct 5, 2023

Conversation

dmichaels-harvard
Copy link
Contributor

@dmichaels-harvard dmichaels-harvard commented Aug 22, 2023

Bump required PyYAML version to ^6.0.1 to resolve a Mac M1 issue with downstream builds.

As @netsettler notes in discussion on utils PR #277, the PyYAML Change Log says this about major version 6:

6.0 (2021-10-13)

* https://github.com/yaml/pyyaml/pull/327 -- Change README format to Markdown
* https://github.com/yaml/pyyaml/pull/483 -- Add a test for YAML 1.1 types
* https://github.com/yaml/pyyaml/pull/497 -- fix float resolver to ignore `.` and `._`
* https://github.com/yaml/pyyaml/pull/550 -- drop Python 2.7
* https://github.com/yaml/pyyaml/pull/553 -- Fix spelling of “hexadecimal”
* https://github.com/yaml/pyyaml/pull/556 -- fix representation of Enum subclasses
* https://github.com/yaml/pyyaml/pull/557 -- fix libyaml extension compiler warnings
* https://github.com/yaml/pyyaml/pull/560 -- fix ResourceWarning on leaked file descriptors
* https://github.com/yaml/pyyaml/pull/561 -- always require `Loader` arg to `yaml.load()`
* https://github.com/yaml/pyyaml/pull/564 -- remove remaining direct distutils usage

Based on this, he reasons:

It looks like really dropping Python 2 is the major incompatible change, though the "always require Loader arg to yaml.load()" might require some research to make sure we weren't breaking something.

@coveralls
Copy link

coveralls commented Aug 22, 2023

Pull Request Test Coverage Report for Build 6421775176

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.009%) to 77.65%

Files with Coverage Reduction New Missed Lines %
dcicutils/s3_utils.py 1 87.41%
Totals Coverage Status
Change from base Build 6354871296: -0.009%
Covered Lines: 8477
Relevant Lines: 10917

💛 - Coveralls

CHANGELOG.rst Outdated
@@ -7,6 +7,12 @@ Change Log
----------


7.9.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think a major version 8.0.0 would be wise, so that if there's an issue, it's easy for someone to use ^7.x. kinds of notation to select stuff that doesn't have this until a fix is ready. Probably not an issue, but that thing about change in required arg worries me.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@willronchetti do you have an opinion on this?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm a little worried about that required arg. I note that if you search for calls to yaml.load in 4dn-dcic (which is only one of our 3 orgs), you'll see several calls that don't pass an explicit Loader argument. Will that work or are you forcing code updates? Maybe those updates are fine. If there is an obvious loader, maybe we should have something that someone can call instead.

Copy link
Contributor Author

@dmichaels-harvard dmichaels-harvard Aug 23, 2023

Choose a reason for hiding this comment

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

Yeah, looking at those results as well as for dbmi-bgm and smaht-dac, I don't see any uses within a repo where dcicutils is used (where the version of pyyaml it uses will increments due to this dcicutils change). The only affected repos are cwltools and parliament2 - neither of which has any reference to dcicutils anywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I built a cgap-portal(branch: dcicutils-with-pyyaml-6-and-sheet-utils | version: 14.2.0.1b1) with this dcicutils/pyyaml update and deployed to cgap-supertest and it seems fine (login/logout, create access-key, and ran submit-metadata-bundle).

Copy link
Collaborator

@netsettler netsettler left a comment

Choose a reason for hiding this comment

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

As @willronchetti noted on slack, testing workflows need to be updated to test the right things.

Also, the categories at top of pyproject.toml mention Python versions, so those need to change.

pyproject.toml Outdated
@@ -36,7 +36,7 @@ classifiers = [


[tool.poetry.dependencies]
python = ">=3.7,<3.10"
python = ">=3.7,<3.12"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
python = ">=3.7,<3.12"
python = ">=3.8,<3.12"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Collaborator

Choose a reason for hiding this comment

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

This will also need update of the categories in pyproject.toml, and of the workflows in GA in order to get tests to pass (since 3.7 is now excluded) but also to test new versions we weren't previously testing.

CHANGELOG.rst Outdated
* Changed PyYAML version to ^6.0.1; Mac M1 has issues building 5.4.1 (though 5.3.1 works).
See PyYAML 6.0 change log here: https://github.com/yaml/pyyaml/blob/master/CHANGES
The only incompatible change seems to be that yaml.load now requires a Loader argument;
and searching our repos (4dn-dcic, dbmi-bgm, smaht-dac) the only ones which might be affected
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
and searching our repos (4dn-dcic, dbmi-bgm, smaht-dac) the only ones which might be affected
and searching our GitHub organizations (4dn-dcic, dbmi-bgm, smaht-dac) the only ones which might be affected

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Collaborator

@netsettler netsettler left a comment

Choose a reason for hiding this comment

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

Yeah, this seems fine.

@@ -29,7 +29,6 @@ classifiers = [

# Specify the Python versions you support here.
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python_version: [3.7, 3.8, 3.9]
python_version: [3.8, 3.9, 3.11]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not 3.10?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to save time in GitHub actions really; not sure 3.10 is in wide usage; can add if you like.

pyproject.toml Outdated
@@ -70,7 +69,8 @@ coverage = ">=7.2.3"
# coveralls = ">=3.3.1"
flake8 = ">=3.9.2"
flaky = ">=3.7.0"
pip-licenses = "^3.5.5"
pip-licenses = "^4.3.3"
pip = "23.2.1"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would order this before pip-licenses, but that's minor.

Is it really a good idea to list pip here? Is poetry undoing the version we load in the Makefile? (In that case, maybe it is necessary to list it here. But it seems like something we may regret having to maintain.

Further, do you really mean to pin it to so specific a version? If so, could you add a comment saying why so we can know when to unpin it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, I had that (pip) in there temporarily - I will remove it. Thanks.

Copy link
Member

@willronchetti willronchetti left a comment

Choose a reason for hiding this comment

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

Approving recent changes for 3.11, all looks good but the pyproject python versions should be updated (take Kent's suggestion)

@dmichaels-harvard dmichaels-harvard changed the title Up pyyaml version to ^6.0.1 for Mac M1 issue with build. Python 3.11 upgrade Sep 29, 2023
@dmichaels-harvard dmichaels-harvard merged commit ab88729 into master Oct 5, 2023
4 checks passed
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.

4 participants