Skip to content

feat: Warn about options that deploy notebook --static ignores - #925

Merged
jmwoliver merged 3 commits into
fix/static-notebook-no-requirementsfrom
fix/static-notebook-ignored-options
Nov 6, 2026
Merged

jmwoliver merged 3 commits into
fix/static-notebook-no-requirementsfrom
fix/static-notebook-ignored-options

Conversation

@jmwoliver

Copy link
Copy Markdown
Contributor

Stacked on #924. This PR's base is that branch, so the diff shows only this change. Merge #924 first, then retarget this PR to main.

Problem

After #924, deploy notebook --static no longer resolves a Python or R environment, but it still accepts options that only shape one and silently ignores them. Extra files are also ignored: the static bundle contains only the rendered HTML.

Change

With --static, deploy notebook warns when any of these is given explicitly: --requirements-file, --force-generate, --package-installer, --override-python-version, --image, --disable-env-management, --disable-env-management-py, --disable-env-management-r, --exclude-renv. "Explicitly" means the parameter source isn't the default, using the existing validation.get_parameter_source_name_from_ctx. So, for example, the default requirements.txt doesn't trigger a warning. It also warns if extra files are passed. The deploy still goes ahead; these are warnings, not errors.

$ rsconnect deploy notebook --static -g --image foo nb.ipynb data.csv
    Warning: --static deploys only the rendered HTML, so these options have no effect: --image, --force-generate
    Warning: --static deploys only the rendered HTML, so these extra files are not included: data.csv

Tests

  • test_deploy_notebook_static_warns_on_ignored_options: one case per option, plus a combined case using short flags.
  • test_deploy_notebook_static_warns_on_extra_files.
  • test_deploy_notebook_static_needs_no_environment now also asserts that no warning appears when no ignored options are given.

The full suite passes locally (1861 passed, 15 skipped) and ruff is clean.

A static notebook bundle contains only the rendered HTML, so options that
shape a source bundle's Python or R environment (--requirements-file,
--force-generate, --package-installer, --override-python-version, --image,
the environment management options, --exclude-renv) and extra files have no
effect. Warn when any of them is given explicitly instead of silently
ignoring it.
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-11-06 20:15 UTC

@jmwoliver
jmwoliver requested a review from tdstein November 6, 2026 15:45

@joshyam-k joshyam-k left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice! this was going to be my one piece of feedback on the base PR

Comment thread rsconnect/main.py Resolved
Comment thread tests/test_main.py Resolved
Comment thread rsconnect/main.py Resolved
…tebook-ignored-options

# Conflicts:
#	docs/CHANGELOG.md
#	rsconnect/main.py
Cover deploy notebook without --static passing options --static ignores,
so moving the warning out of the static branch fails a test. Compare the
warned options as a set, since their order comes from the decorators.
@jmwoliver
jmwoliver merged commit 439a675 into fix/static-notebook-no-requirements Nov 6, 2026
3 checks passed
@jmwoliver
jmwoliver deleted the fix/static-notebook-ignored-options branch November 6, 2026 20:15
jmwoliver added a commit that referenced this pull request Nov 6, 2026
* fix: Don't resolve dependencies for deploy notebook --static (#923)

The static bundle contains only the HTML rendered locally by nbconvert, but
deploy_notebook resolved a requirements file, inspected the Python
environment and read renv.lock before branching on --static, then threw all
of it away. This required a requirements file (or --force-generate), failed
on an incompatible renv.lock, and required rsconnect in the --python
interpreter.

With --static, only look up the interpreter that runs nbconvert.

* fix: Find the notebook's project environment for deploy notebook --static

#920 added project environment discovery relative to the content directory,
but the static path called which_python without one, so it searched from the
current working directory instead of the notebook's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* review: Clarify static notebook requirements and test invalid --python

The rendering environment runs the notebook, so it needs ipykernel and the
notebook's imports, not only nbconvert. Cover --python validation on the
static path with a directory, which reaches which_python on every platform.

* feat: Warn about options that deploy notebook --static ignores (#925)

* feat: Warn about options that deploy notebook --static ignores

A static notebook bundle contains only the rendered HTML, so options that
shape a source bundle's Python or R environment (--requirements-file,
--force-generate, --package-installer, --override-python-version, --image,
the environment management options, --exclude-renv) and extra files have no
effect. Warn when any of them is given explicitly instead of silently
ignoring it.

* review: Test that only --static warns, and ignore option order

Cover deploy notebook without --static passing options --static ignores,
so moving the warning out of the static branch fails a test. Compare the
warned options as a set, since their order comes from the decorators.

---------

Co-authored-by: Taylor Steinberg <taylor@steinberg.xyz>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

3 participants