Skip to content

Andrew/api factor#370

Merged
ayjayt merged 16 commits into
masterfrom
andrew/api-factor
Aug 8, 2025
Merged

Andrew/api factor#370
ayjayt merged 16 commits into
masterfrom
andrew/api-factor

Conversation

@ayjayt
Copy link
Copy Markdown
Collaborator

@ayjayt ayjayt commented Jul 29, 2025

  • Add new API functions kaleido.start_sync_server() and kaleido.stop_sync_server() to start and stop global Kaleido server
  • Modify kaleido.calc_fig_sync(), kaleido.write_fig_sync(), and kaleido.write_fig_from_object_sync() to use the global server if running
  • Various typing improvements

The principal change here is in:
src/py/kaleido/_sync_server.py

However there was type work done and some error messages improved elsewhere to silence the type checker.

@ayjayt
Copy link
Copy Markdown
Collaborator Author

ayjayt commented Jul 29, 2025

kaleido.start_sync_server() # take same arguments as kaleido.Kaleido

start = time.perf_counter() # hora inicio

for i in range(10):
    go.Figure(data=[go.Scatter(y=[1, 3, 2])]).write_image(f"slow_test_{i}.jpg")

print(f"Duration: {time.perf_counter() - start}") # calcular duración

kaleido.stop_sync_server()

Comment thread src/py/kaleido/_fig_tools.py Outdated
Comment thread src/py/kaleido/_fig_tools.py Outdated
else:
full_path = path
if not full_path.parent.is_dir():
raise RuntimeError(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under what circumstances would this RuntimeError be reached?

(not directly relevant to this PR, just curious)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/path/to/my/new_file.jpg <-- will show up in the else. But we expect they've created everything up until new_file.jpg, we'll create that though.

Comment thread src/py/CHANGELOG.txt Outdated
@@ -1,3 +1,4 @@
- Add not-released api functions start/stop_sync_server
Copy link
Copy Markdown
Collaborator

@emilykl emilykl Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not-released

I mean... everything added in a PR is not-released, until we release it. 🙃

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, i think i meant not-documented

Comment thread src/py/kaleido/__init__.py Outdated
Comment on lines +41 to +42
"start_kaleido_sync_server",
"stop_kaleido_sync_server",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"start_kaleido_sync_server",
"stop_kaleido_sync_server",
"start_sync_server",
"stop_sync_server",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is my ruff broken? i feel like thats a ruff catch

@ayjayt ayjayt marked this pull request as ready for review August 1, 2025 01:19
@gvwilson gvwilson added fix fixes something broken P1 needs immediate attention labels Aug 1, 2025
Copy link
Copy Markdown
Collaborator

@emilykl emilykl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@ayjayt ayjayt merged commit fc78f04 into master Aug 8, 2025
4 checks passed
@ayjayt ayjayt deleted the andrew/api-factor branch August 8, 2025 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix fixes something broken P1 needs immediate attention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants