summaryrefslogtreecommitdiff
path: root/python-thread6.spec
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-04-11 22:00:05 +0000
committerCoprDistGit <infra@openeuler.org>2023-04-11 22:00:05 +0000
commit007e7700f26ea37ca962dd73a51ebe83a279f982 (patch)
tree505af732e98a028eb6687c7052ca29971f207ff9 /python-thread6.spec
parent82d7fa5e43f759258669e74ed78890fb1786316d (diff)
automatic import of python-thread6
Diffstat (limited to 'python-thread6.spec')
-rw-r--r--python-thread6.spec237
1 files changed, 237 insertions, 0 deletions
diff --git a/python-thread6.spec b/python-thread6.spec
new file mode 100644
index 0000000..f150c66
--- /dev/null
+++ b/python-thread6.spec
@@ -0,0 +1,237 @@
+%global _empty_manifest_terminate_build 0
+Name: python-thread6
+Version: 0.2.0
+Release: 1
+Summary: A plug n play multithreading interface
+License: MIT License
+URL: https://github.com/Haizzz/thread6
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/39/f2/cd7b53367c00a0e4a37c53c5b18007a50fb66f19331699c894c918230b8b/thread6-0.2.0.tar.gz
+BuildArch: noarch
+
+
+%description
+# thread6
+Simple parallel processing interface for python
+
+## Why?
+Python's built in parallel processing and threading library is pretty simple to implement but sometimes you just want to chuck data at a function and make it run faster
+
+## Requirements
+Python 3+
+
+## Installation
+
+## Quickstart
+Use the `threaded` decorator to turn a method into a threaded method. That's it!
+```python
+@thread6.threaded()
+def threaded_print():
+ print("")
+ return 1
+```
+
+Alternatively, use `run_threaded` function
+```python
+thread6.run_threaded(threaded_print)
+```
+
+Both the `threaded` decorator and `run_threaded` method will return an instance of
+`ResultThread`. This allow you to optionally wait for the function to finish executing
+and get the return value. To get the return value, use `.await_output()`
+```python
+result = threaded_print()
+result.await_output() # this will return 1
+```
+
+If you have a function that needs to execute on a large list of data, use `run_chunked`
+```python
+def update_items(items):
+ ...
+
+items = [...]
+thread6.run_chunked(update_items, items)
+```
+`.await_output()` also work with `run_chunked` but will return a list of return values instead
+
+## Usage
+
+
+## Todo
+- [x] threaded function decorator
+- [x] run something in a separate thread function
+- [x] split data into chunk and run in separate threads
+- [ ] add way for errors to fail loudly
+- [ ] auto spawn to run fx on a set of data
+- [ ] explore multi processing?
+
+
+
+
+%package -n python3-thread6
+Summary: A plug n play multithreading interface
+Provides: python-thread6
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-thread6
+# thread6
+Simple parallel processing interface for python
+
+## Why?
+Python's built in parallel processing and threading library is pretty simple to implement but sometimes you just want to chuck data at a function and make it run faster
+
+## Requirements
+Python 3+
+
+## Installation
+
+## Quickstart
+Use the `threaded` decorator to turn a method into a threaded method. That's it!
+```python
+@thread6.threaded()
+def threaded_print():
+ print("")
+ return 1
+```
+
+Alternatively, use `run_threaded` function
+```python
+thread6.run_threaded(threaded_print)
+```
+
+Both the `threaded` decorator and `run_threaded` method will return an instance of
+`ResultThread`. This allow you to optionally wait for the function to finish executing
+and get the return value. To get the return value, use `.await_output()`
+```python
+result = threaded_print()
+result.await_output() # this will return 1
+```
+
+If you have a function that needs to execute on a large list of data, use `run_chunked`
+```python
+def update_items(items):
+ ...
+
+items = [...]
+thread6.run_chunked(update_items, items)
+```
+`.await_output()` also work with `run_chunked` but will return a list of return values instead
+
+## Usage
+
+
+## Todo
+- [x] threaded function decorator
+- [x] run something in a separate thread function
+- [x] split data into chunk and run in separate threads
+- [ ] add way for errors to fail loudly
+- [ ] auto spawn to run fx on a set of data
+- [ ] explore multi processing?
+
+
+
+
+%package help
+Summary: Development documents and examples for thread6
+Provides: python3-thread6-doc
+%description help
+# thread6
+Simple parallel processing interface for python
+
+## Why?
+Python's built in parallel processing and threading library is pretty simple to implement but sometimes you just want to chuck data at a function and make it run faster
+
+## Requirements
+Python 3+
+
+## Installation
+
+## Quickstart
+Use the `threaded` decorator to turn a method into a threaded method. That's it!
+```python
+@thread6.threaded()
+def threaded_print():
+ print("")
+ return 1
+```
+
+Alternatively, use `run_threaded` function
+```python
+thread6.run_threaded(threaded_print)
+```
+
+Both the `threaded` decorator and `run_threaded` method will return an instance of
+`ResultThread`. This allow you to optionally wait for the function to finish executing
+and get the return value. To get the return value, use `.await_output()`
+```python
+result = threaded_print()
+result.await_output() # this will return 1
+```
+
+If you have a function that needs to execute on a large list of data, use `run_chunked`
+```python
+def update_items(items):
+ ...
+
+items = [...]
+thread6.run_chunked(update_items, items)
+```
+`.await_output()` also work with `run_chunked` but will return a list of return values instead
+
+## Usage
+
+
+## Todo
+- [x] threaded function decorator
+- [x] run something in a separate thread function
+- [x] split data into chunk and run in separate threads
+- [ ] add way for errors to fail loudly
+- [ ] auto spawn to run fx on a set of data
+- [ ] explore multi processing?
+
+
+
+
+%prep
+%autosetup -n thread6-0.2.0
+
+%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-thread6 -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 0.2.0-1
+- Package Spec generated