prediction-market-agent-tooling 0.56.2.dev139__tar.gz → 0.56.2.dev145__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/PKG-INFO +1 -2
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/loggers.py +16 -38
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/caches/db_cache.py +1 -2
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/pyproject.toml +1 -2
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/LICENSE +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/README.md +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/abis/debuggingcontract.abi.json +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/abis/depositablewrapper_erc20.abi.json +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/abis/erc20.abi.json +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/abis/erc4626.abi.json +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/abis/omen_agentresultmapping.abi.json +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/abis/omen_dxdao.abi.json +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/abis/omen_fpmm.abi.json +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/abis/omen_fpmm_conditionaltokens.abi.json +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/abis/omen_fpmm_factory.abi.json +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/abis/omen_kleros.abi.json +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/abis/omen_oracle.abi.json +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/abis/omen_realitio.abi.json +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/abis/omen_thumbnailmapping.abi.json +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/abis/proxy.abi.json +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/benchmark/__init__.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/benchmark/agents.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/benchmark/benchmark.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/benchmark/utils.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/config.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/deploy/agent.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/deploy/agent_example.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/deploy/betting_strategy.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/deploy/constants.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/deploy/gcp/deploy.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/deploy/gcp/kubernetes_models.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/deploy/gcp/utils.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/deploy/trade_interval.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/gtypes.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/jobs/__init__.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/jobs/jobs_models.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/jobs/omen/omen_jobs.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/agent_market.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/base_subgraph_handler.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/categorize.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/data_models.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/manifold/__init__.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/manifold/api.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/manifold/data_models.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/manifold/manifold.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/manifold/utils.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/market_fees.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/markets.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/metaculus/api.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/metaculus/data_models.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/metaculus/metaculus.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/omen/__init__.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/omen/data_models.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/omen/omen.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/omen/omen_contracts.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/omen/omen_resolving.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/omen/omen_subgraph_handler.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/polymarket/api.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/polymarket/data_models.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/polymarket/data_models_web.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/polymarket/polymarket.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/polymarket/utils.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/seer/data_models.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/markets/seer/seer_subgraph_handler.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/monitor/markets/manifold.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/monitor/markets/metaculus.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/monitor/markets/omen.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/monitor/markets/polymarket.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/monitor/monitor.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/monitor/monitor_app.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/monitor/monitor_settings.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/py.typed +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/balances.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/betting_strategies/kelly_criterion.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/betting_strategies/market_moving.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/betting_strategies/minimum_bet_to_win.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/betting_strategies/stretch_bet_between.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/betting_strategies/utils.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/caches/inmemory_cache.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/contract.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/costs.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/datetime_utc.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/gnosis_rpc.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/google.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/hexbytes_custom.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/httpx_cached_client.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/image_gen/image_gen.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/image_gen/market_thumbnail_gen.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/ipfs/ipfs_handler.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/is_invalid.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/is_predictable.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/langfuse_.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/langfuse_client_utils.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/omen/reality_accuracy.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/parallelism.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/pickle_utils.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/relevant_news_analysis/data_models.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/relevant_news_analysis/relevant_news_analysis.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/relevant_news_analysis/relevant_news_cache.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/safe.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/singleton.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/streamlit_user_login.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/tavily/tavily_models.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/tavily/tavily_search.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/utils.py +0 -0
- {prediction_market_agent_tooling-0.56.2.dev139 → prediction_market_agent_tooling-0.56.2.dev145}/prediction_market_agent_tooling/tools/web3_utils.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: prediction-market-agent-tooling
|
3
|
-
Version: 0.56.2.
|
3
|
+
Version: 0.56.2.dev145
|
4
4
|
Summary: Tools to benchmark, deploy and monitor prediction market agents.
|
5
5
|
Author: Gnosis
|
6
6
|
Requires-Python: >=3.10,<3.12
|
@@ -26,7 +26,6 @@ Requires-Dist: langchain (>=0.2.6,<0.3.0) ; extra == "langchain"
|
|
26
26
|
Requires-Dist: langchain-community (>=0.0.19)
|
27
27
|
Requires-Dist: langchain-openai (>=0.1.0,<0.2.0) ; extra == "langchain"
|
28
28
|
Requires-Dist: langfuse (>=2.42.0,<3.0.0)
|
29
|
-
Requires-Dist: loguru (>=0.7.2,<0.8.0)
|
30
29
|
Requires-Dist: loky (>=3.4.1,<4.0.0)
|
31
30
|
Requires-Dist: numpy (>=1.26.4,<2.0.0)
|
32
31
|
Requires-Dist: openai (>=1.0.0,<2.0.0) ; extra == "openai"
|
@@ -1,16 +1,13 @@
|
|
1
1
|
import builtins
|
2
2
|
import logging
|
3
|
-
import sys
|
4
3
|
import typing as t
|
5
4
|
import warnings
|
6
5
|
from enum import Enum
|
7
6
|
|
8
|
-
from loguru import logger
|
9
7
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
10
8
|
|
11
9
|
|
12
10
|
class LogFormat(str, Enum):
|
13
|
-
DEFAULT = "default"
|
14
11
|
GCP = "gcp"
|
15
12
|
|
16
13
|
|
@@ -27,8 +24,8 @@ class LogConfig(BaseSettings):
|
|
27
24
|
env_file=".env", env_file_encoding="utf-8", extra="ignore"
|
28
25
|
)
|
29
26
|
|
30
|
-
LOG_FORMAT: LogFormat = LogFormat.
|
31
|
-
LOG_LEVEL: LogLevel = LogLevel.
|
27
|
+
LOG_FORMAT: LogFormat = LogFormat.GCP
|
28
|
+
LOG_LEVEL: LogLevel = LogLevel.INFO
|
32
29
|
|
33
30
|
|
34
31
|
class NoNewLineStreamHandler(logging.StreamHandler): # type: ignore # StreamHandler is not typed in the standard library.
|
@@ -36,18 +33,15 @@ class NoNewLineStreamHandler(logging.StreamHandler): # type: ignore # StreamHan
|
|
36
33
|
return super().format(record).replace("\n", " ")
|
37
34
|
|
38
35
|
|
39
|
-
GCP_LOG_LOGURU_FORMAT = (
|
40
|
-
"{level:<.1}{time:MMDD HH:mm:ss} {process} {name}:{line}] {message}"
|
41
|
-
)
|
42
36
|
GCP_LOG_LOGGING_FORMAT, GCP_LOG_FORMAT_LOGGING_DATEFMT = (
|
43
|
-
"%(levelname).1s%(asctime)s %(process)d %(name)s:%(lineno)d] %(message)s"
|
37
|
+
"%(levelname).1s%(asctime)s %(process)d %(name)s:%(pathname)s:%(funcName)s:%(lineno)d] %(message)s"
|
44
38
|
), "%m%d %H:%M:%S"
|
45
39
|
|
46
40
|
|
47
41
|
def patch_logger() -> None:
|
48
42
|
"""
|
49
43
|
Function to patch loggers according to the deployed environment.
|
50
|
-
Patches
|
44
|
+
Patches Python's default logger, warnings library and also monkey-patch print function as many libraries just use it.
|
51
45
|
"""
|
52
46
|
if not getattr(logger, "_patched", False):
|
53
47
|
logger._patched = True # type: ignore[attr-defined] # Hacky way to store a flag on the logger object, to not patch it multiple times.
|
@@ -57,52 +51,34 @@ def patch_logger() -> None:
|
|
57
51
|
config = LogConfig()
|
58
52
|
|
59
53
|
if config.LOG_FORMAT == LogFormat.GCP:
|
60
|
-
format_loguru = GCP_LOG_LOGURU_FORMAT
|
61
54
|
format_logging = GCP_LOG_LOGGING_FORMAT
|
62
55
|
datefmt_logging = GCP_LOG_FORMAT_LOGGING_DATEFMT
|
63
|
-
print_logging =
|
56
|
+
print_logging = print_using_logger
|
64
57
|
handlers = [NoNewLineStreamHandler()]
|
65
58
|
|
66
|
-
elif config.LOG_FORMAT == LogFormat.DEFAULT:
|
67
|
-
format_loguru, format_logging, datefmt_logging = None, None, None
|
68
|
-
print_logging = None
|
69
|
-
handlers = None
|
70
|
-
|
71
59
|
else:
|
72
60
|
raise ValueError(f"Unknown log format: {config.LOG_FORMAT}")
|
73
61
|
|
74
62
|
# Change built-in logging.
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
)
|
82
|
-
|
83
|
-
# Change loguru.
|
84
|
-
if format_loguru is not None:
|
85
|
-
logger.remove()
|
86
|
-
logger.add(
|
87
|
-
sys.stdout,
|
88
|
-
format=format_loguru,
|
89
|
-
level=config.LOG_LEVEL.value,
|
90
|
-
colorize=True,
|
91
|
-
)
|
63
|
+
logging.basicConfig(
|
64
|
+
level=config.LOG_LEVEL.value,
|
65
|
+
format=format_logging,
|
66
|
+
datefmt=datefmt_logging,
|
67
|
+
handlers=handlers,
|
68
|
+
)
|
92
69
|
|
93
70
|
# Change warning formatting to a simpler one (no source code in a new line).
|
94
71
|
warnings.formatwarning = simple_warning_format
|
95
72
|
# Use logging module for warnings.
|
96
73
|
logging.captureWarnings(True)
|
97
74
|
|
98
|
-
# Use
|
99
|
-
|
100
|
-
builtins.print = print_logging # type: ignore[assignment] # Monkey patching, it's messy but it works.
|
75
|
+
# Use logger for prints.
|
76
|
+
builtins.print = print_logging # type: ignore[assignment] # Monkey patching, it's messy but it works.
|
101
77
|
|
102
78
|
logger.info(f"Patched logger for {config.LOG_FORMAT.value} format.")
|
103
79
|
|
104
80
|
|
105
|
-
def
|
81
|
+
def print_using_logger(
|
106
82
|
*values: object,
|
107
83
|
sep: str = " ",
|
108
84
|
end: str = "\n",
|
@@ -121,4 +97,6 @@ def simple_warning_format(message, category, filename, lineno, line=None): # ty
|
|
121
97
|
) # Escape new lines, because otherwise logs will be broken.
|
122
98
|
|
123
99
|
|
100
|
+
logger = logging.getLogger("prediction-market-agent-tooling")
|
101
|
+
|
124
102
|
patch_logger()
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import hashlib
|
2
2
|
import inspect
|
3
3
|
import json
|
4
|
-
import logging
|
5
4
|
from datetime import date, timedelta
|
6
5
|
from functools import wraps
|
7
6
|
from typing import (
|
@@ -21,6 +20,7 @@ from sqlalchemy.dialects.postgresql import JSONB
|
|
21
20
|
from sqlmodel import Field, Session, SQLModel, create_engine, desc, select
|
22
21
|
|
23
22
|
from prediction_market_agent_tooling.config import APIKeys
|
23
|
+
from prediction_market_agent_tooling.loggers import logger
|
24
24
|
from prediction_market_agent_tooling.tools.datetime_utc import DatetimeUTC
|
25
25
|
from prediction_market_agent_tooling.tools.pickle_utils import InitialiseNonPickable
|
26
26
|
from prediction_market_agent_tooling.tools.utils import utcnow
|
@@ -90,7 +90,6 @@ def db_cache(
|
|
90
90
|
|
91
91
|
return decorator
|
92
92
|
|
93
|
-
logger = logging # For some reason, `loguru` doesn't work in multiprocessing if it's used in in-function-defined functions, so force-patch for just standard logging here.
|
94
93
|
api_keys = api_keys if api_keys is not None else APIKeys()
|
95
94
|
wrapped_engine = InitialiseNonPickable(
|
96
95
|
lambda: create_engine(
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "prediction-market-agent-tooling"
|
3
|
-
version = "0.56.2.
|
3
|
+
version = "0.56.2.dev145"
|
4
4
|
description = "Tools to benchmark, deploy and monitor prediction market agents."
|
5
5
|
authors = ["Gnosis"]
|
6
6
|
readme = "README.md"
|
@@ -35,7 +35,6 @@ langchain = { version = "^0.2.6", optional = true}
|
|
35
35
|
langchain-openai = { version = "^0.1.0", optional = true}
|
36
36
|
google-api-python-client = { version = "2.95.0", optional = true}
|
37
37
|
subgrounds = "^1.9.1"
|
38
|
-
loguru = "^0.7.2"
|
39
38
|
safe-eth-py = "^6.0.0b41"
|
40
39
|
eth-account = ">=0.8.0,<0.12.0"
|
41
40
|
prompt-toolkit = "^3.0.43"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|