-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Adds support for Python 3.12, by @bymoye - Replaces `pkg_resources` with `importlib.resources` for all supported Python versions except for `3.8`. - Runs tests against Pydantic `2.4.2` instead of Pydantic `2.0` to check support for Pydantic v2. - Upgrades dependencies.
- Loading branch information
Showing
18 changed files
with
178 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,26 @@ | ||
from os import path | ||
""" | ||
This module offers methods to return file paths for resources. Its original purpose is | ||
to provide contents of static files stored for conveniency in the blacksheep.server.res | ||
package. | ||
""" | ||
|
||
import pkg_resources | ||
try: | ||
from importlib.resources import files | ||
|
||
def get_resource_file_path(anchor, file_name: str) -> str: | ||
return str(files(anchor) / file_name) | ||
|
||
except ImportError: | ||
# Python 3.8 | ||
import pkg_resources | ||
|
||
def get_resource_file_path(anchor, file_name: str) -> str: | ||
return pkg_resources.resource_filename(anchor, file_name) | ||
|
||
|
||
def get_resource_file_content(file_name: str) -> str: | ||
with open( | ||
pkg_resources.resource_filename(__name__, path.join(".", "res", file_name)), | ||
get_resource_file_path("blacksheep.server.res", file_name), | ||
mode="rt", | ||
) as source: | ||
return source.read() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import sys | ||
from datetime import MINYEAR, datetime, timezone | ||
|
||
UTC = timezone.utc | ||
|
||
MIN_DATETIME = datetime(MINYEAR, 1, 1, tzinfo=None) | ||
|
||
|
||
def utcnow() -> datetime: | ||
if sys.version_info < (3, 12): | ||
return datetime.utcnow() | ||
return datetime.now(UTC).replace(tzinfo=None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,59 @@ | ||
asgiref==3.5.2 | ||
attrs==22.1.0 | ||
certifi==2022.12.7 | ||
cffi==1.15.1 | ||
charset-normalizer==3.1.0 | ||
click==8.1.3 | ||
coverage==6.5.0 | ||
cryptography==41.0.0 | ||
Cython==3.0.2; platform_system != "Windows" | ||
annotated-types==0.6.0 | ||
asgiref==3.7.2 | ||
attrs==23.1.0 | ||
blinker==1.6.3 | ||
certifi==2023.7.22 | ||
cffi==1.16.0 | ||
charset-normalizer==3.3.1 | ||
click==8.1.7 | ||
coverage==7.3.2 | ||
cryptography==41.0.4 | ||
Cython==3.0.4; platform_system != "Windows" | ||
essentials==1.1.5 | ||
essentials-openapi==1.0.6 | ||
Flask==2.2.3 | ||
gevent==22.10.1 | ||
greenlet==1.1.3.post0 | ||
guardpost~=1.0.0 | ||
h11==0.11.0 | ||
essentials-openapi==1.0.8 | ||
Flask==3.0.0 | ||
gevent==23.9.1 | ||
greenlet==3.0.0 | ||
guardpost==1.0.2 | ||
h11==0.14.0 | ||
h2==4.1.0 | ||
hpack==4.0.0 | ||
httptools==0.5.0 | ||
hypercorn==0.14.3 | ||
httptools==0.6.1 | ||
hypercorn==0.14.4 | ||
hyperframe==6.0.1 | ||
idna==3.4 | ||
iniconfig==1.1.1 | ||
iniconfig==2.0.0 | ||
itsdangerous==2.1.2 | ||
Jinja2==3.1.2 | ||
MarkupSafe==2.1.2 | ||
mccabe==0.6.1 | ||
packaging==21.3 | ||
pluggy==1.0.0 | ||
MarkupSafe==2.1.3 | ||
mccabe==0.7.0 | ||
packaging==23.2 | ||
pluggy==1.3.0 | ||
priority==2.0.0 | ||
py==1.11.0 | ||
pycparser==2.21 | ||
pydantic==1.10.2 | ||
PyJWT==2.6.0 | ||
pyparsing==3.0.9 | ||
pytest==7.3.1 | ||
pytest-asyncio==0.20.1 | ||
pytest-cov==4.0.0 | ||
pydantic==2.4.2 | ||
pydantic_core==2.10.1 | ||
PyJWT==2.8.0 | ||
pyparsing==3.1.1 | ||
pytest==7.4.2 | ||
pytest-asyncio==0.21.1 | ||
pytest-cov==4.1.0 | ||
python-dateutil==2.8.2 | ||
PyYAML==6.0 | ||
rodi~=2.0.2 | ||
regex==2023.3.23 | ||
requests==2.28.2 | ||
PyYAML==6.0.1 | ||
regex==2023.10.3 | ||
requests==2.31.0 | ||
rodi==2.0.3 | ||
setuptools==68.2.2 | ||
six==1.16.0 | ||
toml==0.10.1 | ||
toml==0.10.2 | ||
tomli==2.0.1 | ||
typing_extensions==4.4.0 | ||
urllib3==1.26.12 | ||
uvicorn==0.21.1 | ||
wcwidth==0.2.5 | ||
websockets==11.0.2 | ||
Werkzeug==2.2.2 | ||
typing_extensions==4.8.0 | ||
urllib3==2.0.7 | ||
uvicorn==0.23.2 | ||
wcwidth==0.2.8 | ||
websockets==12.0 | ||
Werkzeug==3.0.0 | ||
wsproto==1.2.0 | ||
zope.event==4.5.0 | ||
zope.interface==5.5.0 | ||
zope.event==5.0 | ||
zope.interface==6.1 |
Oops, something went wrong.