IAMconsortium / pyam

Analysis & visualization of energy & climate scenarios
https://pyam-iamc.readthedocs.io/
Apache License 2.0
226 stars 118 forks source link

TypeError: get_version() takes 0 positional arguments but 1 was given #605

Closed khaeru closed 2 years ago

khaeru commented 2 years ago

setuptools-scm 6.4.0 was released 17 January with an unadvertised/backwards-incompatible API change in get_version(): pypa/setuptools_scm#669

The bug is triggered by this code: https://github.com/IAMconsortium/pyam/blob/8dc1d275a3981d16c9cf34fa7022cc407948ef64/pyam/__init__.py#L28-L30

As a result, packages that have pyam as an optional or mandatory requirement experience TypeError at the moment pyam is imported. See for example this test log, excerpted:

message_ix/__init__.py:10: in <module>
    from .reporting import Reporter
message_ix/reporting/__init__.py:16: in <module>
    from .pyam import collapse_message_cols
message_ix/reporting/pyam.py:4: in <module>
    from genno.compat.pyam import util
/opt/hostedtoolcache/Python/3.9.9/x64/lib/python3.9/site-packages/genno/compat/pyam/__init__.py:2: in <module>
    import pyam  # noqa: F401
/opt/hostedtoolcache/Python/3.9.9/x64/lib/python3.9/site-packages/pyam/__init__.py:30: in <module>
    __version__ = get_version(Path(__file__).parent.parent)
TypeError: get_version() takes 0 positional arguments but 1 was given
khaeru commented 2 years ago

Some possible options:

danielhuppmann commented 2 years ago

Thanks for raising this issue here and also directly with setuptools_scm. I merged a quick-fix with a pin to ensure that any pipeline pulling the latest from GitHub works.

I'll come back to this towards the end of this week and work on a proper solution.

khaeru commented 2 years ago

setuptools-scm 6.4.1 was released with a fix: https://github.com/pypa/setuptools_scm/releases/tag/v6.4.1