- Update to 1.4.0

* Rename TestEventLoopPolicy so that pytest doesn't complain (#44)
  * Change Unfuture.then to pass result() instead of itself to the
    continuation (#41)

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-unsync?expand=0&rev=5
This commit is contained in:
Markéta Machová 2025-01-16 13:09:27 +00:00 committed by Git OBS Bridge
commit bcf049e82c
7 changed files with 143 additions and 0 deletions

23
.gitattributes vendored Normal file
View 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
View File

@ -0,0 +1 @@
.osc

31
python-unsync.changes Normal file
View File

@ -0,0 +1,31 @@
-------------------------------------------------------------------
Thu Jan 16 12:36:55 UTC 2025 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Update to 1.4.0
* Rename TestEventLoopPolicy so that pytest doesn't complain (#44)
* Change Unfuture.then to pass result() instead of itself to the
continuation (#41)
-------------------------------------------------------------------
Tue Jan 7 08:46:22 UTC 2025 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Update to version 1.3.2
* Delete print("DERP") (#39)
- from version 1.3.1
* Add a multi-process example
* Cleanup README
* Modify async example in documentation (#36)
* Support setting custom event loops (#34)
* Refactor lazy initialized unsync class members into properties
- Switch package to modern Python Stack on SLE-15
* Use Python 3.11 on SLE-15 by default
* Drop support for older Python versions
- Switch build system from setuptools to pyproject.toml
* Add python-pip and python-wheel to BuildRequires
* Replace %python_build with %pyproject_wheel
* Replace %python_install with %pyproject_install
-------------------------------------------------------------------
Sat Jan 2 01:40:00 UTC 2021 - Matej Cepl <mcepl@suse.com>
- Initial packaging of unsync 1.3.

79
python-unsync.spec Normal file
View File

@ -0,0 +1,79 @@
#
# spec file for package python-unsync
#
# Copyright (c) 2025 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/
#
%{?sle15_python_module_pythons}
%define modname unsync
Name: python-unsync
Version: 1.4.0
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 pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
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
%pyproject_wheel
%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%pyunittest -v
%files %{python_files}
%{python_sitelib}/*
%changelog

3
unsync-1.3.2.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:511124deb8135718d1b27361ceca1d61a48c224d242fb6a204f082a972d76dba
size 8945

3
unsync-1.3.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c1c585a7b5e108b89cb40ef2af99fe10ba49011a81985dfea100305c13c5b839
size 8284

3
unsync-1.4.0.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:add9c8f402a8c886b3b392ca4236f661d833740444c117a21a7e9cccb60fa60e
size 8952