Skip to content

Semantic_version 2.10.0 is not compatible with Python version 2 #158

@dammyabioye1

Description

@dammyabioye1

https://github.com/rbarrois/python-semanticversion/blob/2cbbee3154d9011cee873ae3a020cd17c669f6df/semantic_version/__init__.py#L16C5-L16C25

Since pkg_resources module is now part of setuptools library. Directly importing pkg_resources throws an error on Python version 2.

I think the issue started from version 2.9.0 when this block was added to the semantic_version/init.py:

try:
    # Python 3.8+
    from importlib.metadata import version

    __version__ = version("semantic_version")
except ImportError:
    import pkg_resources

Error logs:

File "/builds/home/project/lib/python2.7/site-packages/semantic_version/__init__.py", line 16, in <module>
      import pkg_resources
    File "/builds/home/project/lib/python2.7/site-packages/pkg_resources/__init__.py", line 124
      f"{v} is an invalid version and will not be supported in "
                                                               ^
  SyntaxError: invalid syntax

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions