modal-proxy 0.1.0__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.
@@ -0,0 +1,276 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ .venv-*
142
+ env/
143
+ venv/
144
+ ENV/
145
+ env.bak/
146
+ venv.bak/
147
+
148
+ # Spyder project settings
149
+ .spyderproject
150
+ .spyproject
151
+
152
+ # Rope project settings
153
+ .ropeproject
154
+
155
+ # mkdocs documentation
156
+ /site
157
+
158
+ # mypy
159
+ .mypy_cache/
160
+ .dmypy.json
161
+ dmypy.json
162
+
163
+ # Pyre type checker
164
+ .pyre/
165
+
166
+ # pytype static type analyzer
167
+ .pytype/
168
+
169
+ # Cython debug symbols
170
+ cython_debug/
171
+
172
+ # PyCharm
173
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
174
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
175
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
176
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
177
+ .idea/
178
+
179
+ # Abstra
180
+ # Abstra is an AI-powered process automation framework.
181
+ # Ignore directories containing user credentials, local state, and settings.
182
+ # Learn more at https://abstra.io/docs
183
+ .abstra/
184
+
185
+ # Visual Studio Code
186
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
187
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
188
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
189
+ # you could uncomment the following to ignore the entire vscode folder
190
+ # .vscode/
191
+
192
+ # Ruff stuff:
193
+ .ruff_cache/
194
+
195
+ # PyPI configuration file
196
+ .pypirc
197
+
198
+ # Cursor
199
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
200
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
201
+ # refer to https://docs.cursor.com/context/ignore-files
202
+ .cursorignore
203
+ .cursorindexingignore
204
+
205
+ # Marimo
206
+ marimo/_static/
207
+ marimo/_lsp/
208
+ __marimo__/
209
+
210
+ # task folders for local custom claude workflow
211
+ */*/_tasks/
212
+ .sesskey
213
+
214
+ # Node.js
215
+ node_modules/
216
+
217
+ # Frontend build artifacts
218
+ frontend-dist/
219
+
220
+ # ignore review files
221
+ .reviews/
222
+
223
+ # files necessary to smuggle session id into reviewers
224
+ .claude/sessionid
225
+
226
+ # Claude Code local settings (session-specific permissions)
227
+ .claude/settings.local.json
228
+
229
+ # PR status and URL files written by main_claude_stop_hook.sh for status line display
230
+ .claude/pr_url
231
+ .claude/pr_status
232
+
233
+ # History of commits reviewed by main_claude_stop_hook.sh (to detect stuck agents)
234
+ .claude/reviewed_commits
235
+
236
+ # Local Claude settings backup files
237
+ .claude/*.bak
238
+
239
+ # Local mng settings (not committed)
240
+ .mng/settings.local.toml
241
+
242
+ # so the user can make their own notification script
243
+ scripts/notify_user.local.sh
244
+
245
+ # Test output files (slow tests, coverage summaries)
246
+ .test_output/
247
+
248
+ # TMR output directories (reports + test outputs)
249
+ tmr_*/
250
+
251
+ # Active session marker file (used to detect interrupted sessions)
252
+ .claude/active
253
+
254
+ # we stick the image build artifacts here
255
+ .mng/dev/build/
256
+ .mng/dev/secrets/
257
+
258
+ # Offload caches and local files
259
+ .offload/**
260
+ test-results/**
261
+ current.tar.gz
262
+
263
+ # Minds deploy-time build artifacts
264
+ .minds/
265
+
266
+ # Autofix working artifacts
267
+ .autofix/
268
+
269
+ # Demo recordings (asciinema .cast, .txt, and scripts)
270
+ .demos/
271
+
272
+ # for git worktrees from other repos
273
+ .external_worktrees/
274
+
275
+ # ignore coverage files generated within subprojects
276
+ cov.xml
@@ -0,0 +1,25 @@
1
+ Metadata-Version: 2.4
2
+ Name: modal-proxy
3
+ Version: 0.1.0
4
+ Summary: Abstraction layer over Modal SDK for mng: supports direct, testing, and remote modes
5
+ Requires-Python: >=3.11
6
+ Requires-Dist: concurrency-group==0.1.8
7
+ Requires-Dist: imbue-common==0.1.8
8
+ Requires-Dist: mng==0.1.8
9
+ Requires-Dist: modal==1.3.1
10
+ Requires-Dist: resource-guards==0.1.1
11
+ Description-Content-Type: text/markdown
12
+
13
+ # modal-proxy
14
+
15
+ Abstraction layer over the [Modal](https://modal.com) SDK for [mng](../mng/README.md).
16
+
17
+ This library defines a `ModalInterface` ABC that captures every interaction mng_modal has with Modal. Three implementations are planned:
18
+
19
+ 1. **DirectModalInterface** -- calls the Modal Python SDK directly (the current behavior, extracted from mng_modal)
20
+ 2. **TestingModalInterface** -- fakes Modal behavior locally (volumes become directories, sandboxes become process groups) for integration testing without remote calls
21
+ 3. **RemoteModalInterface** -- proxies calls to a web server, enabling a managed service that translates user credentials into real Modal API calls
22
+
23
+ ## Usage
24
+
25
+ The `ModalInterface` is intended to be injected into `ModalProviderInstance` (in mng_modal) rather than having mng_modal call the Modal SDK directly.
@@ -0,0 +1,13 @@
1
+ # modal-proxy
2
+
3
+ Abstraction layer over the [Modal](https://modal.com) SDK for [mng](../mng/README.md).
4
+
5
+ This library defines a `ModalInterface` ABC that captures every interaction mng_modal has with Modal. Three implementations are planned:
6
+
7
+ 1. **DirectModalInterface** -- calls the Modal Python SDK directly (the current behavior, extracted from mng_modal)
8
+ 2. **TestingModalInterface** -- fakes Modal behavior locally (volumes become directories, sandboxes become process groups) for integration testing without remote calls
9
+ 3. **RemoteModalInterface** -- proxies calls to a web server, enabling a managed service that translates user credentials into real Modal API calls
10
+
11
+ ## Usage
12
+
13
+ The `ModalInterface` is intended to be injected into `ModalProviderInstance` (in mng_modal) rather than having mng_modal call the Modal SDK directly.
@@ -0,0 +1,13 @@
1
+ """Project-level conftest for modal-proxy.
2
+
3
+ When running tests from libs/modal_proxy/, this conftest provides the common pytest hooks
4
+ that would otherwise come from the monorepo root conftest.py (which is not discovered
5
+ when pytest runs from a subdirectory).
6
+
7
+ When running from the monorepo root, the root conftest.py registers the hooks first,
8
+ and this file's register_conftest_hooks() call is a no-op (guarded by a module-level flag).
9
+ """
10
+
11
+ from imbue.imbue_common.conftest_hooks import register_conftest_hooks
12
+
13
+ register_conftest_hooks(globals())
File without changes
@@ -0,0 +1,49 @@
1
+ # Simple data types used by the modal_proxy interfaces.
2
+
3
+ from enum import auto
4
+
5
+ from pydantic import Field
6
+
7
+ from imbue.imbue_common.enums import UpperCaseStrEnum
8
+ from imbue.imbue_common.frozen_model import FrozenModel
9
+
10
+
11
+ class StreamType(UpperCaseStrEnum):
12
+ """Controls how stdout/stderr are handled for sandbox exec commands.
13
+
14
+ Mirrors modal.stream_type.StreamType for the values we use.
15
+ """
16
+
17
+ PIPE = auto()
18
+ DEVNULL = auto()
19
+
20
+
21
+ class TunnelInfo(FrozenModel):
22
+ """Connection info for a sandbox port tunnel.
23
+
24
+ Mirrors the tunnel object returned by modal.Sandbox.tunnels().
25
+ """
26
+
27
+ tcp_socket: tuple[str, int] = Field(description="(host, port) tuple for the tunnel endpoint")
28
+
29
+
30
+ class FileEntryType(UpperCaseStrEnum):
31
+ """Type of entry in a volume directory listing.
32
+
33
+ Mirrors modal.volume.FileEntryType.
34
+ """
35
+
36
+ FILE = auto()
37
+ DIRECTORY = auto()
38
+
39
+
40
+ class FileEntry(FrozenModel):
41
+ """A single file or directory entry from a volume listing.
42
+
43
+ Mirrors modal.volume.FileEntry for the fields we use.
44
+ """
45
+
46
+ path: str = Field(description="Path of the entry")
47
+ type: FileEntryType = Field(description="Whether this is a file or directory")
48
+ mtime: float = Field(default=0.0, description="Last modification time as a Unix timestamp")
49
+ size: int = Field(default=0, description="Size in bytes")