diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-tuna.spec | 487 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 489 insertions, 0 deletions
@@ -0,0 +1 @@ +/tuna-0.5.11.tar.gz diff --git a/python-tuna.spec b/python-tuna.spec new file mode 100644 index 0000000..83d9753 --- /dev/null +++ b/python-tuna.spec @@ -0,0 +1,487 @@ +%global _empty_manifest_terminate_build 0 +Name: python-tuna +Version: 0.5.11 +Release: 1 +Summary: Visualize Python performance profiles +License: GPL-3.0-or-later +URL: https://github.com/nschloe/tuna +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/88/fb/5bf0865b2fdb44c0c62af24e77b5fe1bcfae4282b982a954fe7984587595/tuna-0.5.11.tar.gz +BuildArch: noarch + +Requires: python3-importlib-metadata + +%description +<p align="center"> + <a href="https://github.com/nschloe/tuna"><img alt="tuna" src="https://nschloe.github.io/tuna/logo-with-text.svg" width="50%"></a> + <p align="center">Performance analysis for Python.</p> +</p> + +[](https://pypi.org/project/tuna) +[](https://pypi.org/pypi/tuna/) +[](https://github.com/nschloe/tuna) +[](https://pepy.tech/project/tuna) +<!--[](https://pypistats.org/packages/tuna)--> + +[](https://discord.gg/hnTJ5MRX2Y) + +[](https://github.com/nschloe/tuna/actions?query=workflow%3Aci) +[](https://lgtm.com/projects/g/nschloe/tuna) +[](https://github.com/psf/black) +[](https://github.com/prettier/prettier) + +tuna is a modern, lightweight Python profile viewer inspired by +[SnakeViz](https://github.com/jiffyclub/snakeviz). It handles runtime and import +profiles, has minimal dependencies, uses [d3](https://d3js.org/) and +[bootstrap](https://getbootstrap.com/), and avoids +[certain](https://github.com/jiffyclub/snakeviz/issues/111) +[errors](https://github.com/jiffyclub/snakeviz/issues/112) present in SnakeViz (see +below) and is faster, too. + +Create a runtime profile with + +``` +python -mcProfile -o program.prof yourfile.py +``` + +or an [import +profile](https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPROFILEIMPORTTIME) +with + +``` +python -X importtime yourfile.py 2> import.log +``` + +and show it with + +``` +tuna program.prof +``` + + + +### Why tuna doesn't show the whole call tree + +The whole timed call tree _cannot_ be retrieved from profile data. Python developers +made the decision to only store _parent data_ in profiles because it can be computed +with little overhead. To illustrate, consider the following program. + +```python +import time + + +def a(t0, t1): + c(t0) + d(t1) + + +def b(): + a(1, 4) + + +def c(t): + time.sleep(t) + + +def d(t): + time.sleep(t) + + +if __name__ == "__main__": + a(4, 1) + b() +``` + +The root process (`__main__`) calls `a()` which spends 4 seconds in `c()` and 1 second +in `d()`. `__main__` also calls `b()` which calls `a()`, this time spending 1 second in +`c()` and 4 seconds in `d()`. The profile, however, will only store that `c()` spent a +total of 5 seconds when called from `a()`, and likewise `d()`. The information that the +program spent more time in `c()` when called in `root -> a() -> c()` than when called in +`root -> b() -> a() -> c()` is not present in the profile. + +tuna only displays the part of the timed call tree that can be deduced from the profile. +SnakeViz, on the other hand, tries to construct the entire call tree, but ends up +providing lots of _wrong_ timings. + +|  |  | +| :------------------------------------------------------------: | :-------------------------------------------------------------: | +| SnakeViz output. **Wrong.** | tuna output. Only shows what can be retrieved from the profile. | + +### Installation + +tuna is [available from the Python Package Index](https://pypi.org/project/tuna/), so +simply do + +``` +pip install tuna +``` + +to install. + +### Testing + +To run the tuna unit tests, check out this repository and type + +``` +pytest +``` + +### IPython magics + +tuna includes a `tuna` line / cell magic which can be used as a drop-in replacement for +the `prun` magic. Simply run `%load_ext tuna` to load the magic and then call it like +`%tuna sleep(3)` or + +```python +%%tuna +sleep(3) +``` + +`prun` is still used to do the actual profiling and then the results are displayed in +the notebook. + +### Development + +After forking and cloning the repository, make sure to run `make dep` to install +additional dependencies (bootstrap and d3) which aren't stored in the repo. + +### License + +This software is published under the [GPLv3 license](https://www.gnu.org/licenses/gpl-3.0.en.html). + + + + +%package -n python3-tuna +Summary: Visualize Python performance profiles +Provides: python-tuna +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-tuna +<p align="center"> + <a href="https://github.com/nschloe/tuna"><img alt="tuna" src="https://nschloe.github.io/tuna/logo-with-text.svg" width="50%"></a> + <p align="center">Performance analysis for Python.</p> +</p> + +[](https://pypi.org/project/tuna) +[](https://pypi.org/pypi/tuna/) +[](https://github.com/nschloe/tuna) +[](https://pepy.tech/project/tuna) +<!--[](https://pypistats.org/packages/tuna)--> + +[](https://discord.gg/hnTJ5MRX2Y) + +[](https://github.com/nschloe/tuna/actions?query=workflow%3Aci) +[](https://lgtm.com/projects/g/nschloe/tuna) +[](https://github.com/psf/black) +[](https://github.com/prettier/prettier) + +tuna is a modern, lightweight Python profile viewer inspired by +[SnakeViz](https://github.com/jiffyclub/snakeviz). It handles runtime and import +profiles, has minimal dependencies, uses [d3](https://d3js.org/) and +[bootstrap](https://getbootstrap.com/), and avoids +[certain](https://github.com/jiffyclub/snakeviz/issues/111) +[errors](https://github.com/jiffyclub/snakeviz/issues/112) present in SnakeViz (see +below) and is faster, too. + +Create a runtime profile with + +``` +python -mcProfile -o program.prof yourfile.py +``` + +or an [import +profile](https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPROFILEIMPORTTIME) +with + +``` +python -X importtime yourfile.py 2> import.log +``` + +and show it with + +``` +tuna program.prof +``` + + + +### Why tuna doesn't show the whole call tree + +The whole timed call tree _cannot_ be retrieved from profile data. Python developers +made the decision to only store _parent data_ in profiles because it can be computed +with little overhead. To illustrate, consider the following program. + +```python +import time + + +def a(t0, t1): + c(t0) + d(t1) + + +def b(): + a(1, 4) + + +def c(t): + time.sleep(t) + + +def d(t): + time.sleep(t) + + +if __name__ == "__main__": + a(4, 1) + b() +``` + +The root process (`__main__`) calls `a()` which spends 4 seconds in `c()` and 1 second +in `d()`. `__main__` also calls `b()` which calls `a()`, this time spending 1 second in +`c()` and 4 seconds in `d()`. The profile, however, will only store that `c()` spent a +total of 5 seconds when called from `a()`, and likewise `d()`. The information that the +program spent more time in `c()` when called in `root -> a() -> c()` than when called in +`root -> b() -> a() -> c()` is not present in the profile. + +tuna only displays the part of the timed call tree that can be deduced from the profile. +SnakeViz, on the other hand, tries to construct the entire call tree, but ends up +providing lots of _wrong_ timings. + +|  |  | +| :------------------------------------------------------------: | :-------------------------------------------------------------: | +| SnakeViz output. **Wrong.** | tuna output. Only shows what can be retrieved from the profile. | + +### Installation + +tuna is [available from the Python Package Index](https://pypi.org/project/tuna/), so +simply do + +``` +pip install tuna +``` + +to install. + +### Testing + +To run the tuna unit tests, check out this repository and type + +``` +pytest +``` + +### IPython magics + +tuna includes a `tuna` line / cell magic which can be used as a drop-in replacement for +the `prun` magic. Simply run `%load_ext tuna` to load the magic and then call it like +`%tuna sleep(3)` or + +```python +%%tuna +sleep(3) +``` + +`prun` is still used to do the actual profiling and then the results are displayed in +the notebook. + +### Development + +After forking and cloning the repository, make sure to run `make dep` to install +additional dependencies (bootstrap and d3) which aren't stored in the repo. + +### License + +This software is published under the [GPLv3 license](https://www.gnu.org/licenses/gpl-3.0.en.html). + + + + +%package help +Summary: Development documents and examples for tuna +Provides: python3-tuna-doc +%description help +<p align="center"> + <a href="https://github.com/nschloe/tuna"><img alt="tuna" src="https://nschloe.github.io/tuna/logo-with-text.svg" width="50%"></a> + <p align="center">Performance analysis for Python.</p> +</p> + +[](https://pypi.org/project/tuna) +[](https://pypi.org/pypi/tuna/) +[](https://github.com/nschloe/tuna) +[](https://pepy.tech/project/tuna) +<!--[](https://pypistats.org/packages/tuna)--> + +[](https://discord.gg/hnTJ5MRX2Y) + +[](https://github.com/nschloe/tuna/actions?query=workflow%3Aci) +[](https://lgtm.com/projects/g/nschloe/tuna) +[](https://github.com/psf/black) +[](https://github.com/prettier/prettier) + +tuna is a modern, lightweight Python profile viewer inspired by +[SnakeViz](https://github.com/jiffyclub/snakeviz). It handles runtime and import +profiles, has minimal dependencies, uses [d3](https://d3js.org/) and +[bootstrap](https://getbootstrap.com/), and avoids +[certain](https://github.com/jiffyclub/snakeviz/issues/111) +[errors](https://github.com/jiffyclub/snakeviz/issues/112) present in SnakeViz (see +below) and is faster, too. + +Create a runtime profile with + +``` +python -mcProfile -o program.prof yourfile.py +``` + +or an [import +profile](https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPROFILEIMPORTTIME) +with + +``` +python -X importtime yourfile.py 2> import.log +``` + +and show it with + +``` +tuna program.prof +``` + + + +### Why tuna doesn't show the whole call tree + +The whole timed call tree _cannot_ be retrieved from profile data. Python developers +made the decision to only store _parent data_ in profiles because it can be computed +with little overhead. To illustrate, consider the following program. + +```python +import time + + +def a(t0, t1): + c(t0) + d(t1) + + +def b(): + a(1, 4) + + +def c(t): + time.sleep(t) + + +def d(t): + time.sleep(t) + + +if __name__ == "__main__": + a(4, 1) + b() +``` + +The root process (`__main__`) calls `a()` which spends 4 seconds in `c()` and 1 second +in `d()`. `__main__` also calls `b()` which calls `a()`, this time spending 1 second in +`c()` and 4 seconds in `d()`. The profile, however, will only store that `c()` spent a +total of 5 seconds when called from `a()`, and likewise `d()`. The information that the +program spent more time in `c()` when called in `root -> a() -> c()` than when called in +`root -> b() -> a() -> c()` is not present in the profile. + +tuna only displays the part of the timed call tree that can be deduced from the profile. +SnakeViz, on the other hand, tries to construct the entire call tree, but ends up +providing lots of _wrong_ timings. + +|  |  | +| :------------------------------------------------------------: | :-------------------------------------------------------------: | +| SnakeViz output. **Wrong.** | tuna output. Only shows what can be retrieved from the profile. | + +### Installation + +tuna is [available from the Python Package Index](https://pypi.org/project/tuna/), so +simply do + +``` +pip install tuna +``` + +to install. + +### Testing + +To run the tuna unit tests, check out this repository and type + +``` +pytest +``` + +### IPython magics + +tuna includes a `tuna` line / cell magic which can be used as a drop-in replacement for +the `prun` magic. Simply run `%load_ext tuna` to load the magic and then call it like +`%tuna sleep(3)` or + +```python +%%tuna +sleep(3) +``` + +`prun` is still used to do the actual profiling and then the results are displayed in +the notebook. + +### Development + +After forking and cloning the repository, make sure to run `make dep` to install +additional dependencies (bootstrap and d3) which aren't stored in the repo. + +### License + +This software is published under the [GPLv3 license](https://www.gnu.org/licenses/gpl-3.0.en.html). + + + + +%prep +%autosetup -n tuna-0.5.11 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-tuna -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 10 2023 Python_Bot <Python_Bot@openeuler.org> - 0.5.11-1 +- Package Spec generated @@ -0,0 +1 @@ +cda69dfa691c9813249b48e7d42b2b8c tuna-0.5.11.tar.gz |
