Skip to content

Commit

Permalink
[cocopp] Get version number directly
Browse files Browse the repository at this point in the history
One of the reasons we need `pkg_resources` right now is to get the
version number of `cocopp`. Instead, we can load it directly by
importing `.version'.

Partial fix for #2229
  • Loading branch information
olafmersmann committed Nov 27, 2023
1 parent 1b88b91 commit 1a12432
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions code-postprocessing/cocopp/toolsdivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import numpy as np
from matplotlib import pyplot as plt
from subprocess import CalledProcessError, STDOUT
import pkg_resources

from . import genericsettings, testbedsettings

Expand Down Expand Up @@ -586,7 +585,7 @@ def get_version_label(algorithmID=None):
the string. If more than one reference value is present in the data,
the string displays also a warning.
"""
coco_version = pkg_resources.require('cocopp')[0].version
from .version import __version__ as coco_version
reference_values = testbedsettings.get_reference_values(algorithmID)

if reference_values and type(reference_values) is set:
Expand All @@ -600,6 +599,7 @@ def get_version_label(algorithmID=None):


def path_in_package(sub_path=""):
import pkg_resources
"""return the absolute path prepended to `subpath` in this module.
"""
egg_info = pkg_resources.require('cocopp')[0]
Expand Down

0 comments on commit 1a12432

Please sign in to comment.