-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f0a520
commit 3b6deee
Showing
9 changed files
with
155 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" | |
|
||
[tool.poetry] | ||
name = "asgikit" | ||
version = "0.0.0" | ||
version = "0.8.0" | ||
description = "Toolkit for building ASGI applications and libraries" | ||
authors = ["Livio Ribeiro <[email protected]>"] | ||
license = "MIT" | ||
|
@@ -40,23 +40,26 @@ optional = true | |
|
||
[tool.poetry.group.dev.dependencies] | ||
uvicorn = { version = "^0.29", extras = ["standard"] } | ||
granian = "^1.3" | ||
pylint = "^3.1" | ||
flake8 = "^7.0" | ||
mypy = "^1.9" | ||
mypy = "^1.10" | ||
isort = "^5.13" | ||
black = "^24.3" | ||
ruff = "^0.3" | ||
black = "^24.4" | ||
ruff = "^0.4" | ||
|
||
[tool.poetry.group.test] | ||
optional = true | ||
|
||
[tool.poetry.group.test.dependencies] | ||
pytest = "^8.1" | ||
pytest = "^8.2" | ||
pytest-asyncio = "^0.23" | ||
pytest-cov = "^5.0" | ||
coverage = { version = "^7.4", extras = ["toml"] } | ||
coverage = { version = "^7.5", extras = ["toml"] } | ||
httpx = "^0.27" | ||
asgiref = "^3.8" | ||
orjson = "^3.10" | ||
msgspec = "^0.18" | ||
|
||
[tool.pytest.ini_options] | ||
asyncio_mode = "auto" | ||
|
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,7 +1,7 @@ | ||
__all__ = ( | ||
"errors", | ||
"headers", | ||
"multi_value_dict", | ||
"util", | ||
"query", | ||
"requests", | ||
"responses", | ||
|
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,32 @@ | ||
import importlib | ||
import os | ||
|
||
|
||
def _import(dotted_path: str): | ||
if "." not in dotted_path: | ||
raise ValueError(dotted_path) | ||
|
||
module_name, attibute_name = dotted_path.rsplit(".", maxsplit=1) | ||
module = importlib.import_module(module_name) | ||
return getattr(module, attibute_name) | ||
|
||
|
||
if json_encoder := os.environ.get("ASGIKIT_JSON_ENCODER"): | ||
if "," in json_encoder: | ||
encoder, decoder = [ | ||
name.strip() for name in json_encoder.split(",", maxsplit=1) | ||
] | ||
else: | ||
name = json_encoder.strip() | ||
encoder = f"{name}.dumps" | ||
decoder = f"{name}.loads" | ||
try: | ||
JSON_ENCODER = _import(encoder) | ||
JSON_DECODER = _import(decoder) | ||
except ImportError as err: | ||
raise ValueError(f"Invalid ASGIKIT_JSON_ENCODER: {json_encoder}") from err | ||
else: | ||
import json | ||
|
||
JSON_ENCODER = json.dumps | ||
JSON_DECODER = json.loads |
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
Oops, something went wrong.