-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Patch optional imports, documented predictor categorization, revamped…
… docs (#293) * add pre-commit to dev deps, update docs * update docs workflows * try updated docs workflow * see effects on docs * try to ignore loggers * doc revamp * keep using doc push on every push while deving * sphinxarg as dependency * more conditions * Bring back jupyter tags * bring back vf cell tag too * update predictor_binning * update agb * Update VF article * update admexplained * Add getting started guide * Further docstring improvements * Fix tests * don't import from python * Add inline dependencies to the cli * Delete uv.lock I don't want this part of the core lib (yet), may add it back later once we reach some more stability * update release ci to use pypi token * try v5 :) * skip one test * Release docs on public version release * Fixed optional imports, documented predictor categorization * tie polars to 1.16 - it was failing
- Loading branch information
Showing
11 changed files
with
148 additions
and
44 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 |
---|---|---|
|
@@ -34,3 +34,4 @@ python/*.ipynb_checkpoints/* | |
**/META-INF/* | ||
r/tests/testthat/d/tmp2 | ||
**/cache | ||
.venv |
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,9 +1,48 @@ | ||
""" | ||
My module docstring | ||
Does this work? | ||
Infinity API client for Pega Decision Management. | ||
""" | ||
|
||
from .client import AsyncInfinity, Infinity | ||
from importlib.util import find_spec | ||
from typing import TYPE_CHECKING, List | ||
|
||
from ..utils.namespaces import MissingDependenciesException | ||
|
||
if TYPE_CHECKING: | ||
from .client import Infinity | ||
|
||
|
||
class DependencyNotFound: | ||
def __init__(self, dependencies: List[str]): | ||
self.dependencies = dependencies | ||
self.namespace = "the DX API Client" | ||
self.deps_group = "api" | ||
|
||
def __repr__(self): | ||
return f"While importing, one or more dependencies were not found: {self.dependencies}" | ||
|
||
def __call__(self): | ||
raise MissingDependenciesException( | ||
self.dependencies, namespace=self.namespace, deps_group=self.deps_group | ||
) | ||
|
||
|
||
def __getattr__(name: str): | ||
"""Lazy import to avoid loading httpx until needed.""" | ||
if name == "Infinity": | ||
missing_dependencies: List[str] = [] | ||
if not find_spec("pydantic"): | ||
missing_dependencies.append("pydantic") | ||
if not find_spec("httpx"): | ||
missing_dependencies.append("httpx") | ||
|
||
if missing_dependencies: | ||
return DependencyNotFound(missing_dependencies) | ||
|
||
from .client import Infinity | ||
|
||
return Infinity | ||
|
||
raise AttributeError(f"module '{__name__}' has no attribute '{name}'") | ||
|
||
|
||
__all__ = ["Infinity", "AsyncInfinity"] | ||
__all__ = ["Infinity"] |
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