Skip to content

Commit

Permalink
Change pkg_ressource to importlib.metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
jpjarnoux committed Sep 27, 2023
1 parent 130a2aa commit 8a8e548
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.185
1.2.186
4 changes: 2 additions & 2 deletions ppanggolin/formats/writeBinaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from collections import Counter, defaultdict
import statistics
from typing import Tuple
import pkg_resources
from importlib.metadata import distribution

# installed libraries
from tqdm import tqdm
Expand Down Expand Up @@ -668,7 +668,7 @@ def write_status(pangenome: Pangenome, h5f: tables.File):
status_group._v_attrs.spots = True if pangenome.status["spots"] in ["Computed", "Loaded", "inFile"] else False
status_group._v_attrs.modules = True if pangenome.status["modules"] in ["Computed", "Loaded", "inFile"] else False
status_group._v_attrs.metadata = write_metadata_status(pangenome, h5f, status_group)
status_group._v_attrs.version = pkg_resources.get_distribution("ppanggolin").version
status_group._v_attrs.version = distribution("ppanggolin").version


def write_info(pangenome: Pangenome, h5f: tables.File):
Expand Down
4 changes: 2 additions & 2 deletions ppanggolin/formats/writeFlat.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from collections import Counter, defaultdict
from pathlib import Path
from typing import TextIO
import pkg_resources
from importlib.metadata import distribution
from statistics import median, mean, stdev
import os

Expand Down Expand Up @@ -214,7 +214,7 @@ def write_gexf_header(gexf: TextIO, light: bool = True):
gexf.write(f' <attribute id="{org_idx + len(index) + shift}" title="{org.name}" type="long" />\n')
gexf.write(' </attributes>\n')
gexf.write(' <meta>\n')
gexf.write(f' <creator>PPanGGOLiN {pkg_resources.get_distribution("ppanggolin").version}</creator>\n')
gexf.write(f' <creator>PPanGGOLiN {distribution("ppanggolin").version}</creator>\n')
gexf.write(' </meta>\n')


Expand Down
5 changes: 2 additions & 3 deletions ppanggolin/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from typing import TextIO, Union, BinaryIO, Tuple, List, Set, Iterable

import networkx as nx
import pkg_resources
from importlib.metadata import distribution
from numpy import repeat
from collections.abc import Callable

Expand Down Expand Up @@ -158,8 +158,7 @@ def set_verbosity_level(args):
format=str_format,
datefmt=datefmt)
logging.getLogger("PPanGGOLiN").info("Command: " + " ".join([arg for arg in sys.argv]))
logging.getLogger("PPanGGOLiN").info(
"PPanGGOLiN version: " + pkg_resources.get_distribution("ppanggolin").version)
logging.getLogger("PPanGGOLiN").info(f"PPanGGOLiN version: {distribution('ppanggolin').version}")


def jaccard_similarities(mat: csc_matrix, jaccard_similarity_th) -> csc_matrix:
Expand Down

0 comments on commit 8a8e548

Please sign in to comment.