Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ jobs:
python-version: ${{ matrix.python-version }}
- run: pip install '.[test]'
- run: pip freeze
- run: make fmt
- run: make lint
- run: rsconnect version
- run: make test-${{ matrix.python-version }}
Expand All @@ -62,7 +61,6 @@ jobs:
python-version: 3.8.x
- run: pip install --pre '.[test]'
- run: pip freeze
- run: make fmt
- run: make lint
- run: rsconnect version
- run: make test-3.8
Expand Down Expand Up @@ -188,7 +186,7 @@ jobs:
run: |
pytest tests/test_main_system_caches.py
pytest -m 'vetiver'

test-jupyter:
runs-on: ubuntu-latest
env:
Expand All @@ -211,7 +209,7 @@ jobs:
- name: Start Connect + rsconnect-jupyter
run: |
just integration-testing/up

- name: Run Cypress Tests
run: |
just integration-testing/up-cypress
Expand All @@ -235,7 +233,7 @@ jobs:
path: integration-testing/cypress/screenshots
if-no-files-found: ignore
retention-days: 1

test-connect:
needs: distributions
runs-on: ubuntu-latest
Expand Down Expand Up @@ -265,21 +263,21 @@ jobs:
examples
sparse-checkout-cone-mode: false
token: ${{ secrets.CONNECT_PAT }}

- name: Delete dotnet to save space
run: sudo rm -rf /usr/share/dotnet

- name: Build docker container-image
run: |
cd test/connect-rsconnect-python/test/rsconnect-python/
docker compose --profile rsconnect build

- name: Restore dist
uses: actions/download-artifact@v4
with:
name: distributions
path: dist/

- name: Run rsconnect-python Tests
env:
CONNECT_LICENSE: "${{ secrets.RSC_LICENSE }}"
Expand All @@ -298,7 +296,7 @@ jobs:
docker compose pull connect
docker compose up -d connect
just ../test/connect-rsconnect-python/test/rsconnect-python/test-rsconnect-python-repo

# Videos are captured whether the suite fails or passes
- name: Save videos
uses: actions/upload-artifact@v4
Expand All @@ -307,7 +305,7 @@ jobs:
name: cypress-videos_${{ matrix.PY_VERSION }}_native
path: test/connect-rsconnect-python/cypress/videos
if-no-files-found: ignore

# Screenshots are only captured on failure
- name: Save screenshots
uses: actions/upload-artifact@v4
Expand All @@ -316,5 +314,5 @@ jobs:
name: cypress-screenshots_${{ matrix.PY_VERSION }}_native
path: test/connect-rsconnect-python/cypress/screenshots
if-no-files-found: ignore


4 changes: 2 additions & 2 deletions rsconnect/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1754,7 +1754,7 @@ def get_python_env_info(
logger.debug("Environment: %s" % pformat(environment._asdict()))

if override_python_version:
environment = environment._replace(python = override_python_version)
environment = environment._replace(python=override_python_version)

return python, environment

Expand Down Expand Up @@ -2247,7 +2247,7 @@ def create_python_environment(
directory: str,
force_generate: bool = False,
python: Optional[str] = None,
override_python_version: Optional[str] = None
override_python_version: Optional[str] = None,
) -> Environment:
module_file = fake_module_file_from_directory(directory)

Expand Down
55 changes: 13 additions & 42 deletions rsconnect/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -893,10 +893,7 @@ def _warn_on_ignored_requirements(directory: str, requirements_file_name: str):
@click.option(
"--override-python-version",
type=validation.PYTHON_VERSION,
help=(
"An optional python version to use instead of the version from "
"the detected environment."
)
help=("An optional python version to use instead of the version from " "the detected environment."),
)
@click.option(
"--force-generate",
Expand Down Expand Up @@ -1043,10 +1040,7 @@ def deploy_notebook(
@click.option(
"--override-python-version",
type=validation.PYTHON_VERSION,
help=(
"An optional python version to use instead of the version from "
"the detected environment."
)
help=("An optional python version to use instead of the version from " "the detected environment."),
)
@click.option(
"--force-generate",
Expand Down Expand Up @@ -1093,10 +1087,7 @@ def deploy_voila(
output_params(ctx, locals().items())
app_mode = AppModes.JUPYTER_VOILA
environment = create_python_environment(
path if isdir(path) else dirname(path),
force_generate,
python,
override_python_version
path if isdir(path) else dirname(path), force_generate, python, override_python_version
)

ce = RSConnectExecutor(
Expand Down Expand Up @@ -1252,10 +1243,7 @@ def deploy_manifest(
@click.option(
"--override-python-version",
type=validation.PYTHON_VERSION,
help=(
"An optional python version to use instead of the version from "
"the detected environment."
)
help=("An optional python version to use instead of the version from " "the detected environment."),
)
@click.option(
"--force-generate",
Expand Down Expand Up @@ -1613,12 +1601,9 @@ def generate_deploy_python(app_mode: AppMode, alias: str, min_version: str, desc
),
)
@click.option(
"--override-python-version",
type=validation.PYTHON_VERSION,
help=(
"An optional python version to use instead of the version from "
"the detected environment."
)
"--override-python-version",
type=validation.PYTHON_VERSION,
help=("An optional python version to use instead of the version from " "the detected environment."),
)
@click.option(
"--force-generate",
Expand Down Expand Up @@ -1668,10 +1653,7 @@ def deploy_app(
entrypoint = validate_entry_point(entrypoint, directory)
extra_files_list = validate_extra_files(directory, extra_files)
environment = create_python_environment(
directory,
force_generate,
python,
override_python_version=override_python_version
directory, force_generate, python, override_python_version=override_python_version
)

if app_mode == AppModes.PYTHON_SHINY:
Expand Down Expand Up @@ -1740,6 +1722,7 @@ def deploy_app(
generate_deploy_python(app_mode=AppModes.PYTHON_SHINY, alias="shiny", min_version="2022.07.0")
generate_deploy_python(app_mode=AppModes.PYTHON_GRADIO, alias="gradio", min_version="2024.12.0")


@deploy.command(
name="other-content",
short_help="Describe deploying other content to Posit Connect.",
Expand Down Expand Up @@ -1793,10 +1776,7 @@ def write_manifest():
@click.option(
"--override-python-version",
type=validation.PYTHON_VERSION,
help=(
"An optional python version to use instead of the version from "
"the detected environment."
)
help=("An optional python version to use instead of the version from " "the detected environment."),
)
@click.option(
"--force-generate",
Expand Down Expand Up @@ -1888,10 +1868,7 @@ def write_manifest_notebook(
@click.option(
"--override-python-version",
type=validation.PYTHON_VERSION,
help=(
"An optional python version to use instead of the version from "
"the detected environment."
)
help=("An optional python version to use instead of the version from " "the detected environment."),
)
@click.option(
"--force-generate",
Expand Down Expand Up @@ -2020,10 +1997,7 @@ def write_manifest_voila(
@click.option(
"--override-python-version",
type=validation.PYTHON_VERSION,
help=(
"An optional python version to use instead of the version from "
"the detected environment."
)
help=("An optional python version to use instead of the version from " "the detected environment."),
)
@click.option(
"--force-generate",
Expand Down Expand Up @@ -2209,10 +2183,7 @@ def generate_write_manifest_python(app_mode: AppMode, alias: str, desc: Optional
@click.option(
"--override-python-version",
type=validation.PYTHON_VERSION,
help=(
"An optional python version to use instead of the version from "
"the detected environment."
)
help=("An optional python version to use instead of the version from " "the detected environment."),
)
@click.option(
"--force-generate",
Expand Down
4 changes: 2 additions & 2 deletions rsconnect/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class AppModes:
STATIC_QUARTO,
PYTHON_SHINY,
JUPYTER_VOILA,
PYTHON_GRADIO
PYTHON_GRADIO,
]

Modes = Literal[
Expand All @@ -138,7 +138,7 @@ class AppModes:
"quarto-static",
"python-shiny",
"jupyter-voila",
"python-gradio"
"python-gradio",
]

_cloud_to_connect_modes = {
Expand Down
1 change: 1 addition & 0 deletions rsconnect/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,5 @@ def convert(self, value: str, param: Optional[click.Parameter], ctx: Optional[cl
except (AttributeError, ValueError):
self.fail(f"{value!r} is not a valid python version; expected 3.x or 3.x.y", param, ctx)


PYTHON_VERSION = PythonVersionParamType()
3 changes: 0 additions & 3 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ def test_glob_matcher(self):
("dir", "file", False),
("*.txt", "file.txt", True),
("*.txt", "file.csv", False),

("dir", "dir/file", False),
("dir/*", "file", False),
("dir/*", "dir/file", True),
Expand All @@ -99,7 +98,6 @@ def test_glob_matcher(self):
("dir/*.txt", "dir/file", False),
("dir/*.txt", "dir/file.txt", True),
("dir/*.txt", "dir/.txt", True),

# recursive wildcard pattern using "/" (input paths using OS separator)
("dir/**/*", "dirfile.txt", False),
("dir/**/*", os.path.join("dirother", "a.txt"), False),
Expand All @@ -110,7 +108,6 @@ def test_glob_matcher(self):
("dir/**/*.txt", os.path.join("dir", "a.csv"), False),
("dir/**/*.txt", os.path.join("dir", "sub", "a.txt"), True),
("dir/**/*.txt", os.path.join("dir", "sub", "a.csv"), False),

# recursive wildcards using OS path separator.
(os.path.join("dir", "**", "*.txt"), os.path.join("dir", "a.txt"), True),
(os.path.join("dir", "**", "*.txt"), os.path.join("dir", "sub", "a.txt"), True),
Expand Down
1 change: 1 addition & 0 deletions tests/test_shiny_express.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from rsconnect import shiny_express as express


def test_is_express_app(tmp_path: Path):
tmp_file = str(tmp_path / "app.py")

Expand Down
4 changes: 3 additions & 1 deletion tests/testdata/gradio/app.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import gradio as gr


def greet(name, intensity):
return "Hello, " + name + "!" * int(intensity)


demo = gr.Interface(
fn=greet,
inputs=["text", "slider"],
outputs=["text"],
)

demo.launch(auth = ("username", "password"))
demo.launch(auth=("username", "password"))
Loading