Skip to content

Commit 199d89b

Browse files
redjaxredjax
and
redjax
authored
Add dependency groups: (#270)
all: Install all 3rd party modules that have a red_util fastapi: Utils for fastapi/uvicorn http: Utils for http requests. Includes a request client, cache, & serialization library Move all utils out of utils/ dir and into std or ext (for stdlib utils and "extended" utils for 3rd party modules) Co-authored-by: redjax <[email protected]>
1 parent 312cf98 commit 199d89b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+376
-74
lines changed

pdm.lock

+319-26
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+18-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dependencies = [
1212
"httpx>=0.24.1",
1313
"arrow>=1.2.3",
1414
"sqlalchemy>=2.0.20",
15-
"uvicorn>=0.23.2",
15+
"pendulum>=2.1.2",
1616
]
1717
requires-python = ">=3.10"
1818
readme = "README.md"
@@ -31,6 +31,23 @@ all = [
3131
"loguru>=0.7.0",
3232
"httpx>=0.24.1",
3333
"msgpack>=1.0.5",
34+
"pendulum>=2.1.2",
35+
]
36+
fastapi = [
37+
"fastapi>=0.103.1",
38+
"sqlalchemy>=2.0.21",
39+
"loguru>=0.7.2",
40+
"httpx>=0.25.0",
41+
"msgpack>=1.0.5",
42+
"uvicorn>=0.23.2",
43+
"pendulum>=2.1.2",
44+
]
45+
http = [
46+
"httpx>=0.25.0",
47+
"diskcache>=5.6.3",
48+
"loguru>=0.7.2",
49+
"pendulum>=2.1.2",
50+
"msgpack>=1.0.5",
3451
]
3552

3653
[build-system]

red_utils/__init__.py

+39-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,45 @@
11
from __future__ import annotations
2-
2+
import pkgutil
33
import sys
44

55
sys.path.append(".")
66

7-
from . import (
8-
domain,
9-
exc as exc,
10-
utils,
11-
)
7+
from . import domain
8+
from . import exc
9+
from . import std
10+
from . import ext
11+
1212
from .exc import CustomException
13+
14+
15+
16+
# pkg_import_map: dict = {"loguru": "red_utils.utils.loguru_utils"}
17+
18+
# def pkgutil_loader(package_import_map: dict = {}) -> None:
19+
# """For dependencies with requirements, ensure library is only imported
20+
# if namespace package is installed.
21+
22+
# Example:
23+
24+
# red_utils.utils.sqlalchemy_utils will only be imported if sqlalchemy is installed.
25+
26+
# """
27+
# if not package_import_map:
28+
# return ValueError("Package import mapping is empty, no additional utils will be imported.")
29+
30+
# if not isinstance(package_import_map, dict):
31+
# return TypeError(f"Invalid type for package_import_map: ({type(package_import_map)}). Must be a dict. No additional utils will be imported.")
32+
33+
# for k, v in package_import_map.items():
34+
# if not isinstance(k, str) or not isinstance(v, str):
35+
# return TypeError(f"""
36+
# Invalid key/value pair in package_import_map, keys and values must both be of type str.
37+
# Key [{k}]:({type(k)})
38+
# Value [{v}]:({type(v)}))
39+
# """
40+
# )
41+
42+
# if pkgutil.find_loader(k):
43+
# pkgutil.get_importer(v)
44+
45+
# pkgutil_loader(package_import_map=pkg_import_map)
File renamed without changes.

red_utils/utils/__init__.py

-41
This file was deleted.

0 commit comments

Comments
 (0)