Skip to content

write-manifest <framework> ignores --force-generate #888

Closed

Description

@tdstein

rsconnect write-manifest <framework> --force-generate fails even though -g was passed:

$ rsconnect write-manifest api -g .
Error: The requirements file 'requirements.txt' does not exist in '.'.
Please create the file or specify a different file with --requirements-file.
To have the requirements file generated using pip freeze, pass --force-generate.

Cause

manifest_writer resolves the requirements file with force_generate and passes None (meaning "use pip freeze") to _write_framework_manifest. _write_framework_manifest then resolves it again with force_generate=False (rsconnect/main.py:4485), which turns None back into the default requirements.txt.

This affects every framework subcommand built by generate_write_manifest_python (api, flask, fastapi, dash, streamlit, bokeh, shiny, gradio, panel). write-manifest notebook -g is not affected.

Fix

Use the already-resolved value in _write_framework_manifest instead of re-resolving it, and add a test that write-manifest api -g writes a manifest and requirements.txt without an existing requirements file.

Context: the Connect docs dropped --force-generate guidance partly because of this (posit-dev/connect#46493).

Activity

  1. added
    bug
    ready-for-agent
    on Oct 27, 2026
  2. tdstein commented on Oct 27, 2026

    @tdstein
    Author
  3. tdstein commented on Oct 27, 2026

    @tdstein
    CollaboratorAuthor

    Codex Workpad

    Plan

    • 1. Fix framework manifest requirements handling
      • 1.1 Reproduce the failure without an existing requirements file.
      • 1.2 Preserve the resolved requirements source and add CLI regression tests.
      • 1.3 Run focused checks and review the diff.
      • 1.4 Publish the PR and bind validation to the returned PR head.

    Acceptance Criteria

    • write-manifest api -g creates a manifest and generated requirements.txt without a preexisting requirements file.
    • Framework manifests continue to honor the resolved requirements source.

    Validation

    • Command:

      • .venv/bin/pytest -q tests/test_main.py::TestWriteManifestFramework tests/test_main.py::TestWriteManifestCRLF tests/test_main.py::TestWriteManifestExcludeRenv tests/test_write_manifest_pyproject.py tests/test_environment.py
    • Commit: 577cb37

    • Observed: 69 passed.

    • Command:

      • .venv/bin/ruff check rsconnect/main.py tests/test_main.py
    • Commit: 577cb37

    • Command:

      • .venv/bin/ruff format --check rsconnect/main.py tests/test_main.py
    • Commit: 577cb37

    • Command:

      • git diff HEAD^ HEAD --check
    • Commit: 577cb37

    Evidence

    Reproduction

    • Command: project_dir=$(mktemp -d /tmp/rsconnect-888-XXXXXX); printf 'app = object()\n' > "$project_dir/app.py"; .venv/bin/rsconnect write-manifest api -g "$project_dir"
    • Observed: Exit 1; requirements.txt does not exist despite -g.
    • Run: local reproduction 2026-10-27.
    • Commit: b1f5ca2

    Notes

    • Workspace starts clean; repository contains no AGENTS.md.
    • The regression test failed before the fix for both missing and existing requirements files; both pass after the fix.
    • Earlier host publication and workpad operations failed due to Git and GitHub access; publication now succeeds.
    • Handoff: PR Fix force-generate for framework manifests #891, commit 577cb379e7b33729bfa6cbe40baa75e6084113a6; 69 focused tests and Ruff and diff checks pass.

    Confusions

    • None.
  4. self-assigned this
    on Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugready-for-agent

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions