Skip to content

Conversation

@milovate
Copy link
Contributor

Q/A checklist

  • I have tested my UI changes on mobile and they look acceptable
  • I have tested changes to the workflows in both the API and the UI
  • I have done a code review of my changes and looked at each line of the diff + the references of each function I have changed
  • My changes have not increased the import time of the server
How to check import time?

time python -c 'import server'

You can visualize this using tuna:

python3 -X importtime -c 'import server' 2> out.log && tuna out.log

To measure import time for a specific library:

$ time python -c 'import pandas'

________________________________________________________
Executed in    1.15 secs    fish           external
   usr time    2.22 secs   86.00 micros    2.22 secs
   sys time    0.72 secs  613.00 micros    0.72 secs

To reduce import times, import libraries that take a long time inside the functions that use them instead of at the top of the file:

def my_function():
    import pandas as pd
    ...

Legal Boilerplate

Look, I get it. The entity doing business as “Gooey.AI” and/or “Dara.network” was incorporated in the State of Delaware in 2020 as Dara Network Inc. and is gonna need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Dara Network Inc can use, modify, copy, and redistribute my contributions, under its choice of terms.

@coderabbitai
Copy link

coderabbitai bot commented Sep 22, 2025

📝 Walkthrough

Walkthrough

  • enum_multiselect in daras_ai_v2/enum_selector_widget.py now accepts optional tooltip: dict[E, str] | None and tooltip_placement: str parameters, builds an enum_lookup, and conditionally renders checkboxes with help and placement when a tooltip exists for an enum member.
  • daras_ai_v2/stable_diffusion.py adds a public mapping model_pricing_tooltips mapping Text2ImgModels members to price strings.
  • recipes/CompareText2Img.py imports model_pricing_tooltips, removes hard-coded pricing lines from the caption, and supplies tooltip=model_pricing_tooltips and tooltip_placement="right" to the selected_models multiselect.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly and accurately summarizes the main change — enabling tooltip support for the enum multiselect widget — and is short, specific, and developer-focused without extra noise.
Description Check ✅ Passed The pull request description matches the repository's required template: it includes the Q/A checklist, import-time guidance, and legal boilerplate; all template sections are present though the checklist items are unmarked and there is no custom summary of the code changes in the body.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch enum-multiselect-tooltip

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7a91f29 and 49e5a11.

📒 Files selected for processing (3)
  • daras_ai_v2/enum_selector_widget.py (3 hunks)
  • daras_ai_v2/stable_diffusion.py (1 hunks)
  • recipes/CompareText2Img.py (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • daras_ai_v2/stable_diffusion.py
  • daras_ai_v2/enum_selector_widget.py
  • recipes/CompareText2Img.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test (3.10.12, 1.8.3)

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

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (3)
recipes/CompareText2Img.py (1)

104-105: Move this import to the existing top‑level import block for clarity

stable_diffusion is already imported at module load (Lines 23–30), so a local import is redundant. Hoist model_pricing_tooltips into that block and drop this local import.

Apply within this hunk:

-        from daras_ai_v2.stable_diffusion import model_pricing_tooltips

Additionally update the top import list (outside this hunk):

from daras_ai_v2.stable_diffusion import (
    Text2ImgModels,
    text2img,
    instruct_pix2pix,
    sd_upscale,
    Schedulers,
    LoraWeight,
    model_pricing_tooltips,  # add this
)
daras_ai_v2/enum_selector_widget.py (2)

33-40: Minor: build names/labels/lookup via comprehensions

Same result with less code; keeps these derived structures in sync.

-    enum_names = []
-    enum_labels = {}
-    enum_lookup = {}
-    for e in enums:
-        enum_names.append(e.name)
-        enum_labels[e.name] = _default_format_func(e)
-        enum_lookup[e.name] = e
+    enum_names = [e.name for e in enums]
+    enum_labels = {e.name: _default_format_func(e) for e in enums}
+    enum_lookup = {e.name: e for e in enums}

1-12: Optional typing cleanup: TypeVar bound should be enum.Enum (not Type[enum.Enum])

E represents Enum members, not the Enum class type. Adjusting improves static typing and avoids confusion in dict[E, str].

Outside this hunk:

E = TypeVar("E", bound=enum.Enum)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fdaafc8 and 7a91f29.

📒 Files selected for processing (3)
  • daras_ai_v2/enum_selector_widget.py (3 hunks)
  • daras_ai_v2/stable_diffusion.py (1 hunks)
  • recipes/CompareText2Img.py (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
recipes/CompareText2Img.py (2)
daras_ai_v2/enum_selector_widget.py (1)
  • enum_multiselect (13-79)
daras_ai_v2/stable_diffusion.py (1)
  • Text2ImgModels (45-78)
daras_ai_v2/enum_selector_widget.py (1)
components_doc.py (1)
  • checkbox (232-237)
🪛 Ruff (0.13.1)
daras_ai_v2/enum_selector_widget.py

19-19: PEP 484 prohibits implicit Optional

Convert to Optional[T]

(RUF013)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test (3.10.12, 1.8.3)
🔇 Additional comments (2)
daras_ai_v2/stable_diffusion.py (1)

99-104: LGTM: concise pricing tooltip map

Keys use Enum members (not names), which matches enum_multiselect’s lookup. Values align with get_raw_price logic. No runtime risk.

recipes/CompareText2Img.py (1)

133-138: Confirm underlying GUI's checkbox supports tooltip_placement

Wiring is correct — daras_ai_v2/enum_selector_widget.py and widgets/switch_with_section.py accept and forward tooltip_placement and recipes/CompareText2Img.py uses it; I could not find a local gui.checkbox implementation, so verify the external GUI (gooey_gui / whatever provides gui.checkbox) accepts a tooltip_placement kwarg to avoid an unexpected-kwarg error.

@milovate milovate force-pushed the enum-multiselect-tooltip branch from 7a91f29 to 49e5a11 Compare September 23, 2025 16:05
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.

2 participants