# 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)
```
# 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.