Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd3d0f8f

Browse files
chore(package): drop Python 3.8 support
1 parent65edc47 commitd3d0f8f

File tree

3 files changed

+7
-36
lines changed

3 files changed

+7
-36
lines changed

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<!-- prettier-ignore-->
44
[![PyPI version](https://img.shields.io/pypi/v/openlayer.svg?label=pypi%20(stable))](https://pypi.org/project/openlayer/)
55

6-
The Openlayer Python library provides convenient access to the Openlayer REST API from any Python 3.8+
6+
The Openlayer Python library provides convenient access to the Openlayer REST API from any Python 3.9+
77
application. The library includes type definitions for all request params and response fields,
88
and offers both synchronous and asynchronous clients powered by[httpx](https://github.com/encode/httpx).
99

@@ -515,7 +515,7 @@ print(openlayer.__version__)
515515

516516
##Requirements
517517

518-
Python 3.8 or higher.
518+
Python 3.9 or higher.
519519

520520
##Contributing
521521

‎pyproject.toml‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@ dependencies = [
2222
"tqdm",
2323
"wrapt>=1.14.0"
2424
]
25-
requires-python =">= 3.8"
25+
requires-python =">= 3.9"
2626
classifiers = [
2727
"Typing :: Typed",
2828
"Intended Audience :: Developers",
29-
"Programming Language :: Python :: 3.8",
3029
"Programming Language :: Python :: 3.9",
3130
"Programming Language :: Python :: 3.10",
3231
"Programming Language :: Python :: 3.11",
@@ -148,7 +147,7 @@ filterwarnings = [
148147
# there are a couple of flags that are still disabled by
149148
# default in strict mode as they are experimental and niche.
150149
typeCheckingMode ="strict"
151-
pythonVersion ="3.8"
150+
pythonVersion ="3.9"
152151

153152
exclude = [
154153
"_dev",

‎src/openlayer/_utils/_sync.py‎

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
from __future__importannotations
22

3-
importsys
43
importasyncio
54
importfunctools
6-
importcontextvars
7-
fromtypingimportAny,TypeVar,Callable,Awaitable
5+
fromtypingimportTypeVar,Callable,Awaitable
86
fromtyping_extensionsimportParamSpec
97

108
importanyio
@@ -15,34 +13,11 @@
1513
T_ParamSpec=ParamSpec("T_ParamSpec")
1614

1715

18-
ifsys.version_info>= (3,9):
19-
_asyncio_to_thread=asyncio.to_thread
20-
else:
21-
# backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread
22-
# for Python 3.8 support
23-
asyncdef_asyncio_to_thread(
24-
func:Callable[T_ParamSpec,T_Retval],/,*args:T_ParamSpec.args,**kwargs:T_ParamSpec.kwargs
25-
)->Any:
26-
"""Asynchronously run function *func* in a separate thread.
27-
28-
Any *args and **kwargs supplied for this function are directly passed
29-
to *func*. Also, the current :class:`contextvars.Context` is propagated,
30-
allowing context variables from the main thread to be accessed in the
31-
separate thread.
32-
33-
Returns a coroutine that can be awaited to get the eventual result of *func*.
34-
"""
35-
loop=asyncio.events.get_running_loop()
36-
ctx=contextvars.copy_context()
37-
func_call=functools.partial(ctx.run,func,*args,**kwargs)
38-
returnawaitloop.run_in_executor(None,func_call)
39-
40-
4116
asyncdefto_thread(
4217
func:Callable[T_ParamSpec,T_Retval],/,*args:T_ParamSpec.args,**kwargs:T_ParamSpec.kwargs
4318
)->T_Retval:
4419
ifsniffio.current_async_library()=="asyncio":
45-
returnawait_asyncio_to_thread(func,*args,**kwargs)
20+
returnawaitasyncio.to_thread(func,*args,**kwargs)
4621

4722
returnawaitanyio.to_thread.run_sync(
4823
functools.partial(func,*args,**kwargs),
@@ -53,10 +28,7 @@ async def to_thread(
5328
defasyncify(function:Callable[T_ParamSpec,T_Retval])->Callable[T_ParamSpec,Awaitable[T_Retval]]:
5429
"""
5530
Take a blocking function and create an async one that receives the same
56-
positional and keyword arguments. For python version 3.9 and above, it uses
57-
asyncio.to_thread to run the function in a separate thread. For python version
58-
3.8, it uses locally defined copy of the asyncio.to_thread function which was
59-
introduced in python 3.9.
31+
positional and keyword arguments.
6032
6133
Usage:
6234

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp