Skip to content

Feat/session#1

Open
Aiosa wants to merge 31 commits into
developfrom
feat/session
Open

Feat/session#1
Aiosa wants to merge 31 commits into
developfrom
feat/session

Conversation

@Aiosa
Copy link
Copy Markdown
Member

@Aiosa Aiosa commented May 20, 2026

I would keep this open and maby polish the code a bit. The idea is to be able to provide the WHOLE session config.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1e402b99-5fcd-44d4-b9a1-e8fc5b8e3b78

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/session

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances the display function to support complex session configurations across local, Google Colab, and JupyterHub environments using POST-into-iframe and URL hash mechanisms. It also adds a build-time hook for environment file packaging. Review feedback suggests improving unique ID generation to avoid collisions, standardizing URL path handling, removing redundant imports, and fixing PEP 8 formatting issues.

Comment thread pypi/xopat/__init__.py Outdated
elif is_jupyterhub():
display_jupyterhub_post(server.xopat_url, slide, width, height)
else:
uid = hashlib.md5(f"{time.time()}".encode()).hexdigest()[:8]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Using time.time() as the sole seed for a unique ID can lead to collisions if display() is called multiple times in rapid succession (e.g., within a loop or multiple cells executed together). Consider using uuid.uuid4().hex[:8] for a more robust unique identifier, or at least include os.getpid() in the hash seed.

Comment thread pypi/xopat/__init__.py Outdated
Comment thread pypi/xopat/__init__.py
Comment on lines +126 to +128
raise TypeError(
"display(): second argument must be a slide id (str) or a session config (dict)"
) No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The file is missing a newline at the end, which violates PEP 8 style guidelines.

Suggested change
raise TypeError(
"display(): second argument must be a slide id (str) or a session config (dict)"
)
raise TypeError(
"display(): second argument must be a slide id (str) or a session config (dict)"
)

Comment thread pypi/xopat/colab.py Outdated
Comment on lines +153 to +154
import json as _json
payload_js = _json.dumps(_json.dumps(session)) # → JS string literal
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The local import of json as _json is redundant because json is already imported at the module level on line 8. You can use the global json directly.

Suggested change
import json as _json
payload_js = _json.dumps(_json.dumps(session)) # → JS string literal
payload_js = json.dumps(json.dumps(session)) # → JS string literal

Comment thread pypi/xopat/jupyterhub.py Outdated
Comment on lines +135 to +137
import hashlib
import time
from IPython.display import HTML, display as _ipy_display
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

These imports should be moved to the top of the file to follow standard Python practices and maintain consistency with other modules in the package (like colab.py).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant