isolate 0.12.0__tar.gz → 0.12.1__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.

Potentially problematic release.


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

Files changed (54) hide show
  1. {isolate-0.12.0 → isolate-0.12.1}/PKG-INFO +6 -5
  2. {isolate-0.12.0 → isolate-0.12.1}/pyproject.toml +1 -1
  3. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/backends/conda.py +6 -1
  4. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/backends/virtualenv.py +2 -0
  5. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/connections/common.py +4 -0
  6. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/connections/grpc/agent.py +6 -3
  7. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/server/server.py +13 -1
  8. isolate-0.12.0/setup.py +0 -58
  9. {isolate-0.12.0 → isolate-0.12.1}/README.md +0 -0
  10. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/__init__.py +0 -0
  11. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/backends/__init__.py +0 -0
  12. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/backends/_base.py +0 -0
  13. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/backends/common.py +0 -0
  14. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/backends/local.py +0 -0
  15. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/backends/pyenv.py +0 -0
  16. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/backends/remote.py +0 -0
  17. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/backends/settings.py +0 -0
  18. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/common/__init__.py +0 -0
  19. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/common/timestamp.py +0 -0
  20. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/connections/__init__.py +0 -0
  21. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/connections/_local/__init__.py +0 -0
  22. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/connections/_local/_base.py +0 -0
  23. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/connections/_local/agent_startup.py +0 -0
  24. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/connections/grpc/__init__.py +0 -0
  25. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/connections/grpc/_base.py +0 -0
  26. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/connections/grpc/configuration.py +0 -0
  27. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/connections/grpc/definitions/__init__.py +0 -0
  28. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/connections/grpc/definitions/agent.proto +0 -0
  29. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/connections/grpc/definitions/agent_pb2.py +0 -0
  30. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/connections/grpc/definitions/agent_pb2.pyi +0 -0
  31. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/connections/grpc/definitions/agent_pb2_grpc.py +0 -0
  32. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/connections/grpc/definitions/common.proto +0 -0
  33. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/connections/grpc/definitions/common_pb2.py +0 -0
  34. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/connections/grpc/definitions/common_pb2.pyi +0 -0
  35. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/connections/grpc/definitions/common_pb2_grpc.py +0 -0
  36. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/connections/grpc/interface.py +0 -0
  37. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/connections/ipc/__init__.py +0 -0
  38. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/connections/ipc/_base.py +0 -0
  39. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/connections/ipc/agent.py +0 -0
  40. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/logs.py +0 -0
  41. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/registry.py +0 -0
  42. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/server/__init__.py +0 -0
  43. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/server/definitions/__init__.py +0 -0
  44. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/server/definitions/server.proto +0 -0
  45. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/server/definitions/server_pb2.py +0 -0
  46. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/server/definitions/server_pb2.pyi +0 -0
  47. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/server/definitions/server_pb2_grpc.py +0 -0
  48. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/server/health/__init__.py +0 -0
  49. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/server/health/health.proto +0 -0
  50. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/server/health/health_pb2.py +0 -0
  51. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/server/health/health_pb2.pyi +0 -0
  52. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/server/health/health_pb2_grpc.py +0 -0
  53. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/server/health_server.py +0 -0
  54. {isolate-0.12.0 → isolate-0.12.1}/src/isolate/server/interface.py +0 -0
@@ -1,25 +1,26 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: isolate
3
- Version: 0.12.0
3
+ Version: 0.12.1
4
4
  Summary: Managed isolated environments for Python
5
5
  Author: Features & Labels
6
6
  Author-email: hello@fal.ai
7
7
  Requires-Python: >=3.7,<4.0
8
8
  Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.10
10
9
  Classifier: Programming Language :: Python :: 3.7
11
10
  Classifier: Programming Language :: Python :: 3.8
12
11
  Classifier: Programming Language :: Python :: 3.9
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
13
14
  Provides-Extra: build
14
15
  Provides-Extra: grpc
15
16
  Provides-Extra: server
16
- Requires-Dist: PyYAML (>=6.0); extra == "build"
17
+ Requires-Dist: PyYAML (>=6.0) ; extra == "build"
17
18
  Requires-Dist: grpcio (>=1.49)
18
- Requires-Dist: importlib-metadata (>=4.4); python_version < "3.10"
19
+ Requires-Dist: importlib-metadata (>=4.4) ; python_version < "3.10"
19
20
  Requires-Dist: platformdirs
20
21
  Requires-Dist: protobuf
21
22
  Requires-Dist: tblib (>=1.7.0)
22
- Requires-Dist: virtualenv (>=20.4); extra == "build"
23
+ Requires-Dist: virtualenv (>=20.4) ; extra == "build"
23
24
  Description-Content-Type: text/markdown
24
25
 
25
26
  # Isolate
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "isolate"
3
- version = "0.12.0"
3
+ version = "0.12.1"
4
4
  readme = "README.md"
5
5
  description = "Managed isolated environments for Python"
6
6
  authors = ["Features & Labels <hello@fal.ai>"]
@@ -42,6 +42,7 @@ class CondaEnvironment(BaseEnvironment[Path]):
42
42
 
43
43
  environment_definition: Dict[str, Any] = field(default_factory=dict)
44
44
  python_version: Optional[str] = None
45
+ tags: List[str] = field(default_factory=list)
45
46
 
46
47
  @classmethod
47
48
  def from_config(
@@ -106,7 +107,11 @@ class CondaEnvironment(BaseEnvironment[Path]):
106
107
 
107
108
  @property
108
109
  def key(self) -> str:
109
- return sha256_digest_of(repr(self.environment_definition))
110
+ return sha256_digest_of(
111
+ repr(self.environment_definition),
112
+ self.python_version,
113
+ *sorted(self.tags),
114
+ )
110
115
 
111
116
  def create(self, *, force: bool = False) -> Path:
112
117
  env_path = self.settings.cache_dir_for(self)
@@ -29,6 +29,7 @@ class VirtualPythonEnvironment(BaseEnvironment[Path]):
29
29
  constraints_file: Optional[os.PathLike] = None
30
30
  python_version: Optional[str] = None
31
31
  extra_index_urls: List[str] = field(default_factory=list)
32
+ tags: List[str] = field(default_factory=list)
32
33
 
33
34
  @classmethod
34
35
  def from_config(
@@ -54,6 +55,7 @@ class VirtualPythonEnvironment(BaseEnvironment[Path]):
54
55
  *self.requirements,
55
56
  *constraints,
56
57
  *self.extra_index_urls,
58
+ *sorted(self.tags),
57
59
  )
58
60
 
59
61
  def install_requirements(self, path: Path) -> None:
@@ -2,6 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  import importlib
4
4
  import os
5
+ from dataclasses import dataclass
5
6
  from contextlib import contextmanager
6
7
  from typing import TYPE_CHECKING, Any, Iterator, Optional, cast
7
8
 
@@ -21,9 +22,12 @@ if TYPE_CHECKING:
21
22
  AGENT_SIGNATURE = "IS_ISOLATE_AGENT"
22
23
 
23
24
 
25
+ @dataclass
24
26
  class SerializationError(Exception):
25
27
  """An error that happened during the serialization process."""
26
28
 
29
+ message: str
30
+
27
31
 
28
32
  @contextmanager
29
33
  def _step(message: str) -> Iterator[None]:
@@ -142,14 +142,17 @@ class AgentServicer(definitions.AgentServicer):
142
142
  serialization_method: str,
143
143
  result: object,
144
144
  was_it_raised: bool,
145
- stringized_tb: str,
145
+ stringized_tb: str | None,
146
146
  ) -> Generator[definitions.PartialRunResult, None, Any]:
147
147
  try:
148
148
  definition = serialize_object(serialization_method, result)
149
149
  except SerializationError:
150
- yield from self.log(traceback.format_exc(), level=LogLevel.ERROR)
150
+ if stringized_tb:
151
+ yield from self.log(
152
+ stringized_tb, source=LogSource.USER, level=LogLevel.STDERR
153
+ )
151
154
  raise AbortException(
152
- "The result of the input function could not be serialized."
155
+ f"Error while serializing the execution result (object of type {type(result)})."
153
156
  )
154
157
  except BaseException:
155
158
  yield from self.log(traceback.format_exc(), level=LogLevel.ERROR)
@@ -261,6 +261,17 @@ class IsolateServicer(definitions.IsolateServicer):
261
261
  # during the execution, and handle them accordingly.
262
262
  exception = future.exception(timeout=0.1)
263
263
  if exception is not None:
264
+ # If this is an RPC error, propagate it as is without any
265
+ # further processing.
266
+ if isinstance(exception, grpc.RpcError):
267
+ return self.abort_with_msg(
268
+ exception.details(),
269
+ context,
270
+ code=exception.code(),
271
+ )
272
+
273
+ # Otherwise this is a bug in the agent itself, so needs
274
+ # to be propagated with more details.
264
275
  for line in traceback.format_exception(
265
276
  type(exception), exception, exception.__traceback__
266
277
  ):
@@ -282,7 +293,8 @@ class IsolateServicer(definitions.IsolateServicer):
282
293
  self, queue: Queue, is_completed: Callable[[], bool]
283
294
  ) -> Iterator[definitions.PartialRunResult]:
284
295
  """Watch the given queue until the is_completed function returns True. Note that even
285
- if the function is completed, this function might not finish until the queue is empty."""
296
+ if the function is completed, this function might not finish until the queue is empty.
297
+ """
286
298
  while not is_completed():
287
299
  try:
288
300
  yield queue.get(timeout=_Q_WAIT_DELAY)
isolate-0.12.0/setup.py DELETED
@@ -1,58 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- from setuptools import setup
3
-
4
- package_dir = \
5
- {'': 'src'}
6
-
7
- packages = \
8
- ['isolate',
9
- 'isolate.backends',
10
- 'isolate.common',
11
- 'isolate.connections',
12
- 'isolate.connections._local',
13
- 'isolate.connections.grpc',
14
- 'isolate.connections.grpc.definitions',
15
- 'isolate.connections.ipc',
16
- 'isolate.server',
17
- 'isolate.server.definitions',
18
- 'isolate.server.health']
19
-
20
- package_data = \
21
- {'': ['*']}
22
-
23
- install_requires = \
24
- ['grpcio>=1.49', 'platformdirs', 'protobuf', 'tblib>=1.7.0']
25
-
26
- extras_require = \
27
- {':python_version < "3.10"': ['importlib-metadata>=4.4'],
28
- 'build': ['virtualenv>=20.4', 'PyYAML>=6.0']}
29
-
30
- entry_points = \
31
- {'isolate.backends': ['conda = isolate.backends.conda:CondaEnvironment',
32
- 'isolate-server = isolate.backends.remote:IsolateServer',
33
- 'local = isolate.backends.local:LocalPythonEnvironment',
34
- 'pyenv = isolate.backends.pyenv:PyenvEnvironment',
35
- 'virtualenv = '
36
- 'isolate.backends.virtualenv:VirtualPythonEnvironment']}
37
-
38
- setup_kwargs = {
39
- 'name': 'isolate',
40
- 'version': '0.12.0',
41
- 'description': 'Managed isolated environments for Python',
42
- 'long_description': '# Isolate\n\n> :warning: **Isolate** is still very young, and none of the APIs should be considered stable.\n\nRun any Python function, with any dependencies, in any machine you want. Isolate offers a\npluggable end-to-end solution for building, managing, and using isolated environments (virtualenv,\nconda, remote, and more).\n\n\n## Motivation\n\n![XKCD 1987](https://imgs.xkcd.com/comics/python_environment.png)\n\nThe fact that nearly every piece of software uses some other libraries or some\nother programs is undeniable. Each of these come with their set of dependencies,\nand this chain moves forward. Once there are enough \'nodes\' in the chain, then\nthe ["dependency mess"](https://en.wikipedia.org/wiki/Dependency_hell) starts\nto surface and our lives become much harder.\n\nPython tried to solve it by recommending the "virtual environment" concept. In\ntheory it was designed to isolate environments of different projects, so my project\nA can depend on `pandas==1.0.0` while B depends on `pandas==2.0.0` and whichever\nproject I choose to work with, I just activate its own environment.\n\nOverall this was a very nice solution that did work, and still continues to work\nfor this use case. But as with every other scoped fix, in time other problems started\nto appear that demand a much narrower scope (like defining module-level dependencies,\nor even function-level ones for cloud runtimes that allow seamless integration with the\nrest of your code running in a different machine).\n\nHowever, unlike "virtual environment" concept, each of the projects that tried to tackle\nthis problem lacked a universal interface which one can simply define a set of requirements\n(this might be dependencies, size of the machine that is needed to run it, or something completely\ndifferent) and can change it without any loss. Isolate is working towards a future where this\ntransititon is as seamless as the transition from your local environment to the remote\nenvironment.\n',
43
- 'author': 'Features & Labels',
44
- 'author_email': 'hello@fal.ai',
45
- 'maintainer': None,
46
- 'maintainer_email': None,
47
- 'url': None,
48
- 'package_dir': package_dir,
49
- 'packages': packages,
50
- 'package_data': package_data,
51
- 'install_requires': install_requires,
52
- 'extras_require': extras_require,
53
- 'entry_points': entry_points,
54
- 'python_requires': '>=3.7,<4.0',
55
- }
56
-
57
-
58
- setup(**setup_kwargs)
File without changes
File without changes