isolate 0.14.3__py3-none-any.whl → 0.15.0__py3-none-any.whl

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.

Potentially problematic release.


This version of isolate might be problematic. Click here for more details.

@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.14.3'
16
- __version_tuple__ = version_tuple = (0, 14, 3)
15
+ __version__ = version = '0.15.0'
16
+ __version_tuple__ = version_tuple = (0, 15, 0)
@@ -11,7 +11,7 @@ from typing import TYPE_CHECKING, Callable, Iterator
11
11
  from platformdirs import user_cache_dir
12
12
 
13
13
  from isolate.backends.common import lock_build_path
14
- from isolate.logs import Log
14
+ from isolate.logs import Log, LogLevel, LogSource
15
15
 
16
16
  if TYPE_CHECKING:
17
17
  from isolate.backends import BaseEnvironment
@@ -28,7 +28,37 @@ class IsolateSettings:
28
28
  strict_cache: bool = _STRICT_CACHE
29
29
 
30
30
  def log(self, log: Log) -> None:
31
- self.log_hook(log)
31
+ self.log_hook(self._infer_log_level(log))
32
+
33
+ def _infer_log_level(self, log: Log) -> Log:
34
+ """Infer the log level if it's correctly set."""
35
+ if log.level not in (LogLevel.STDOUT, LogLevel.STDERR):
36
+ # We should only infer the log level for stdout/stderr logs.
37
+ return log
38
+
39
+ if log.source in (LogSource.BUILDER, LogSource.BRIDGE):
40
+ return replace(log, level=LogLevel.TRACE)
41
+
42
+ line = log.message.lower()
43
+
44
+ if "[error]" in line:
45
+ return replace(log, level=LogLevel.ERROR)
46
+ if "[warning]" in line:
47
+ return replace(log, level=LogLevel.WARNING)
48
+ if "[warn]" in line:
49
+ return replace(log, level=LogLevel.WARNING)
50
+ if "[info]" in line:
51
+ return replace(log, level=LogLevel.INFO)
52
+ if "[debug]" in line:
53
+ return replace(log, level=LogLevel.DEBUG)
54
+ if "[trace]" in line:
55
+ return replace(log, level=LogLevel.TRACE)
56
+
57
+ if log.level == LogLevel.STDERR:
58
+ return replace(log, level=LogLevel.ERROR)
59
+
60
+ # Default to INFO level
61
+ return replace(log, level=LogLevel.INFO)
32
62
 
33
63
  def _get_temp_base(self) -> Path:
34
64
  """Return the base path for creating temporary files/directories.
@@ -173,7 +173,9 @@ class PythonExecutionBase(Generic[ConnectionType]):
173
173
  """Return the command to run the agent process with."""
174
174
  raise NotImplementedError
175
175
 
176
- def handle_agent_log(self, line: str, level: LogLevel, source: LogSource) -> None:
176
+ def handle_agent_log(
177
+ self, line: str, *, level: LogLevel, source: LogSource
178
+ ) -> None:
177
179
  """Handle a log line emitted by the agent process. The level will be either
178
180
  STDOUT or STDERR."""
179
181
  raise NotImplementedError
@@ -147,5 +147,7 @@ class LocalPythonGRPC(PythonExecutionBase[str], GRPCExecutionBase):
147
147
  str(log_fd),
148
148
  ]
149
149
 
150
- def handle_agent_log(self, line: str, level: LogLevel, source: LogSource) -> None:
150
+ def handle_agent_log(
151
+ self, line: str, *, level: LogLevel, source: LogSource
152
+ ) -> None:
151
153
  self.log(line, level=level, source=source)
@@ -219,5 +219,7 @@ class PythonIPC(PythonExecutionBase[AgentListener], IsolatedProcessConnection):
219
219
  str(log_fd),
220
220
  ]
221
221
 
222
- def handle_agent_log(self, line: str, level: LogLevel, source: LogSource) -> None:
222
+ def handle_agent_log(
223
+ self, line: str, *, level: LogLevel, source: LogSource
224
+ ) -> None:
223
225
  self.log(line, level=level, source=source)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: isolate
3
- Version: 0.14.3
3
+ Version: 0.15.0
4
4
  Summary: Managed isolated environments for Python
5
5
  Author-email: Features & Labels <hello@fal.ai>
6
6
  Project-URL: Issues, https://github.com/fal-ai/isolate/issues
@@ -16,15 +16,15 @@ Requires-Dist: importlib-metadata>=4.4; python_version < "3.10"
16
16
  Provides-Extra: build
17
17
  Requires-Dist: virtualenv>=20.4; extra == "build"
18
18
  Requires-Dist: PyYAML>=6.0; extra == "build"
19
- Provides-Extra: dev
20
- Requires-Dist: isolate[test]; extra == "dev"
21
- Requires-Dist: grpcio-tools==1.64.0; extra == "dev"
22
19
  Provides-Extra: test
23
20
  Requires-Dist: isolate[build]; extra == "test"
24
21
  Requires-Dist: pytest; extra == "test"
25
22
  Requires-Dist: cloudpickle>=2.2.0; extra == "test"
26
23
  Requires-Dist: dill>=0.3.5.1; extra == "test"
27
24
  Requires-Dist: pytest-rerunfailures; extra == "test"
25
+ Provides-Extra: dev
26
+ Requires-Dist: isolate[test]; extra == "dev"
27
+ Requires-Dist: grpcio-tools==1.64.0; extra == "dev"
28
28
 
29
29
  # Isolate
30
30
 
@@ -1,5 +1,5 @@
1
1
  isolate/__init__.py,sha256=uXOKnONs7sXgARNgElwr4_A1sKoA6ACHVEvs3IDiX1M,127
2
- isolate/_isolate_version.py,sha256=3mnQHEW9gizHocB0ULApMUw7E4CZd4qai5GsjMH_Vo4,413
2
+ isolate/_isolate_version.py,sha256=oHv-EAjiXbJma3jZ0Tq6UPimiWYyyw2Ao9S8zdq9uWs,413
3
3
  isolate/_version.py,sha256=05pXvy-yr5t3I1m9JMn42Ilzpg7fa8IB2J8a3G7t1cU,274
4
4
  isolate/logger.py,sha256=Z4a03kjFg54H3RDVVp4nQeut0xlxq0PIbbEczCT9ImU,1758
5
5
  isolate/logs.py,sha256=R_AHUVYD18z_PhtK_mDWi9Gch79CxmwHY09hUDShtwg,2079
@@ -13,17 +13,17 @@ isolate/backends/container.py,sha256=MCQJbcmQvRUS-tTgTW_pKYBMKwSJO2KZsLeaBMXpPC0
13
13
  isolate/backends/local.py,sha256=woxe4dmXuEHxWKsGNndoRA1_sP6yG-dg6tlFZni0mZc,1360
14
14
  isolate/backends/pyenv.py,sha256=ZwTYoVPIWhS3Y4hN51x95aIOHi15GF7kEDdKTNhlMTE,5434
15
15
  isolate/backends/remote.py,sha256=qUm54mpqk0kaEfbPZl962Td3_P3qcpyVcfGdKfmkJHs,4234
16
- isolate/backends/settings.py,sha256=AiPYpzeon_AHS3ewSIKc0TMF4XrNdM32EFvgSTH2odE,3291
16
+ isolate/backends/settings.py,sha256=LvYn4ox9pyFs7bO7WMpDdQHjGOrMn6bdDrHnpfOJyAQ,4443
17
17
  isolate/backends/virtualenv.py,sha256=CdzDO4stxNCMbBsNnR1agwyu2FDBDx9UwJWI7bv010k,6992
18
18
  isolate/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  isolate/common/timestamp.py,sha256=seh7FrMRH4i1SCQavA8d-7z8qi0pP8lYYhd29gTPMwE,367
20
20
  isolate/connections/__init__.py,sha256=oa0PNo7ZQ0StPIDvKnJ02_CNVMyfOhxJ3M1C0VMvj9c,627
21
21
  isolate/connections/common.py,sha256=PAfBGKZNUdtFlZQlw3_nQaUCKQXTnEkxzNNRV_i4R2A,3498
22
22
  isolate/connections/_local/__init__.py,sha256=6FtCKRSFBvTvjm5LNlNA-mieKEq3J7DZZRPcXVedERo,146
23
- isolate/connections/_local/_base.py,sha256=YGf141VgXErrXYNyRN7sXcts2SemlFEEocZsKmLQfVM,6659
23
+ isolate/connections/_local/_base.py,sha256=wx6WkP_zBZ7zHOq2mHqafVUAvGDMQGRELX64-o-uCdo,6676
24
24
  isolate/connections/_local/agent_startup.py,sha256=swCs6Q0yVkDw7w-RftizHSMyJDM7DQwuP3TB0qI1ucg,1552
25
25
  isolate/connections/grpc/__init__.py,sha256=tcesLxlC36P6wSg2lBcO2egsJWMbSKwc8zFXhWac3YU,85
26
- isolate/connections/grpc/_base.py,sha256=6cBlJRoKDoJFQudLgkEeUcGVxcIyaAzkB-Zec14hm8k,5639
26
+ isolate/connections/grpc/_base.py,sha256=kUB-EDetcyb0fsYfH25E14DrxbVXe19bEH4u5b0-Gqw,5656
27
27
  isolate/connections/grpc/agent.py,sha256=fZF4-v8WN1qPzFp17UxOX_A3Jq8bXD8Wss-7eNgNoYg,8071
28
28
  isolate/connections/grpc/configuration.py,sha256=50YvGGHA9uyKg74xU_gc73j7bsFk973uIpMhmw2HhxY,788
29
29
  isolate/connections/grpc/interface.py,sha256=yt63kytgXRXrTnjePGJVdXz4LJJVSSrNkJCF1yz6FIE,2270
@@ -37,7 +37,7 @@ isolate/connections/grpc/definitions/common_pb2.py,sha256=lkpvpARZbPDrzrVkKJ-4WZ
37
37
  isolate/connections/grpc/definitions/common_pb2.pyi,sha256=J3av86ZHoHR28_5zshqCJ0I7v9WCxuQsvOAin-zig9w,6222
38
38
  isolate/connections/grpc/definitions/common_pb2_grpc.py,sha256=EvGJ0LYaWTflBesxg0P1nh_EeWKYKqUVRf0_plMISTs,1123
39
39
  isolate/connections/ipc/__init__.py,sha256=j2Mbsph2mRhAWmkMyrtPOz0VG-e75h1OOZLwzs6pXUo,131
40
- isolate/connections/ipc/_base.py,sha256=Jk715XK2ei3yBpFcwUnFZ0owQMMf5jekZFNh2WlKRT4,8009
40
+ isolate/connections/ipc/_base.py,sha256=ZhMvOPRGwzuUIWSKGOjbUdj4y22jAc2qG8EuQYfgRVI,8026
41
41
  isolate/connections/ipc/agent.py,sha256=hGlL4x78FhRvMZ4DkVh3dk-EmWQqxHW4LIipgyOkw08,7069
42
42
  isolate/server/__init__.py,sha256=7R3GuWmxuqe0q28rVqETJN9OCrP_-Svjv9h0NR1GFL0,79
43
43
  isolate/server/health_server.py,sha256=yN7F1Q28DdX8-Zk3gef7XcQEE25XwlHwzV5GBM75aQM,1249
@@ -53,9 +53,9 @@ isolate/server/health/health.proto,sha256=wE2_QD0OQAblKkEBG7sALLXEOj1mOLKG-FbC4t
53
53
  isolate/server/health/health_pb2.py,sha256=onOdP3M4Tpqhqs2PlGcyfoKe2VVKUEDx5ALeRcObb9A,1899
54
54
  isolate/server/health/health_pb2.pyi,sha256=AK-DPCpJzoYhU6DydD856c0Ywx84x6k-Cs4m6HpNv5A,2459
55
55
  isolate/server/health/health_pb2_grpc.py,sha256=XgsULrnRBmYIqvKr8eI7bqs6NIea5A0kkqdOOc2JHBY,5303
56
- isolate-0.14.3.dist-info/LICENSE,sha256=427vuyirL5scgBLqA9UWcdnxKrtSGc0u_JfUupk6lAA,11359
57
- isolate-0.14.3.dist-info/METADATA,sha256=LxlsStQM06vUMmDzW2XsnmdrVvm1mgPgBslNnC22W4Q,3191
58
- isolate-0.14.3.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
59
- isolate-0.14.3.dist-info/entry_points.txt,sha256=s3prh2EERaVCbL8R45tfY5WFPZ1TsYOsz305YR7s-Pc,360
60
- isolate-0.14.3.dist-info/top_level.txt,sha256=W9QJBHcq5WXRkbOXf25bvftzFsOZZN4n1DAatdroZrs,8
61
- isolate-0.14.3.dist-info/RECORD,,
56
+ isolate-0.15.0.dist-info/LICENSE,sha256=427vuyirL5scgBLqA9UWcdnxKrtSGc0u_JfUupk6lAA,11359
57
+ isolate-0.15.0.dist-info/METADATA,sha256=as9WQwVbbTMIZW-Pg-wmMX1jCdyHwNqCCoLx5ttLHCM,3191
58
+ isolate-0.15.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
59
+ isolate-0.15.0.dist-info/entry_points.txt,sha256=s3prh2EERaVCbL8R45tfY5WFPZ1TsYOsz305YR7s-Pc,360
60
+ isolate-0.15.0.dist-info/top_level.txt,sha256=W9QJBHcq5WXRkbOXf25bvftzFsOZZN4n1DAatdroZrs,8
61
+ isolate-0.15.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.3.0)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5