Skip to content

Default quickstart requires-python from the Connect server's Python versions #973

Open

Description

@tdstein

Problem

rsconnect quickstart without --python writes requires-python = ">=<major.minor>" using the interpreter running the CLI (_REQUIRES_PYTHON in rsconnect/quickstart/quickstart.py). Since #972 the CLI requires Python 3.11+, so every default scaffold now requires >=3.11.

ADR-0001 says CLI Python and content Python are independent. A user whose Connect server only has Python 3.10 gets a project that fails Connect's Python matching on deploy, unless they know to pass --python 3.10.

Proposal

When a Connect server is available (a saved default, --server/--name, or CONNECT_SERVER), set the default requires-python from the server's installed Pythons via GET v1/server_settings/python. That's RSConnectClient.python_settings(), already used by preflight.

Open questions:

  • Which floor to pick. Candidates are the newest installed version that is also available locally, or the oldest non-EOL installed version.
  • What happens without a server or credentials. Probably fall back to today's behaviour (the running interpreter) and say so in the output.
  • Whether to build the venv with the matching Python (uv venv --python) so the floor is exercised locally.
  • Keep --python as an explicit override that skips the lookup.

Acceptance criteria

  • With a configured Connect server, rsconnect quickstart without --python writes a requires-python the server can satisfy.
  • Without a server, behaviour is unchanged and the output says where the floor came from.
  • --python still takes precedence and makes no network call.

Activity

  1. self-assigned this
    on Nov 12, 2026
  2. tdstein commented on Nov 12, 2026

    @tdstein
    CollaboratorAuthor

    This was generated by AI during triage.

    Agent Brief

    Category: enhancement
    Summary: Derive quickstart's default content Python from a configured Posit Connect server and exercise that Python locally.

    Current behavior:
    Without --python, rsconnect quickstart writes requires-python = ">=<CLI major.minor>" and creates the project's virtual environment using CLI Python. It does not consult a configured server and has no server-selection options.

    Scaffold generation was reproduced under CLI Python 3.11.14 with CONNECT_SERVER set: the default requirement was >=3.11, which Python 3.10.16 cannot satisfy. An explicit --python 3.10 produced ==3.10.*. The external uv installation step was mocked; this verification did not test a live deployment.

    ADR-0001 keeps CLI Python independent of content Python. PR #972 is currently open; this issue also applies before that PR lands.

    Desired behavior:

    • Keep --python as the highest-priority override. Preserve its existing version/specifier handling and virtual environment behavior, and skip all server discovery and network requests, including credential refresh.
    • Without --python, support the normal Posit Connect server selection and authentication options, environment variables, and saved credentials. Reuse existing resolution precedence, including the saved default and the single-saved-server fallback.
    • When a Posit Connect server is available, retrieve its Python settings. Select the newest usable Python installation explicitly marked publishable for new content. Compare versions numerically, disregard unusable entries, and do not filter content Python by EOL status. The selected version must satisfy the generated requirement.
    • Write requires-python = ">=<selected major.minor>". Create the local virtual environment using that same major/minor; an exact server patch match is unnecessary.
    • Let uv obtain a missing interpreter through its normal download behavior, respecting the user's uv configuration and environment settings. If interpreter acquisition or dependency installation fails, report the failure and remove the incomplete project.
    • With no configured server, retain the CLI-derived requirement and interpreter. Print where the requirement came from without issuing a warning.
    • If credentials are missing or the configured server cannot be queried, warn with the reason, fall back to the CLI-derived requirement and interpreter, and state that server compatibility was not checked.
    • A successful settings lookup containing no usable installation explicitly marked publishable is an error. This includes empty lists, only non-publishable installations, and only entries with missing or invalid publishability flags. Explain the problem and suggest checking the server's Python configuration or using --python to bypass discovery. Leave no project directory behind.
    • Explain the requirement's source in successful output, including the explicit override case. Document the new options, selection rule, fallback, and failure behavior.

    Key interfaces:

    • quickstart and run_quickstart(): accept server context while preserving explicit Python overrides.
    • ServerStore and existing Posit Connect authentication interfaces: reuse saved credentials and established target resolution.
    • RSConnectClient.python_settings(): retrieve the installed Python versions and their publishability information.
    • PyInfo / PyInstallation: represent the settings needed to distinguish installed Python from publishable Python.
    • The generated project.requires-python, virtual environment, and console summary: agree on the selected Python and its source.

    Acceptance criteria:

    • An unsorted response with publishable 3.9 and 3.12 plus non-publishable 3.13 selects 3.12, writes >=3.12, and creates a 3.12 virtual environment.
    • A server offering only publishable 3.10 selects content Python 3.10 even when CLI Python is newer; EOL status does not exclude it.
    • Server selection works through --server, --name, CONNECT_SERVER, a saved default, and existing single-server resolution, with established precedence and authentication behavior.
    • No configured server produces the current CLI-derived requirement and interpreter, reports the source, and makes no server request.
    • Missing credentials, rejected authentication, and an unreachable server produce a clear warning and the same CLI-derived fallback.
    • Successful settings responses with no usable publishable installation fail with actionable guidance and leave no scaffold directory.
    • Mixed valid and unusable installation entries select the newest usable publishable entry.
    • --python 3.10, an exact patch version, and a specifier range preserve existing semantics and make no server or credential-refresh request, even when server configuration is present.
    • The selected content Python may be downloaded through normal uv behavior; disabled downloads and installation failures produce an error and clean up the incomplete project.
    • Output identifies whether the requirement came from the server, CLI Python, an explicit override, or a fallback, and the command documentation describes these behaviors.

    Out of scope:

    • Changing preflight's Python recommendation policy or Connect's deployment matching.
    • Changing the CLI's supported Python versions or adding EOL restrictions to content Python.
    • New discovery support for Connect Cloud, shinyapps.io, or Snowflake-specific authentication setup.
    • Creating a separate .python-version pin, persisting a deployment target in the scaffold, or changing explicit --python semantics.
    • Retrying failed dependency installation with a different Python version.
  3. added
    ready-for-agentFully specified, ready for an autonomous coding agent
    and removed
    needs-triageMaintainer needs to evaluate this issue
    on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestready-for-agentFully specified, ready for an autonomous coding agent

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions