Skip to content

Commit 17e4f8b

Browse files
authored
Removes dependency to pyquickhelper (#34)
* remove pyquickhelper * doc * fix documentation * bypass warnings * doc
1 parent af6fcfa commit 17e4f8b

File tree

5 files changed

+16
-12
lines changed

5 files changed

+16
-12
lines changed

_doc/conf.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
# The following is used by sphinx.ext.linkcode to provide links to github
5656
linkcode_resolve = make_linkcode_resolve(
57-
"mlstatpy",
57+
"onnx-array-api",
5858
(
5959
"https://github.com/sdpython/onnx-array-api/"
6060
"blob/{revision}/{package}/"
@@ -114,6 +114,7 @@
114114
"https://data-apis.org/array-api/",
115115
("2022.12/API_specification/generated/array_api.{0}.html", 1),
116116
),
117+
"cProfile.Profile": "https://docs.python.org/3/library/profile.html#profile.Profile",
117118
"DOT": "https://graphviz.org/doc/info/lang.html",
118119
"JIT": "https://en.wikipedia.org/wiki/Just-in-time_compilation",
119120
"onnx": "https://onnx.ai/onnx/",

_doc/examples/plot_benchmark_rf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from onnxmltools.convert.xgboost.operator_converters.XGBoost import convert_xgboost
2626
from onnxruntime import InferenceSession, SessionOptions
2727
from psutil import cpu_count
28-
from pyquickhelper.loghelper import run_cmd
28+
from sphinx_runpython.runpython import run_cmd
2929
from skl2onnx import to_onnx, update_registered_converter
3030
from skl2onnx.common.shape_calculator import calculate_linear_regressor_output_shapes
3131
from sklearn import set_config

_doc/examples/plot_onnxruntime.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def myloss(x, y):
4545
###############################
4646
# Profiling
4747
# +++++++++
48-
from pyquickhelper.pycode.profiling import profile, profile2graph
48+
from onnx_array_api.profiling import profile, profile2graph
4949

5050
x = np.random.randn(10000, 2).astype(np.float32)
5151
y = np.random.randn(10000, 2).astype(np.float32)

onnx_array_api/profiling.py

+12-8
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ def profile2df(
491491
::
492492
493493
import pstats
494-
from pyquickhelper.pycode.profiling import profile2df
494+
from onnx_array_api.profiling import profile2df
495495
496496
ps = pstats.Stats('bench_ortmodule_nn_gpu6.prof')
497497
df = profile2df(pd)
@@ -519,7 +519,7 @@ def profile(
519519
sort: str = "cumulative",
520520
rootrem: Optional[str] = None,
521521
as_df: bool = False,
522-
return_results=False,
522+
return_results: bool = False,
523523
**kwargs,
524524
) -> str:
525525
"""
@@ -532,17 +532,22 @@ def profile(
532532
:param as_df: return the results as a dataframe and not text
533533
:param return_results: if True, return results as well
534534
(in the first position)
535-
:param kwargs: additional parameters used to create the profiler
535+
:param kwargs: additional parameters used to create the profiler,
536+
see :epkg:`cProfile.Profile`
536537
:return: raw results, statistics text dump (or dataframe is *as_df* is True)
537538
538539
.. plot::
539540
540541
import matplotlib.pyplot as plt
541-
from pyquickhelper.pycode.profiling import profile
542-
from pyquickhelper.texthelper import compare_module_version
542+
from onnx_array_api.profiling import profile
543+
544+
def subf(x):
545+
return sum(x)
543546
544547
def fctm():
545-
return compare_module_version('0.20.4', '0.22.dev0')
548+
x1 = subf([1, 2, 3])
549+
x2 = subf([1, 2, 3, 4])
550+
return x1 + x2
546551
547552
pr, df = profile(lambda: [fctm() for i in range(0, 1000)], as_df=True)
548553
ax = df[['namefct', 'cum_tall']].head(n=15).set_index(
@@ -585,8 +590,7 @@ def clean_text(res):
585590
res = res.replace(sub[0], sub[1])
586591
else:
587592
raise TypeError(
588-
"rootrem must contains strings or tuple not {0}"
589-
".".format(rootrem)
593+
f"rootrem must contains strings or tuple not {rootrem!r}."
590594
)
591595
return res
592596

requirements-dev.txt

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ openpyxl
1515
packaging
1616
pandas
1717
psutil
18-
pyquickhelper
1918
pytest
2019
pytest-cov
2120
rstcheck[sphinx,toml]

0 commit comments

Comments
 (0)