From 2b13ff9ec25248af3bb97fe06a21a17755275c37 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Fri, 5 May 2023 09:37:40 +0000 Subject: automatic import of python-flask-server-timing --- .gitignore | 1 + python-flask-server-timing.spec | 312 ++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 314 insertions(+) create mode 100644 python-flask-server-timing.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..081a185 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/flask-server-timing-0.1.2.tar.gz diff --git a/python-flask-server-timing.spec b/python-flask-server-timing.spec new file mode 100644 index 0000000..5de9b16 --- /dev/null +++ b/python-flask-server-timing.spec @@ -0,0 +1,312 @@ +%global _empty_manifest_terminate_build 0 +Name: python-flask-server-timing +Version: 0.1.2 +Release: 1 +Summary: Python Flask Server-Timing Header Extension +License: Apache License 2.0 +URL: https://github.com/rodrobin/flask-server-timing +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/6c/21/f14bcfdc7a9554949d2a87a73ce5c1b7802cf359f5fca5ef33f07669eaf8/flask-server-timing-0.1.2.tar.gz +BuildArch: noarch + + +%description +# Flask Server-Timing Header Extension + +A Flask extension to easily add the Server-Timing header to allow supported browsers to show backend performance metrics. + +From the [Mozilla Developer site](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Server-Timing): + +> The Server-Timing header communicates one or more metrics and descriptions for a given request-response cycle. It is used to surface any backend server timing metrics (e.g. database read/write, CPU time, file system access, etc.) in the developer tools in the user's browser + + +The Server-Timing specification is a [W3C draft](https://www.w3.org/TR/server-timing) + +## Installation + +``` +pip install flask-server-timing +``` + +Python versions 2.7 and 3.x are supported with Flask from version 0.10.1. + +## Browser Support + +Generally all newer, major browsers - excluding IE and Safari - support visualizing the Server-Timing header. For an up-to-date list with specific versions see the [Mozilla Developer](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Server-Timing#Browser_compatibility) site + +## Usage + +```python +from flask import Flask +import time + +# Import extension +from from server_timing import Timing + +app = Flask(__name__) + +# To initialize the extension simply pass the app to it. If the app is in debug +# mode or the force_debug parameter is True an after-request handler will be added +# to write the actual header. +t = Timing(app, force_debug=True) + + +@app.route("/examples") +def examples(): + # explicitly calling start and stop before and after - keys need to be identical + t.start('done and done') + time.sleep(0.3) + t.stop('done and done') + + # context manager support to avoid having to call start and stop explicitly + with t.time('context'): + time.sleep(0.2) + + # decorated with name being the key + named_decoration() + # decorated without name so the function is the key + unnamed_decoration() + +@t.timer(name='named') +def named_decoration(): + time.sleep(0.4) + +@t.timer +def unnamed_decoration(): + time.sleep(0.5) + + +app.run(host="0.0.0.0",port=8080) +``` + +The `example/` directory also contains the following file showing how to time functions in other modules: + +```python +import time + +# before this file is imported make sure the extension has been initialized with the Flask app +from server_timing import Timing as t + + +@t.timer +def include(): + time.sleep(0.1) +``` + +%package -n python3-flask-server-timing +Summary: Python Flask Server-Timing Header Extension +Provides: python-flask-server-timing +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-flask-server-timing +# Flask Server-Timing Header Extension + +A Flask extension to easily add the Server-Timing header to allow supported browsers to show backend performance metrics. + +From the [Mozilla Developer site](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Server-Timing): + +> The Server-Timing header communicates one or more metrics and descriptions for a given request-response cycle. It is used to surface any backend server timing metrics (e.g. database read/write, CPU time, file system access, etc.) in the developer tools in the user's browser + + +The Server-Timing specification is a [W3C draft](https://www.w3.org/TR/server-timing) + +## Installation + +``` +pip install flask-server-timing +``` + +Python versions 2.7 and 3.x are supported with Flask from version 0.10.1. + +## Browser Support + +Generally all newer, major browsers - excluding IE and Safari - support visualizing the Server-Timing header. For an up-to-date list with specific versions see the [Mozilla Developer](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Server-Timing#Browser_compatibility) site + +## Usage + +```python +from flask import Flask +import time + +# Import extension +from from server_timing import Timing + +app = Flask(__name__) + +# To initialize the extension simply pass the app to it. If the app is in debug +# mode or the force_debug parameter is True an after-request handler will be added +# to write the actual header. +t = Timing(app, force_debug=True) + + +@app.route("/examples") +def examples(): + # explicitly calling start and stop before and after - keys need to be identical + t.start('done and done') + time.sleep(0.3) + t.stop('done and done') + + # context manager support to avoid having to call start and stop explicitly + with t.time('context'): + time.sleep(0.2) + + # decorated with name being the key + named_decoration() + # decorated without name so the function is the key + unnamed_decoration() + +@t.timer(name='named') +def named_decoration(): + time.sleep(0.4) + +@t.timer +def unnamed_decoration(): + time.sleep(0.5) + + +app.run(host="0.0.0.0",port=8080) +``` + +The `example/` directory also contains the following file showing how to time functions in other modules: + +```python +import time + +# before this file is imported make sure the extension has been initialized with the Flask app +from server_timing import Timing as t + + +@t.timer +def include(): + time.sleep(0.1) +``` + +%package help +Summary: Development documents and examples for flask-server-timing +Provides: python3-flask-server-timing-doc +%description help +# Flask Server-Timing Header Extension + +A Flask extension to easily add the Server-Timing header to allow supported browsers to show backend performance metrics. + +From the [Mozilla Developer site](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Server-Timing): + +> The Server-Timing header communicates one or more metrics and descriptions for a given request-response cycle. It is used to surface any backend server timing metrics (e.g. database read/write, CPU time, file system access, etc.) in the developer tools in the user's browser + + +The Server-Timing specification is a [W3C draft](https://www.w3.org/TR/server-timing) + +## Installation + +``` +pip install flask-server-timing +``` + +Python versions 2.7 and 3.x are supported with Flask from version 0.10.1. + +## Browser Support + +Generally all newer, major browsers - excluding IE and Safari - support visualizing the Server-Timing header. For an up-to-date list with specific versions see the [Mozilla Developer](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Server-Timing#Browser_compatibility) site + +## Usage + +```python +from flask import Flask +import time + +# Import extension +from from server_timing import Timing + +app = Flask(__name__) + +# To initialize the extension simply pass the app to it. If the app is in debug +# mode or the force_debug parameter is True an after-request handler will be added +# to write the actual header. +t = Timing(app, force_debug=True) + + +@app.route("/examples") +def examples(): + # explicitly calling start and stop before and after - keys need to be identical + t.start('done and done') + time.sleep(0.3) + t.stop('done and done') + + # context manager support to avoid having to call start and stop explicitly + with t.time('context'): + time.sleep(0.2) + + # decorated with name being the key + named_decoration() + # decorated without name so the function is the key + unnamed_decoration() + +@t.timer(name='named') +def named_decoration(): + time.sleep(0.4) + +@t.timer +def unnamed_decoration(): + time.sleep(0.5) + + +app.run(host="0.0.0.0",port=8080) +``` + +The `example/` directory also contains the following file showing how to time functions in other modules: + +```python +import time + +# before this file is imported make sure the extension has been initialized with the Flask app +from server_timing import Timing as t + + +@t.timer +def include(): + time.sleep(0.1) +``` + +%prep +%autosetup -n flask-server-timing-0.1.2 + +%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-flask-server-timing -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot - 0.1.2-1 +- Package Spec generated diff --git a/sources b/sources new file mode 100644 index 0000000..566a5c6 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +34b0e9f07378d3fe58849f3b5e159a54 flask-server-timing-0.1.2.tar.gz -- cgit v1.2.3