Accepting request 859775 from home:mcepl:work
Looks like a good addition to asyncio. OBS-URL: https://build.opensuse.org/request/show/859775 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-unsync?expand=0&rev=1
This commit is contained in:
commit
93ac13aafb
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
## Default LFS
|
||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.osc
|
4
python-unsync.changes
Normal file
4
python-unsync.changes
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Sat Jan 2 01:40:00 UTC 2021 - Matej Cepl <mcepl@suse.com>
|
||||||
|
|
||||||
|
- Initial packaging of unsync 1.3.
|
77
python-unsync.spec
Normal file
77
python-unsync.spec
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
#
|
||||||
|
# spec file for package python-unsync
|
||||||
|
#
|
||||||
|
# Copyright (c) 2021 SUSE LLC
|
||||||
|
#
|
||||||
|
# All modifications and additions to the file contributed by third parties
|
||||||
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
|
# upon. The license for this file, and modifications and additions to the
|
||||||
|
# file, is the same license as for the pristine package itself (unless the
|
||||||
|
# license for the pristine package is not an Open Source License, in which
|
||||||
|
# case the license is the MIT License). An "Open Source License" is a
|
||||||
|
# license that conforms to the Open Source Definition (Version 1.9)
|
||||||
|
# published by the Open Source Initiative.
|
||||||
|
|
||||||
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||||
|
#
|
||||||
|
|
||||||
|
%define skip_python2 1
|
||||||
|
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||||
|
%define modname unsync
|
||||||
|
Name: python-unsync
|
||||||
|
Version: 1.3
|
||||||
|
Release: 0
|
||||||
|
Summary: Unsynchronize asyncio
|
||||||
|
License: MIT
|
||||||
|
URL: https://github.com/alex-sherman/unsync
|
||||||
|
Source: https://github.com/alex-sherman/%{modname}/archive/v%{version}.tar.gz#/%{modname}-%{version}.tar.gz
|
||||||
|
BuildRequires: %{python_module setuptools}
|
||||||
|
BuildRequires: fdupes
|
||||||
|
BuildRequires: python-rpm-macros
|
||||||
|
BuildArch: noarch
|
||||||
|
%python_subpackages
|
||||||
|
|
||||||
|
%description
|
||||||
|
# unsync
|
||||||
|
Unsynchronize `asyncio` by using an ambient event loop in a separate thread.
|
||||||
|
|
||||||
|
# Rules for unsync
|
||||||
|
1. Mark all async functions with `@unsync`. May also mark regular
|
||||||
|
functions to execute in a separate thread.
|
||||||
|
* All `@unsync` functions, async or not, return an `Unfuture`
|
||||||
|
2. All `Futures` must be `Unfutures` which includes the result of an
|
||||||
|
`@unsync` function call, or wrapping `Unfuture(asyncio.Future)` or
|
||||||
|
`Unfuture(concurrent.Future)`. `Unfuture` combines the behavior of
|
||||||
|
`asyncio.Future` and `concurrent.Future`:
|
||||||
|
* `Unfuture.set_value` is threadsafe unlike `asyncio.Future`
|
||||||
|
* `Unfuture` instances can be awaited, even if made from
|
||||||
|
`concurrent.Future`
|
||||||
|
* `Unfuture.result()` is a blocking operation *except* in
|
||||||
|
`unsync.loop`/`unsync.thread` where it behaves like
|
||||||
|
`asyncio.Future.result` and will throw an exception if the future
|
||||||
|
is not done
|
||||||
|
3. Functions will execute in different contexts:
|
||||||
|
* `@unsync` async functions will execute in an event loop in
|
||||||
|
`unsync.thread`
|
||||||
|
* `@unsync` regular functions will execute in
|
||||||
|
`unsync.thread_executor`, a `ThreadPoolExecutor`
|
||||||
|
* `@unsync(cpu_bound=True)` regular functions will execute in
|
||||||
|
`unsync.process_executor`, a `ProcessPoolExecutor`
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q -n unsync-%{version}
|
||||||
|
|
||||||
|
%build
|
||||||
|
%python_build
|
||||||
|
|
||||||
|
%install
|
||||||
|
%python_install
|
||||||
|
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||||
|
|
||||||
|
%check
|
||||||
|
%pyunittest -v
|
||||||
|
|
||||||
|
%files %{python_files}
|
||||||
|
%{python_sitelib}/*
|
||||||
|
|
||||||
|
%changelog
|
3
unsync-1.3.tar.gz
Normal file
3
unsync-1.3.tar.gz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:c1c585a7b5e108b89cb40ef2af99fe10ba49011a81985dfea100305c13c5b839
|
||||||
|
size 8284
|
Loading…
x
Reference in New Issue
Block a user