Commit Graph

571 Commits

Author SHA1 Message Date
Jakub Novak e037a945a2 Increase browser timeout 2024-10-16 03:07:49 -07:00
Vasek Mlejnsky af7fb9f806 Update README.md 2024-10-16 02:44:24 -07:00
Vasek Mlejnsky 51456b05c9 Update README.md 2024-10-16 02:40:27 -07:00
Tomas Valenta 95baca5d1b Update async Python docstrings 2024-10-16 00:52:13 -07:00
Tomas Valenta ce68e3451c Update JS SDK docstrings 2024-10-15 23:10:19 -07:00
Tomas Valenta 16dab9296b Fix default values formatting 2024-10-15 17:13:48 -07:00
Tomas Valenta a60239eb39 Merge branch 'beta' of https://github.com/e2b-dev/E2B into beta 2024-10-15 17:00:32 -07:00
Tomas Valenta 7a3dd7c632 Update JS SDK docstrings 2024-10-15 17:00:22 -07:00
Tereza Tizkova c682d94bc8 Update readmes 2024-10-15 16:40:07 -07:00
Jakub Novak 707b518872 Setup release pipeline to generate api ref 2024-10-15 10:17:45 -07:00
Jakub Novak d8c609d208 Revert pnpm lock 2024-10-15 08:26:25 -07:00
github-actions[bot] ece6346bf7 [skip ci] Release new versions 2024-10-15 15:12:26 +00:00
github-actions[bot] 47a559b729 [skip ci] Release new versions 2024-10-15 14:40:37 +00:00
Jakub Novak 9ef205c2eb Merge pipelines 2024-10-15 07:24:51 -07:00
Jakub Novak e500af6eb3 Bump version 2024-10-15 07:03:58 -07:00
Jakub Novak bcea20f7bc Start tests with python 2024-10-14 23:11:51 -07:00
Jakub Novak 3844442bf1 Bump version 2024-10-14 23:05:33 -07:00
Jakub Novak c8b5d029f2 Fix browser test 2024-10-14 22:53:20 -07:00
Jakub Novak 23ea4adfb1 Rename rpc methods for watcher 2024-10-14 19:51:05 -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 5c31902cc4 Change close to stop for watch dir 2024-10-14 12:10:17 -07:00
Tereza Tizkova 315c264ecd Update SDK readme 2024-10-12 20:49:33 -07:00
Vasek Mlejnsky a8b1ee9181 Add typedoc to dev dependencies of the JS SDK 2024-10-12 12:56:19 -07:00
Tomas Valenta e5448c9abc Add dir with testing artifacts to gitignore 2024-10-11 15:32:39 -07: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 7356efc2bb Fix write operation description 2024-10-09 16:35:30 +02:00
Jakub Novak fbc14b342f Add browser test 2024-10-09 16:26:15 +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 1d9db6489e merge beta 2024-09-26 15:22:32 +02:00
Jakub Novak fe78c0320d Simplify tests 2024-09-26 13:45:24 +02:00
Jakub Novak b334c0e261 Add pty tests in js 2024-09-26 12:36:55 +02:00
github-actions[bot] 8efd4d2795 [skip ci] Release new versions 2024-09-26 06:48:22 +00:00
Tomas Valenta 41853ccf98 Add keepalive ping and error handlers to pty 2024-09-25 17:32:04 -07:00
Tomas Valenta 81d349cb0b Create constant for keepalive header 2024-09-25 17:31:43 -07:00
Tomas Valenta 1c6c44c782 Fix possible type inconsistency 2024-09-25 17:16:04 -07:00
Tomas Valenta 71406236c0 Explicitly configure keepalive pinging 2024-09-25 17:06:59 -07:00
Tomas Valenta 48d01df794 Use json transport for rpc in SDKs 2024-09-25 17:03:58 -07:00
Tomas Valenta 4047d71393 Fix watchdir start bug 2024-09-25 16:05:55 -07:00
0div fa90994e49 [squashed many commits] GH actions workflow for API ref autogen 2024-09-24 18:15:31 +02:00
0div 4059a95e92 Auto-generate API reference markdown files for the js-sdk (#447)
# Description 
- Installed and configured
[typedoc](https://github.com/TypeStrong/typedoc) and its plugin
[typedoc-plugin-markdown](https://github.com/typedoc2md/typedoc-plugin-markdown)
- Created a script that generates and cleans markdown files

# Test
```bash
cd packages/js-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 and TOC:

<img width="340" alt="Screenshot 2024-09-18 at 17 29 22"
src="https://github.com/user-attachments/assets/69e1f01d-cab9-4d8c-8eac-23bc367ae03c">

<img width="685" alt="Screenshot 2024-09-18 at 17 29 32"
src="https://github.com/user-attachments/assets/a585a363-ceb2-48bf-a24d-a7c440607f61">

<img width="659" alt="Screenshot 2024-09-18 at 17 29 45"
src="https://github.com/user-attachments/assets/5591b353-70dc-440a-be2f-890dee057593">


per my previous slack messages:
> typedoc and its typedoc-plugin-markdown are more opinionated than i
assumed.
The extent of how detailed it documents things about classes and
interfaces is less configurable than i thought, for example it forces
you to display all inheritance info (there's a plugin to remove that but
it's clunky) . Also, linking is not configurable when you are converting
to markdown, it seems to keep routing as if it were a static website
directory with relative links so i removed all links.
Had to create a hacky post-processor to handle these obstacles.

i wish i could figure out a way to use anchor links, i looked into
[typedoc-plugin-pages](https://github.com/KnodesCommunity/typedoc-plugins/tree/develop/packages/plugin-pages)
but couldn't get it to behave the way I want.
2024-09-20 15:05:17 +02:00
Jakub Novak 9a8d504c72 Export types 2024-09-13 16:37:37 +02:00
Jakub Novak 48985bdc89 Add envs and cwd for pty 2024-09-13 15:36:53 +02:00
Jakub Novak 0c0c04116f Handle starting event 2024-09-13 10:00:20 +02:00
Jakub Novak 1dd46c3dad Skip set timeout in debug mode 2024-09-13 10:00:18 +02:00
Jakub Novak 12c0c8b89c Add type 2024-09-13 09:59:45 +02:00
Jakub Novak 1dff963dbe Skip kill for debug mode 2024-09-13 09:59:45 +02:00
github-actions[bot] aec738b120 [skip ci] Release new versions 2024-09-12 00:25:25 +00:00