Skip to content

Streamlit Cloud deploy readiness + diagnostics + config validator#7

Merged
brej-29 merged 8 commits intomainfrom
cosine/streamlit-cloud-deploy-readiness
Jan 11, 2026
Merged

Streamlit Cloud deploy readiness + diagnostics + config validator#7
brej-29 merged 8 commits intomainfrom
cosine/streamlit-cloud-deploy-readiness

Conversation

@brej-29
Copy link
Copy Markdown
Owner

@brej-29 brej-29 commented Jan 11, 2026

This PR adds deploy readiness for Streamlit Community Cloud with a lightweight diagnostics panel and a runtime config validator, without altering existing logic.

What’s included

  • Documentation: Added docs/deploy_streamlit_cloud.md

    • Step-by-step guide to deploy from GitHub to Streamlit Community Cloud
    • How to set the entrypoint, add secrets via the UI, and local secrets.toml location
    • References to official Streamlit docs are cited in comments/notes
  • Secrets template and ignore rules

    • Ensure .streamlit/secrets.toml.example exists with
      • HF_TOKEN
      • HF_ENDPOINT_URL
      • HF_ADAPTER_ID
      • OPENAI_API_KEY
      • OPENAI_FALLBACK_MODEL (default: gpt-5-nano)
    • Ensure .gitignore ignores .streamlit/secrets.toml
  • Diagnostics UI (non-intrusive)

    • app/streamlit_app.py now includes a lightweight diagnostics system:
      • _update_last_request_diagnostics stores last request data in session_state
      • _render_diagnostics_sidebar renders a Diagnostics expander in the sidebar showing:
        • Active provider for the last request (HF / OpenAI fallback)
        • If HF endpoint paused, shows a friendly hint (no stack traces)
        • Request duration (ms) and max_tokens used
    • Diagnostics panel is non-intrusive and safe for end users
  • Runtime config validator

    • scripts/check_runtime_config.py added
      • Checks presence of required secrets/env vars (HF and/or OpenAI)
      • Prints masked values for sensitive keys (e.g., hf_****1234)
      • Exits non-zero if neither HF nor OpenAI is configured
    • README documents how to run this locally for quick validation
  • CI safety gate

    • CI workflow now runs a syntax gate before tests by compiling Python files:
      • python -m compileall .
    • This helps catch syntax regressions early
  • Local/Deploy readiness

    • README updates reflect how to validate runtime config and how to deploy on Streamlit Cloud
    • The new docs link points to a deploy path that reduces guesswork when configuring secrets

Notes on changes and impact

  • No breaking changes to existing logic. All changes are additive and isolated to UI, config checks, and documentation.
  • The Diagnostics panel helps operators monitor last-request health without exposing internal traces.
  • The runtime config checker provides quick visibility into HF/OpenAI configuration and masks sensitive data.
  • The CI pipeline gains an extra safety gate to catch syntax issues early in CI runs.

Acceptance criteria alignment

  • LOCAL: streamlit run app/streamlit_app.py works; Diagnostics panel appears with meaningful data; python scripts/check_runtime_config.py provides guidance and exit codes
  • DEPLOY: Documentation provides a clear path to deploy on Streamlit Cloud with secrets guidance and references
  • CI: Compile gate runs in CI before pytest to catch syntax regressions

This pull request was co-created with Cosine Genie

Original Task: analytics-copilot-text2sql/kmp818gr6j98
Author: Brejesh Balakrishnan

brej-29 and others added 8 commits January 11, 2026 08:39
… compileall; docs: update README and add deploy_streamlit_cloud.md

Co-authored-by: Cosine <agent@cosine.sh>
…ntime_config.py

Co-authored-by: Cosine <agent@cosine.sh>
…brej-29/analytics-copilot-text2sql into cosine/streamlit-cloud-deploy-readiness
Co-authored-by: Cosine <agent@cosine.sh>
Co-authored-by: Cosine <agent@cosine.sh>
@brej-29 brej-29 merged commit 9b109e3 into main Jan 11, 2026
1 check passed
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.

1 participant