543 Commits

Author SHA1 Message Date
Jakub Novak
23ea4adfb1 Rename rpc methods for watcher 2024-10-14 19:51:05 -07:00
Tereza Tizkova
a668b3978a Merge branch 'beta' of https://github.com/e2b-dev/E2B into beta 2024-10-14 14:10:20 -07:00
Tereza Tizkova
b5a6f4958e Update readme 2024-10-14 14:10:13 -07:00
Jakub Novák
e48574f69c
Improve file watcher in Python Sync SDK (#457)
# Description

Current solution didn't work well with in sync Python. If you're unsure
whether a file has been created, you might end up waiting for a timeout
to exit the loop.

New implementation uses polling, you can ask for events whenever you
want and it will request envd to send all events (or only new ones).
This should make it much better for users with sync Python SDK

Example of a problematic usage before and after:
## Before
```python
sbx = Sandbox()
watcher = sbx.files.watch("/home/user")
sbx.files.make_dir("test")
for event in watcher:
    print(event)
     # !!! if you don't exit, you would be stuck for the rest of the timeout (default 60 seconds)
    break
watcher.close()
```
## After
```python
sbx = Sandbox()
watcher = sbx.files.watch("/home/user")
sbx.files.make_dir("test")
events = watcher.get_new_events()
watcher.stop()
for event in events:
    print(event)
```

Even worse case was if you don't know if anything will happen:
## Before
```python
sbx = Sandbox()
watcher = sbx.files.watch("/home/user")
if random.random() > 0.5:
    sbx.files.make_dir("test")
# There's 50% chance you will get stuck. The only workaround is to run in in separate thread and you kill it after a while (you aren't really sure when it's safe)
for event in watcher:
    print(event)
    #  !!! if you don't exit, you would be stuck for the rest of the timeout (default 60 seconds)
    break
watcher.close()
```
## After
```python
sbx = Sandbox()
watcher = sbx.files.watch("/home/user")
if random.random() > 0.5:
    sbx.files.make_dir("test")
events = watcher.get_new_events()
watcher.stop()
for event in events:
    print(event)
```
2024-10-14 23:09:53 +02:00
Jakub Novak
bfc4bb51d8 Rename watch to watch dir 2024-10-14 14:01:34 -07:00
Jakub Novak
6e926ecb13 Remove timeout from sync watch dir 2024-10-14 13:40:08 -07:00
Jakub Novak
bc42ba1e66 Refactor watch dir 2024-10-14 13:01:59 -07:00
Jakub Novak
5c31902cc4 Change close to stop for watch dir 2024-10-14 12:10:17 -07:00
Jakub Novak
5de5385533 Update the python sdk to match the new spec 2024-10-14 12:10:04 -07:00
Jakub Novak
f9978611f3 Regenerate rpc client 2024-10-14 11:30:02 -07:00
Tereza Tizkova
315c264ecd Update SDK readme 2024-10-12 20:49:33 -07:00
Jakub Novak
81db2b1466 Add sync watch handler 2024-10-11 11:54:00 +02:00
0div
87e314ada5 Merge branch 'beta' of https://github.com/e2b-dev/E2B into generate-api-refs-workflow 2024-10-10 09:22:23 +02:00
Jakub Novak
5d027aa899 Improve the process exception message 2024-10-09 17:12:43 +02:00
Jakub Novak
7356efc2bb Fix write operation description 2024-10-09 16:35:30 +02:00
0div
6a2203daf3 merge beta 2024-10-08 19:39:21 +02:00
Jakub Novak
f2bec0544f Fix empty file + add tests 2024-10-08 15:28:24 +02:00
Jakub Novak
506f70c7b8 Add docstrings to SDKs 2024-10-08 13:04:39 +02:00
0div
e3c6d0dc51 remove "Objects" in h2 of python-sdk api ref markdown 2024-09-27 17:40:25 +02:00
0div
7e8a2dd515 remove "Objects" in h2 of python-sdk api ref markdown 2024-09-27 17:32:30 +02:00
0div
1d9db6489e merge beta 2024-09-26 15:22:32 +02:00
Jakub Novak
fe78c0320d Simplify tests 2024-09-26 13:45:24 +02:00
github-actions[bot]
8efd4d2795 [skip ci] Release new versions 2024-09-26 06:48:22 +00:00
Tomas Valenta
ff368d1ba7 Explicitly configure keepalive pinging in Python SDK 2024-09-25 18:08:22 -07:00
Tomas Valenta
24e06c5e1a Fix entry info return type 2024-09-25 17:46:28 -07:00
Tomas Valenta
e5b81e274c Cleanup python pty types 2024-09-25 17:42:40 -07:00
Tomas Valenta
3bd7426780 Fix possible type inconsistency 2024-09-25 17:17:27 -07:00
Tomas Valenta
10fac56058 Remove unused imports 2024-09-25 17:17:08 -07:00
Tomas Valenta
daa0efb8e4 Increase python connections limit 2024-09-25 17:04:12 -07:00
Tomas Valenta
48d01df794 Use json transport for rpc in SDKs 2024-09-25 17:03:58 -07:00
0div
fa90994e49 [squashed many commits] GH actions workflow for API ref autogen 2024-09-24 18:15:31 +02:00
0div
e701f40882
Auto-generate API reference markdown files for the python-sdk (#441)
# Description

- Installed and configured
[pydoc-markdown](https://niklasrosenstein.github.io/pydoc-markdown/).
- Created a script that generates and cleans markdown files with a
configurable package list.
- Added docstrings to relevant public methods of the various sdk classes
in order for pydoc to detect them.

# Test

```bash
cd packages/python-sdk
./scripts/generate_api_ref.sh 
ls ./api_ref
```

# Considerations

This could eventually be used directly as `.mdx` in the docs nextjs app,
it would look like this with current styling:
<img width="836" alt="Screenshot 2024-09-17 at 17 22 43"
src="https://github.com/user-attachments/assets/a23e954f-2834-4fb6-88a6-d87747a0cf49">
2024-09-20 15:04:57 +02:00
Jakub Novak
9a8d504c72 Export types 2024-09-13 16:37:37 +02:00
Jakub Novak
53ee6bbbeb Add pty to Python 2024-09-13 15:45:26 +02:00
Jakub Novak
ca4dc8e24e Decrease default test concurrency to 4 2024-09-13 15:37:19 +02:00
Jakub Novak
1dd46c3dad Skip set timeout in debug mode 2024-09-13 10:00:18 +02:00
github-actions[bot]
aec738b120 [skip ci] Release new versions 2024-09-12 00:25:25 +00:00
Tomas Valenta
63f83e684f Merge branch 'beta' of https://github.com/e2b-dev/E2B into beta 2024-09-11 17:24:17 -07:00
Tomas Valenta
5678997c52 Lower the keepalive; Explicitly try handling RemoteProtocolError retry 2024-09-11 17:24:14 -07:00
github-actions[bot]
d76f694ec6 [skip ci] Release new versions 2024-09-11 23:07:37 +00:00
Tomas Valenta
a4991a25a8 Align keepalive on client with proxies and envd 2024-09-11 15:48:49 -07:00
github-actions[bot]
bc129ca740 [skip ci] Release new versions 2024-09-09 22:04:37 +00:00
github-actions[bot]
e478d51c25 [skip ci] Release new versions 2024-09-05 22:34:39 +00:00
github-actions[bot]
056bd8c70e [skip ci] Release new versions 2024-09-05 20:59:56 +00:00
github-actions[bot]
d741577e66 [skip ci] Release new versions 2024-09-05 18:10:05 +00:00
github-actions[bot]
9b335db335 [skip ci] Release new versions 2024-09-05 10:45:49 +00:00
Jakub Novak
71754a39ab Convert debug env variable to lowercase to prevent mistakes by mixing cases 2024-09-05 12:44:42 +02:00
github-actions[bot]
2d543b5cf1 [skip ci] Release new versions 2024-08-20 22:01:38 +00:00
github-actions[bot]
c991ba0e49 [skip ci] Release new versions 2024-08-20 21:33:40 +00:00
github-actions[bot]
cf5502e615 [skip ci] Release new versions 2024-08-19 15:46:01 +00:00