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

Warnings related to esmpy package __author__, __homepage__, and __obsoletes__ #140

Closed
tomvothecoder opened this issue May 11, 2023 · 7 comments · May be fixed by #315
Closed

Warnings related to esmpy package __author__, __homepage__, and __obsoletes__ #140

tomvothecoder opened this issue May 11, 2023 · 7 comments · May be fixed by #315
Assignees

Comments

@tomvothecoder
Copy link

Hello, I am receiving esmpy warnings (via xesmf) in my package's test suite. Just wanted to make sure the dev team is aware of this.

../../miniconda3/envs/xcdat_ci/lib/python3.10/site-packages/esmpy/__init__.py:106
  /home/vo13/miniconda3/envs/xcdat_ci/lib/python3.10/site-packages/esmpy/__init__.py:106: DeprecationWarning: Implicit None on return values is deprecated and will raise KeyErrors.
    __author__ = msg["Author"]

../../miniconda3/envs/xcdat_ci/lib/python3.10/site-packages/esmpy/__init__.py:107
  /home/vo13/miniconda3/envs/xcdat_ci/lib/python3.10/site-packages/esmpy/__init__.py:107: DeprecationWarning: Implicit None on return values is deprecated and will raise KeyErrors.
    __homepage__ = msg["Home-page"]

../../miniconda3/envs/xcdat_ci/lib/python3.10/site-packages/esmpy/__init__.py:108
  /home/vo13/miniconda3/envs/xcdat_ci/lib/python3.10/site-packages/esmpy/__init__.py:108: DeprecationWarning: Implicit None on return values is deprecated and will raise KeyErrors.
    __obsoletes__ = msg["obsoletes"]
@tomvothecoder tomvothecoder changed the title Warnings related to esmpy package __author__, __homepage__, and __obsoletes__` Warnings related to esmpy package __author__, __homepage__, and __obsoletes__ May 11, 2023
@billsacks
Copy link
Member

@tomvothecoder thank you for reporting this. I am having trouble reproducing this, probably due to my lack of experience enabling deprecation warnings in python.

Things I have tried (from https://docs.python.org/3/library/warnings.html and elsewhere), using python 3.11:

  • Importing esmpy with python started normally
  • Importing esmpy with python started with python -Wd
  • Importing esmpy with python started with python -W "default::DeprecationWarning"
  • Importing esmpy with python started with python -Walways

None of these led to the deprecation warnings you noted above. Would you be able to describe how to reproduce these warnings?

@tomvothecoder
Copy link
Author

Hi @billsacks, thanks for getting back about this. I'll try to provide a minimum reproducible example along with the version of esmpy that is in my conda env soon.

@tomvothecoder
Copy link
Author

I tried your commands and also can't reproduce the issue. I only notice it in my repo's test suite.

Here is extra info that might be helpful.

Conda environment:

esmf                      8.4.2           mpi_mpich_h742b71d_100    conda-forge
esmpy                     8.4.2              pyhc1e730c_1    conda-forge
...
python                    3.11.4          hab00c5b_0_cpython    conda-forge
...
xesmf                     0.7.1              pyhd8ed1ab_0    conda-forge

Warnings

../../miniconda3/envs/xcdat_dev/lib/python3.11/site-packages/esmpy/__init__.py:106
  /home/vo13/miniconda3/envs/xcdat_dev/lib/python3.11/site-packages/esmpy/__init__.py:106: DeprecationWarning: Implicit None on return values is deprecated and will raise KeyErrors.
    __author__ = msg["Author"]

../../miniconda3/envs/xcdat_dev/lib/python3.11/site-packages/esmpy/__init__.py:107
  /home/vo13/miniconda3/envs/xcdat_dev/lib/python3.11/site-packages/esmpy/__init__.py:107: DeprecationWarning: Implicit None on return values is deprecated and will raise KeyErrors.
    __homepage__ = msg["Home-page"]

../../miniconda3/envs/xcdat_dev/lib/python3.11/site-packages/esmpy/__init__.py:108
  /home/vo13/miniconda3/envs/xcdat_dev/lib/python3.11/site-packages/esmpy/__init__.py:108: DeprecationWarning: Implicit None on return values is deprecated and will raise KeyErrors.
    __obsoletes__ = msg["obsoletes"]

Related code lines:

# these don't seem to work with setuptools pyproject.toml
__author__ = msg["Author"]
__homepage__ = msg["Home-page"]
__obsoletes__ = msg["obsoletes"]

What I think is causing the issue

"Author", "Home-page" and "obsoletes" aren't set in pyproject.toml but is being referenced in esmpy.__init__.py.

[project]
name = "esmpy"
description = "ESMF Python interface"
# readme = "README.md"
maintainers = [ { name = "ESMF Core Team", email = "esmf_support@ucar.edu" } ]
requires-python = ">=3.7"
license = { text = "University of Illinois-NCSA" }
dependencies = [
"numpy",
'importlib-metadata; python_version < "3.8"',
# setuptools-git-versioning shouldn't be needed here, but is
# included as a workaround for problems with the build-time
# installation of this package with python 3.10 (given by the
# build-system section above). By including it here, we at least
# ensure that this package will be available for a second or
# subsequent pip install of esmpy.
'setuptools-git-versioning; python_version >= "3.10"',
]
dynamic = [ "version" ]

Minimum example:

import importlib.metadata as ilm

msg = ilm.metadata("esmpy")

print(msg.__dict__)
# {'policy': Compat32(), '_headers': [('Metadata-Version', '2.1'), ('Name', 'esmpy'), ('Version', '8.4.2'), ('Summary', 'ESMF Python interface'), ('Maintainer-email', 'ESMF Core Team <esmf_support@ucar.edu>'), ('License', 'University of Illinois-NCSA'), ('Requires-Python', '>=3.7'), ('License-File', 'LICENSE'), ('Requires-Dist', 'numpy'), ('Requires-Dist', 'importlib-metadata ; python_version < "3.8"'), ('Provides-Extra', 'testing'), ('Requires-Dist', "pytest ; extra == 'testing'"), ('Requires-Dist', "pytest-json-report ; extra == 'testing'")], '_unixfrom': None, '_payload': '', '_charset': None, 'preamble': None, 'epilogue': None, 'defects': [], '_default_type': 'text/plain'}


msg["Author"]  # Returns None
msg["Home-page"]  # Returns None
msg["obsoletes"]  # Returns None

Related issues from other repos

@billsacks
Copy link
Member

Thank you for your very detailed information, @tomvothecoder ! As far as I can tell, these three attributes aren't needed for anything, so I have simply removed them. Please let me know if you run into any additional, related issues.

We're about to have our 8.5.0 release freeze; I'm not sure if the fix will make it into the 8.5.0 release or will need to wait for 8.6.0.

@valeriupredoi
Copy link

@billsacks cheers very much! Has the fix made it to 8.5.0 or 8.6.0? Many thanks 🍺

@billsacks
Copy link
Member

This fix is in 8.5.0 and all following versions.

@valeriupredoi
Copy link

This fix is in 8.5.0 and all following versions.

brilliant, many thanks @billsacks 🍺

DWesl added a commit that referenced this issue Oct 30, 2024
Authors taken from setup.py before #58.
One URL taken from setup.py, others taken from that page.
Classifiers added by me.

Closes #140
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants