Skip to content
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

For Express, emit message if need to upgrade rsconnect-python #1233

Merged
merged 4 commits into from
Mar 21, 2024

Conversation

wch
Copy link
Collaborator

@wch wch commented Mar 20, 2024

Addresses #1232.

When a user runs shiny run app.py on a Shiny Express app, this checks the version of the rsconnect-python package.

If (A) rsconnect-python is installed and (B), the version is less than 1.22.0, then this will print a message to stderr like this, and then it will run the app as usual.

Warning: rsconnect-python 1.21.0 is installed, but it does not support deploying Shiny Express applications. Please upgrade to at least version 1.22.0. If you are using pip, you can run `pip install --upgrade rsconnect-python

@wch wch requested a review from gshotwell March 20, 2024 21:24
shiny/_main.py Outdated

try:
package_version = version(PACKAGE_NAME)
print(package_version)
Copy link
Contributor

Choose a reason for hiding this comment

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

Errant print?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh oops, I had deleted it on my local copy of the file, but forgot to commit. 🤦

shiny/_main.py Outdated

from importlib.metadata import PackageNotFoundError, version

def _safe_int(x: str) -> int:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we already have an indirect dependency on packaging, do we want to make it direct and use their version parsing?

    from packaging.version import parse
    from importlib.metadata import PackageNotFoundError, version
    import sys

    try:
        installed_version = parse(version(PACKAGE_NAME))
        required_version = parse(MIN_VERSION)
        if installed_version < required_version:
      ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good call -- I see that htmltools uses packaging to check versions, so I've updated the code as you suggested.

@wch wch merged commit 81bc6cc into main Mar 21, 2024
24 of 29 checks passed
@wch wch deleted the rsconnect-ver-check branch March 21, 2024 21:50
schloerke added a commit to joesho112358/py-shiny that referenced this pull request Mar 23, 2024
* main: (24 commits)
  chore: Disable broken test on CI; Fix broken docs entries (posit-dev#1241)
  Add back missing session methods (posit-dev#1239)
  Add kitchensink tests for valuebox (posit-dev#1229)
  For Express, emit message if need to upgrade rsconnect-python (posit-dev#1233)
  feat: Editable data frame (posit-dev#1198)
  Add tests for shiny_mode comment detection
  fix(input_dark_mode): Allow users to customize `style` attribute (posit-dev#1207)
  chore(get_current_session): Return default session if current is explicitly None (posit-dev#1086)
  chore: use dev htmtlools (posit-dev#1228)
  feat(layout_columns): Use `sm` as the default `col_widths` breakpoint (posit-dev#1222)
  feat: ensure min/max height args on `value_box()` and column layouts (posit-dev#1223)
  fix(static_assets): Need the directory containing the `app.py`, not the file itself (posit-dev#1219)
  Update bslib and shiny dependencies (posit-dev#1221)
  Update docstring and give hint for mypy
  Add support for Shiny Express in Quarto Dashboards, take 2 (posit-dev#1217)
  Force UTF-8 for Shiny Express on Windows (posit-dev#1203)
  Typing fixes
  feat(card): Report full screen state as a Shiny input (posit-dev#1215)
  Use TypeScript strict mode (posit-dev#1208)
  Update author email
  ...
This pull request was closed.
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