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

Support Python 3.12 #825

Merged
merged 11 commits into from
Mar 1, 2024

Conversation

glatterf42
Copy link
Collaborator

@glatterf42 glatterf42 commented Mar 1, 2024

Please confirm that this PR has done the following:

  • Tests Added
  • Documentation Added
  • Name of contributors Added to AUTHORS.rst
  • Description in RELEASE_NOTES.md Added

Description of PR

Supersedes #820 and adds support for Python 3.12.

Please note: this PR is based locally on top of #821, so we will need to rebase this onto main once that PR is merged.

@glatterf42 glatterf42 force-pushed the update/python-version branch 2 times, most recently from 0f2e0b5 to 7043d0d Compare March 1, 2024 09:54
@danielhuppmann
Copy link
Member

@glatterf42 please rebase

@glatterf42
Copy link
Collaborator Author

This PR is rebased on the latest main as indicated by the "9 files changes" and ~20 lines affected. Let me check the test failures.

@glatterf42
Copy link
Collaborator Author

glatterf42 commented Mar 1, 2024

Even though I've run the exact same install command locally as in the GHA, namely pip install .[tests,optional_plotting,optional_io_formats,tutorials], I've noticed that there's a difference in the packages installed. Most prominently, pyam's version is registered differently: locally, I have 2.1.1.dev19+g589fc56 while it is pyam-iamc-0.1.dev1+geca1769 on the GitHub runner.
I'm not sure this is important, but the pip install command justifies the installation of several packages from this version, e.g. Collecting bleach!=5.0.0 (from nbconvert>=7.3->pyam-iamc==0.1.dev1+geca1769). Here's a list of packages that are missing locally, but are installed on GitHub:

  • bleach
  • bs4
  • jupyterlab_pygments
  • lxml
  • mistune
  • nbclient, nbformat, nbconvert
  • soupsieve
  • tinycss2
  • xlrd

I don't know which one of these might be affecting the tests, but since my local install command didn't install them and all tests are passing, I'm guessing they are installed unintentionally. @danielhuppmann, @phackstock, any idea why this is happening? Could this be related to the bump of the setuptools minimum version?

If it's not about these, there's just one version difference I found, though this should not affect the plotting capabilities, I think: dateutil has version 2.8.2 locally, but 2.9.0 on GHA. Let me rule this out quickly.
EDIT: updated locally, tests are still successful, it's not about dateutil.

@glatterf42
Copy link
Collaborator Author

So the step "Install dependencies and package" includes these lines:

   Preparing metadata (pyproject.toml): started
   Preparing metadata (pyproject.toml): finished with status 'done'

Even though there is no pyproject.toml on this branch. These lines also appear in the corresponding steps in the latest tests on the main branch, where there is no pyproject.toml either. And there, pyam is supposedly installed as v0.1.dev..., too. So this seems to have been a problem even before this PR.

When setting up a new project with poetry, it will ask you which version your project is one. Per default, this is 0.1.0, which would be written to pyproject.toml if you don't specify another one. My guess is that somehow, the automatically generated pyproject.toml contains this version or doesn't register use_scm_version correctly and thus also installs dependencies from v0.1.2, though this also seems somewhat unlikely.

Either way, I'm currently preparing a poetry-PR based on this branch, which will include a proper pyproject.toml, so the tests might then be passing.

@danielhuppmann
Copy link
Member

@phackstock in #818 updated the GitHub-Action versions for checkout and setup, maybe that implied some default-to-toml routine?

@glatterf42
Copy link
Collaborator Author

I'm just noticing that the packages listed above seem installed on my system after all, it's just that pytest tests/test_admin.py didn't print them.

@phackstock
Copy link
Contributor

@phackstock in #818 updated the GitHub-Action versions for checkout and setup, maybe that implied some default-to-toml routine?

That was just an update to the latest versions and didn't break anything in that PR. So I don't think that that would break anything now. Plus @glatterf42 made the same updates in this PR to the other workflow files and they run fine.

@phackstock
Copy link
Contributor

I'm just noticing that the packages listed above seem installed on my system after all, it's just that pytest tests/test_admin.py didn't print them.

Regarding the package version discrepancies that you reported, did you do your local installation from a fresh virtual environment or did you already have a previous version of pyam and its dependencies installed. If it's the latter that could explain the differences since the GH action always starts from scratch.

@danielhuppmann
Copy link
Member

The failing tests have nothing to do with the pyam-version issue, that is just that @glatterf42 removed the matplotlib version pin.

@phackstock
Copy link
Contributor

Ah ok I see

Copy link
Member

@danielhuppmann danielhuppmann left a comment

Choose a reason for hiding this comment

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

Seems like matplotlib 3.8 uses a lighter, larger font on the axis-labels - I like it. And that also explains why the plotting-tests failed...

Copy link

codecov bot commented Mar 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.8%. Comparing base (c798e2c) to head (1ca323c).

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #825   +/-   ##
=====================================
  Coverage   94.8%   94.8%           
=====================================
  Files         64      64           
  Lines       6092    6092           
=====================================
  Hits        5778    5778           
  Misses       314     314           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@danielhuppmann danielhuppmann merged commit 350d57a into IAMconsortium:main Mar 1, 2024
14 checks passed
@glatterf42 glatterf42 deleted the update/python-version branch March 1, 2024 13:27
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.

3 participants