plothist 1.2.5__py3-none-any.whl → 1.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- plothist/__init__.py +1 -1
- plothist/scripts/install_latin_modern_fonts.py +17 -91
- plothist/scripts/make_examples.py +7 -11
- plothist/variable_registry.py +1 -1
- {plothist-1.2.5.dist-info → plothist-1.3.0.dist-info}/METADATA +5 -4
- {plothist-1.2.5.dist-info → plothist-1.3.0.dist-info}/RECORD +9 -9
- {plothist-1.2.5.dist-info → plothist-1.3.0.dist-info}/WHEEL +1 -1
- {plothist-1.2.5.dist-info → plothist-1.3.0.dist-info}/LICENSE +0 -0
- {plothist-1.2.5.dist-info → plothist-1.3.0.dist-info}/entry_points.txt +0 -0
plothist/__init__.py
CHANGED
|
@@ -3,70 +3,9 @@ import os
|
|
|
3
3
|
import platform
|
|
4
4
|
from pathlib import PosixPath
|
|
5
5
|
import time
|
|
6
|
-
import re
|
|
7
6
|
import matplotlib
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def _get_wget_version():
|
|
11
|
-
"""
|
|
12
|
-
Get the version of wget.
|
|
13
|
-
|
|
14
|
-
Returns
|
|
15
|
-
-------
|
|
16
|
-
tuple or str
|
|
17
|
-
The version of wget as a tuple of integers.
|
|
18
|
-
|
|
19
|
-
Raises
|
|
20
|
-
------
|
|
21
|
-
RuntimeError
|
|
22
|
-
If the version of wget could not be determined.
|
|
23
|
-
"""
|
|
24
|
-
version_string = subprocess.check_output(
|
|
25
|
-
["wget", "--version"], universal_newlines=True
|
|
26
|
-
)
|
|
27
|
-
# Try to find the version number in the format "XX.XX.XX"
|
|
28
|
-
version_match = re.search(r"(\d+\.\d+\.\d+)", version_string)
|
|
29
|
-
if not version_match:
|
|
30
|
-
# Try to find the version number in the format "XX.XX"
|
|
31
|
-
version_match = re.search(r"(\d+\.\d+)", version_string)
|
|
32
|
-
if version_match:
|
|
33
|
-
version = version_match.group(1)
|
|
34
|
-
return tuple(map(int, version.split(".")))
|
|
35
|
-
else:
|
|
36
|
-
raise RuntimeError("Could not determine wget version.")
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
def _get_install_command(url, font_directory):
|
|
40
|
-
"""
|
|
41
|
-
Get the command to install a font.
|
|
42
|
-
|
|
43
|
-
Parameters
|
|
44
|
-
----------
|
|
45
|
-
url : str
|
|
46
|
-
The URL of the font.
|
|
47
|
-
font_directory : PosixPath
|
|
48
|
-
The directory where the font should be installed.
|
|
49
|
-
|
|
50
|
-
Returns
|
|
51
|
-
-------
|
|
52
|
-
list
|
|
53
|
-
The command to run in a subprocess to install the font.
|
|
54
|
-
"""
|
|
55
|
-
return [
|
|
56
|
-
"wget",
|
|
57
|
-
"--retry-connrefused", # retry refused connections and similar fatal errors
|
|
58
|
-
*(
|
|
59
|
-
["--retry-on-host-error"] if _get_wget_version() >= (1, 20, 0) else []
|
|
60
|
-
), # retry on host errors such as 404 "Not Found"
|
|
61
|
-
"--waitretry=1", # wait 1 second before next retry
|
|
62
|
-
"--read-timeout=20", # wait a maximum of 20 seconds in case no data is received and then try again
|
|
63
|
-
"--timeout=15", # wait max 15 seconds before the initial connection times out
|
|
64
|
-
"-t",
|
|
65
|
-
"10", # retry 10 times
|
|
66
|
-
"-P",
|
|
67
|
-
font_directory,
|
|
68
|
-
url,
|
|
69
|
-
]
|
|
7
|
+
import requests
|
|
8
|
+
from zipfile import ZipFile
|
|
70
9
|
|
|
71
10
|
|
|
72
11
|
def _download_font(url, font_directory, font_name):
|
|
@@ -91,20 +30,17 @@ def _download_font(url, font_directory, font_name):
|
|
|
91
30
|
success = False
|
|
92
31
|
|
|
93
32
|
while not success and attempt < max_attempt:
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if not success:
|
|
33
|
+
try:
|
|
34
|
+
r = requests.get(url)
|
|
35
|
+
with (font_directory / url.split("/")[-1]).open("wb") as f:
|
|
36
|
+
f.write(r.content)
|
|
37
|
+
success = True
|
|
38
|
+
except Exception as e:
|
|
101
39
|
# Print the output to the terminal
|
|
102
|
-
print("
|
|
103
|
-
print("STDOUT:", result.stdout)
|
|
104
|
-
print("STDERR:", result.stderr)
|
|
40
|
+
print(f"Error: {e}\nTry {attempt + 1} of {max_attempt}")
|
|
105
41
|
# Increment attempt counter and wait before the next attempt
|
|
106
42
|
attempt += 1
|
|
107
|
-
time.sleep(
|
|
43
|
+
time.sleep(attempt)
|
|
108
44
|
|
|
109
45
|
if not success:
|
|
110
46
|
raise RuntimeError(
|
|
@@ -167,26 +103,16 @@ def install_latin_modern_fonts():
|
|
|
167
103
|
)
|
|
168
104
|
print(f"Unzipping Latin Modern {lm}...")
|
|
169
105
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
"
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
"-d",
|
|
176
|
-
(font_directory / f"latin-modern-{lm}"),
|
|
177
|
-
],
|
|
178
|
-
capture_output=True,
|
|
179
|
-
text=True,
|
|
180
|
-
)
|
|
181
|
-
success = result.returncode == 0
|
|
182
|
-
if not success:
|
|
106
|
+
try:
|
|
107
|
+
with ZipFile(font_directory / f"latin-modern-{lm}.zip", "r") as zip_ref:
|
|
108
|
+
zip_ref.extractall(font_directory / f"latin-modern-{lm}")
|
|
109
|
+
success = True
|
|
110
|
+
except Exception as e:
|
|
183
111
|
# Print the output to the terminal
|
|
184
|
-
print("
|
|
185
|
-
print("STDOUT:", result.stdout)
|
|
186
|
-
print("STDERR:", result.stderr)
|
|
112
|
+
print(f"Error: {e}\nTry {attempt + 1} of {max_attempt}")
|
|
187
113
|
# Increment attempt counter and wait before the next attempt
|
|
188
114
|
attempt += 1
|
|
189
|
-
time.sleep(
|
|
115
|
+
time.sleep(attempt)
|
|
190
116
|
subprocess.run(
|
|
191
117
|
["rm", "-f", (font_directory / f"latin-modern-{lm}.zip")]
|
|
192
118
|
)
|
|
@@ -7,7 +7,7 @@ import warnings
|
|
|
7
7
|
import sys
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
_matplotlib_version = "3.
|
|
10
|
+
_matplotlib_version = "3.10.0"
|
|
11
11
|
_numpy_version = "2.0.0"
|
|
12
12
|
|
|
13
13
|
|
|
@@ -30,17 +30,11 @@ def make_examples(no_input=False, check_svg=False, print_code=False):
|
|
|
30
30
|
If the example or img folder does not exist, the function will raise a FileNotFoundError.
|
|
31
31
|
"""
|
|
32
32
|
|
|
33
|
-
# If python version is lower than 3.9, return a warning
|
|
34
|
-
if sys.version_info < (3, 9):
|
|
35
|
-
warnings.warn(
|
|
36
|
-
"svg behavior is not consistent across python versions. Please run this script with python 3.9 or higher. Skipping.",
|
|
37
|
-
stacklevel=2,
|
|
38
|
-
)
|
|
39
|
-
return 1
|
|
40
|
-
|
|
41
33
|
import matplotlib
|
|
42
34
|
|
|
43
|
-
if matplotlib.__version__ <
|
|
35
|
+
if tuple(map(int, matplotlib.__version__.split("."))) < tuple(
|
|
36
|
+
map(int, _matplotlib_version.split("."))
|
|
37
|
+
):
|
|
44
38
|
warnings.warn(
|
|
45
39
|
f"svg behavior is not consistent across matplotlib versions. Please run this script with matplotlib {_matplotlib_version} or higher. Skipping.",
|
|
46
40
|
stacklevel=2,
|
|
@@ -49,7 +43,9 @@ def make_examples(no_input=False, check_svg=False, print_code=False):
|
|
|
49
43
|
|
|
50
44
|
import numpy
|
|
51
45
|
|
|
52
|
-
if numpy.__version__ <
|
|
46
|
+
if tuple(map(int, numpy.__version__.split("."))) < tuple(
|
|
47
|
+
map(int, _numpy_version.split("."))
|
|
48
|
+
):
|
|
53
49
|
warnings.warn(
|
|
54
50
|
f"svg behavior is not consistent across numpy versions. Please run this script with numpy {_numpy_version} or higher. Skipping.",
|
|
55
51
|
stacklevel=2,
|
plothist/variable_registry.py
CHANGED
|
@@ -178,7 +178,7 @@ def update_variable_registry(
|
|
|
178
178
|
path : str, optional
|
|
179
179
|
The path to the variable registry file (default is "./variable_registry.yaml").
|
|
180
180
|
overwrite : bool, optional
|
|
181
|
-
If True, the keys will be overwrite by the provided value in the
|
|
181
|
+
If True, the keys will be overwrite by the provided value in the dictionary (default is False).
|
|
182
182
|
|
|
183
183
|
Returns
|
|
184
184
|
-------
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: plothist
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: Plot histograms in a scalable way and a beautiful style.
|
|
5
5
|
Author-email: Cyrille Praz <cyrraz.code@protonmail.com>, Tristan Fillinger <tristan.github@gmail.com>
|
|
6
|
-
Requires-Python: >=3.
|
|
6
|
+
Requires-Python: >=3.9
|
|
7
7
|
Description-Content-Type: text/x-rst
|
|
8
8
|
Classifier: Intended Audience :: Developers
|
|
9
9
|
Classifier: Intended Audience :: Education
|
|
@@ -13,11 +13,12 @@ Classifier: License :: OSI Approved :: BSD License
|
|
|
13
13
|
Classifier: Operating System :: OS Independent
|
|
14
14
|
Classifier: Programming Language :: Python
|
|
15
15
|
Classifier: Topic :: Scientific/Engineering
|
|
16
|
-
Requires-Dist: boost-histogram
|
|
16
|
+
Requires-Dist: boost-histogram>=1.4.0
|
|
17
17
|
Requires-Dist: numpy>=1.14.5
|
|
18
18
|
Requires-Dist: matplotlib>=3.0
|
|
19
19
|
Requires-Dist: pyyaml>=5.3.1
|
|
20
20
|
Requires-Dist: scipy>=1.6.0
|
|
21
|
+
Requires-Dist: requests>=2.25.0
|
|
21
22
|
Project-URL: Bug Tracker, https://github.com/cyrraz/plothist/issues
|
|
22
23
|
Project-URL: Documentation, https://plothist.readthedocs.io/
|
|
23
24
|
Project-URL: Homepage, https://github.com/cyrraz/plothist
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
plothist/__init__.py,sha256=
|
|
1
|
+
plothist/__init__.py,sha256=6oSa6gAt-3ta4LwyMh7PCtHsX7a2fwFrVxePSb3qCes,3314
|
|
2
2
|
plothist/comparison.py,sha256=qrQHQ0vv-0rBWaSAvkeZLeZyJb-I4rhsEQtLWQxO3jc,17431
|
|
3
3
|
plothist/default_style.mplstyle,sha256=7MmB2uiXmD_DSqFHeH1xxC-lTctBD_EASxMdSOsPep0,1574
|
|
4
4
|
plothist/dummy_data.csv,sha256=sb4LCjYW4ZO2bLCJvrunrIses-0CHe7CNwd5-BgCme8,5936219
|
|
@@ -6,12 +6,12 @@ plothist/get_dummy_data.py,sha256=7GrWea75f0vWGi1IQg1TRpq_NzaDsTQiXm7kQ7eZOdI,43
|
|
|
6
6
|
plothist/histogramming.py,sha256=A9tGRqhJ1-M85IuCSsgs5OVLZWxWoRtNnr1kXhJXQdU,10201
|
|
7
7
|
plothist/plothist_style.py,sha256=JEAez2o7i5o_OGAdl_-77zx0OXStRB6QLh6nA561jks,12908
|
|
8
8
|
plothist/plotters.py,sha256=n9XBamhdWRvbfuYWLQjRLT3MiphtAqfh5sUgWRoo_yc,42479
|
|
9
|
-
plothist/variable_registry.py,sha256=
|
|
9
|
+
plothist/variable_registry.py,sha256=_fJEhr_jfm6CwxmfFK5qcRUE1VAxUlecnZEzHeuinDs,10207
|
|
10
10
|
plothist/scripts/__init__.py,sha256=FRe2fYlnv0lJYqn8wPxAmhDs1XME8pvEs3rQgJpjp3k,108
|
|
11
|
-
plothist/scripts/install_latin_modern_fonts.py,sha256=
|
|
12
|
-
plothist/scripts/make_examples.py,sha256=
|
|
13
|
-
plothist-1.
|
|
14
|
-
plothist-1.
|
|
15
|
-
plothist-1.
|
|
16
|
-
plothist-1.
|
|
17
|
-
plothist-1.
|
|
11
|
+
plothist/scripts/install_latin_modern_fonts.py,sha256=e4el7nYf8vXX1bXw535Lu6fLatXud8ZSaJNGYSx2ejo,5485
|
|
12
|
+
plothist/scripts/make_examples.py,sha256=b6QHG_a4G2KnAl0yjL7tL0n_Kovo5d84h7xODqBaAts,7373
|
|
13
|
+
plothist-1.3.0.dist-info/entry_points.txt,sha256=8YWfI0-xVfDK4EmTWzQLfP4r0wJoUc4CTLk0lj2mKJY,185
|
|
14
|
+
plothist-1.3.0.dist-info/LICENSE,sha256=zLdEtgFx6ObRPsz6Ofa0zJb5EuL0Z54FJP8egGX_unU,1523
|
|
15
|
+
plothist-1.3.0.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
|
|
16
|
+
plothist-1.3.0.dist-info/METADATA,sha256=Tn05Jj-tG9OBXfVet8Ux2qRPLCzJmJ7158iDG2tYRrQ,3688
|
|
17
|
+
plothist-1.3.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|