Skip to content

Commit ce263c9

Browse files
authored
Update Libraries (networkx, beartype, pot, etc..) (#1080)
* update bearype, hyppo, networkx, pot * update testfixtures library * update nbsphinx * Update ipython, ipykernel * add setuptools dependency * dynamically generate version file * replace setuptools with other methods * remove unused import * leave a stub version file in the project
1 parent 3547bed commit ce263c9

4 files changed

Lines changed: 289 additions & 233 deletions

File tree

graspologic/layouts/colors.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Copyright (c) Microsoft Corporation.
22
# Licensed under the MIT license.
33

4-
import atexit
54
import json
65
import math
76
import os
@@ -10,7 +9,6 @@
109
from typing import Any, Optional
1110

1211
import numpy as np
13-
import pkg_resources
1412
from sklearn.preprocessing import minmax_scale
1513

1614
from graspologic.types import Dict, Tuple
@@ -22,9 +20,8 @@ def _load_thematic_json(path: Optional[str]) -> Tuple[Dict[Any, Any], Dict[Any,
2220
if path is not None and Path(path).is_file():
2321
colors_path = path
2422
else:
25-
atexit.register(pkg_resources.cleanup_resources)
26-
include_path = pkg_resources.resource_filename(__package__, "include")
27-
colors_path = os.path.join(include_path, "colors-100.json")
23+
dir = os.path.dirname(__file__)
24+
colors_path = os.path.join(dir, "include", "colors-100.json")
2825

2926
with open(colors_path) as thematic_json_io:
3027
thematic_json = json.load(thematic_json_io)

graspologic/version.py

Lines changed: 5 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,6 @@
1-
# Copyright (c) Microsoft Corporation and contributors.
2-
# Licensed under the MIT License.
3-
4-
import configparser
5-
import datetime
6-
from typing import Optional
7-
8-
import pkg_resources
9-
10-
11-
def __from_distribution() -> Optional[str]:
12-
"""
13-
This will be coming from our sdist's setup.cfg that we package up, and usually (or
14-
always?) means it will mean the sdist has been installed in the python environment.
15-
16-
This is the common case when you've installed graspologic from PyPI
17-
"""
18-
try:
19-
return str(pkg_resources.get_distribution("graspologic").version)
20-
except BaseException:
21-
return None
22-
23-
24-
def __from_filesystem(setup_config: str = "setup.cfg") -> Optional[str]:
25-
"""
26-
If we aren't an installed library, pkg_resources.get_distribution() won't be
27-
able to find setup.cfg's version, so we'll try to look at it from the filesystem
28-
We can probably presume in this circumstance that we are not a properly installed
29-
version and thus we're going to mark it with a dev label and a time entry
30-
31-
This is the common case when you are developing graspologic itself.
32-
"""
33-
try:
34-
cfg_parser = configparser.RawConfigParser()
35-
cfg_parser.read(setup_config)
36-
base_version = cfg_parser.get("metadata", "version")
37-
now = datetime.datetime.today().strftime("%Y%m%d%H%M%S")
38-
return f"{base_version}.dev{now}"
39-
except BaseException:
40-
return None
41-
42-
1+
# This version placeholder will be replaced during package build.
2+
# Do not commit this file.
3+
__version__ ="0.0.0"#
4+
#
435
def __version() -> str:
44-
"""
45-
Distribution takes precedence, but otherwise we try to read it from the filesystem
46-
47-
If all else fails, we have no way of knowing what version we are
48-
"""
49-
possible_version = __from_distribution() or __from_filesystem()
50-
return possible_version if possible_version is not None else "unknown"
6+
return __version__

0 commit comments

Comments
 (0)