-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Update themes and require Shiny v1.2.0 #48
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cosmetic cleanup. Don't know if you want to keep get_theme_deps
within shinylive. It could allow for older versions of shiny.
Thank you!
tests/test_theme_picker.py
Outdated
def get_theme_deps(theme: shiny.ui.Theme) -> htmltools.HTMLDependency: | ||
if hasattr(theme, "_html_dependency"): | ||
# shiny < v1.2.0 | ||
deps = getattr(theme, "_html_dependency")() | ||
else: | ||
deps = getattr(theme, "_html_dependencies")() | ||
# In shiny >= v1.2.0, `_html_dependencies()` returns a list of deps, but for | ||
# shinyswatch we're expecting the default case to be a single dependency. | ||
assert isinstance(deps, list) | ||
assert len(deps) == 1 | ||
deps = deps[0] | ||
|
||
return deps | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code is unused
def get_theme_deps(theme: shiny.ui.Theme) -> htmltools.HTMLDependency: | |
if hasattr(theme, "_html_dependency"): | |
# shiny < v1.2.0 | |
deps = getattr(theme, "_html_dependency")() | |
else: | |
deps = getattr(theme, "_html_dependencies")() | |
# In shiny >= v1.2.0, `_html_dependencies()` returns a list of deps, but for | |
# shinyswatch we're expecting the default case to be a single dependency. | |
assert isinstance(deps, list) | |
assert len(deps) == 1 | |
deps = deps[0] | |
return deps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or did you want to use this method within the package and then we can relax our shiny version requirement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I originally had an implementation that let us relax that shiny version requirement that I took out on second thought. On the balance, I don't think it's worth maintaining the additional logic, which was repeated in a few places with slight variations because constraints and uses were different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed unused code in cbcdb28
Updates shinyswatch to require Shiny v1.2.0
The biggest change is that in posit-dev/py-shiny#1743 we renamed
shiny.ui.Theme._html_dependency()
toshiny.ui.Theme._html_dependencies()
, only to allow subclasses ofTheme
, likeThemeBranded
, to append additional dependencies.