Skip to content

fix: inspect the project Python environment - #920

Merged
tdstein merged 16 commits into
mainfrom
symphony/posit-dev_rsconnect-python_889-e922273cb0dbb9c6
Nov 6, 2026
Merged

tdstein merged 16 commits into
mainfrom
symphony/posit-dev_rsconnect-python_889-e922273cb0dbb9c6

Conversation

@tdstein

@tdstein tdstein commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

select project Python → inspect from CLI environment → query target Python and freeze its packages
                                                    → render static notebooks with target Python

Resolve uv once for export and pip-free or old-pip environments. Preserve pip's bootstrap exclusions and validate editable dependencies for both freeze paths.

Evidence

  • Before: an activated project environment was ignored and an isolated target could not import the inspector.
  • After: focused environment, manifest, and notebook tests pass on Python 3.14 and 3.8; real pip 20.2.4 compatibility passes.
  • Live Connect acceptance of a manifest without a pip version remains unverified because available credentials failed.

Merge Danger

Door: Two-way

Blast Radius: Deployment environment discovery and generated requirements.

Closes #889

tdstein and others added 9 commits October 27, 2026 17:09
- Pass --python through to deploy quarto.
- Run the inspector and pip with -E instead of -I so user site-packages
  are still visible, from the inspector's directory so a stray pip.py in
  the working directory is not imported.
- Resolve ".." in the project path before searching parents for .venv.
- Fall back to uv on PATH when the bundled uv binary can't be found.
- Report pyproject.toml parse errors with their details.
- Make preflight check the selected interpreter's Python version and
  accept --python, matching deploy.
- Isolate interpreter-lookup and preflight tests from the shell's
  VIRTUAL_ENV, CONDA_PREFIX, and working directory.

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

github-actions Bot commented Nov 5, 2026 •

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

tdstein and others added 2 commits November 5, 2026 14:41
The inspector runs under rsconnect's own interpreter and imports its
dependencies (packaging, toml). Starting it with -I hid user
site-packages and PYTHONPATH, so `pip install --user` and PYTHONPATH
installs failed with "No module named 'packaging'".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without the flush, Python 3.8 left nbconvert's diagnostics buffered when
the error was raised, failing test_deploy_static_notebook_render_failure.

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

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
11114 9846 89% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
rsconnect/bundle.py 89% 🟢
rsconnect/environment.py 94% 🟢
rsconnect/main.py 87% 🟢
rsconnect/preflight.py 87% 🟢
rsconnect/subprocesses/inspect_environment.py 93% 🟢
TOTAL 90% 🟢

updated for commit: 36734fa by action🐍

@tdstein
tdstein requested review from amol- and joshyam-k November 5, 2026 19:49
Comment thread rsconnect/environment.py Resolved
Comment thread docs/CHANGELOG.md Resolved
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
tdstein and others added 3 commits November 6, 2026 10:57
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…3cb0dbb9c6

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tdstein
tdstein enabled auto-merge (squash) November 6, 2026 16:59
@tdstein
tdstein merged commit 2c0fa9b into main Nov 6, 2026
27 checks passed
@tdstein
tdstein deleted the symphony/posit-dev_rsconnect-python_889-e922273cb0dbb9c6 branch November 6, 2026 17:07
tdstein added a commit that referenced this pull request Nov 6, 2026
…atic

#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>
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.

Inspect the project's Python environment instead of the CLI's (support uv tool install)

2 participants