Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dltype/_lib/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import inspect
import itertools
import logging
import warnings
from functools import lru_cache, wraps
from typing import (
Expand All @@ -31,14 +30,15 @@
_dltype_context,
_dtypes,
_errors,
_log_utils,
_tensor_type_base,
)

if TYPE_CHECKING:
from collections.abc import Callable


_logger: Final = logging.getLogger(__name__)
_logger: Final = _log_utils.get_logger(__name__)

P = ParamSpec("P")
R = TypeVar("R")
Expand Down
5 changes: 2 additions & 3 deletions dltype/_lib/_dltype_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

from __future__ import annotations

import logging
import time
import warnings
from collections import deque
from typing import Any, Final, NamedTuple, TypeAlias, cast

from dltype._lib import _constants, _dtypes, _errors, _parser, _tensor_type_base
from dltype._lib import _constants, _dtypes, _errors, _log_utils, _parser, _tensor_type_base

_logger: Final = logging.getLogger(__name__)
_logger: Final = _log_utils.get_logger(__name__)

EvaluatedDimensionT: TypeAlias = dict[str, int]

Expand Down
31 changes: 31 additions & 0 deletions dltype/_lib/_log_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""Utilities for logging in the dltype library."""

import logging
import typing

from dltype._lib import _constants


class DummyLogger:
def debug(self, *args: typing.Any) -> None: # noqa: ANN401
pass

def info(self, *args: typing.Any) -> None: # noqa: ANN401
pass

def warning(self, *args: typing.Any) -> None: # noqa: ANN401
pass

def error(self, *args: typing.Any) -> None: # noqa: ANN401
pass

def exception(self, *args: typing.Any) -> None: # noqa: ANN401
pass


def get_logger(name: str) -> logging.Logger | DummyLogger:
if _constants.GLOBAL_DISABLE:
return DummyLogger()
if not _constants.DEBUG_MODE:
return DummyLogger()
return logging.getLogger(name)
5 changes: 3 additions & 2 deletions dltype/_lib/_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
from __future__ import annotations

import enum
import logging
import math
import re
import typing

from typing_extensions import override

_logger: typing.Final = logging.getLogger(__name__)
from dltype._lib import _log_utils

_logger: typing.Final = _log_utils.get_logger(__name__)


class _DLTypeSpecifier(enum.Enum):
Expand Down
4 changes: 1 addition & 3 deletions dltype/_lib/_tensor_type_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
_parser,
_symbolic_expressions,
)
from dltype._lib import (
_dependency_utilities as _deps,
)
from dltype._lib import _dependency_utilities as _deps

if typing.TYPE_CHECKING:
from pydantic import GetCoreSchemaHandler, ValidationInfo
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ license-files = ["LICENSE"]
name = "dltype"
readme = "README.md"
requires-python = ">=3.10"
version = "0.11.0"
version = "0.12.0"

[project.optional-dependencies]
jax = ["jax>=0.6.2"]
Expand Down
10 changes: 5 additions & 5 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.