posit-dev / posit-dev/positron

Cells-to-Script (C2S) functionality for Positron notebooks

Open
#9,731 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement notebooks-roadmap theme: new notebook frontend
Dominant language
TypeScript
Stars
4.3k
Forks
184
Avg merge
1d 11h
Merged PRs (30d)
206

Description

Problem

Exploration often starts in notebooks, but production requires clean scripts/packages. Current ways like "export as script" or nbconvert only dump code; they don't refactor, structure, or prep for CI/CD. Some data science teams may start with notebooks for exploration and then want to refactor the code to make it ready for production or part of a bigger workflow. Sometimes, they may have a giant notebook and be left with no practical way to convert it into a script.

Potential Solution: C2S (Cells-to-Script)

One-click conversion from notebook to reusable script or package (if needed, could the Assistant help with ambiguous/difficult conversions? -- check runcell).

  • Heuristics + tags (keepcliparamsreportignore) decide where each cell goes (Assistant-assisted if needed?)
  • Outputs:
    • Script mode: single .py with main().
    • Package mode: core.py (functions), cli.py (Typer args), tests, README (from markdown/plots), CI template.
  • Preserves: functions, parameters, and reports; strips exploration junk.
  • Adds: test stubs, lint/format hooks, CI workflow.
UX
  • Notebook menu: Cells to Script/Package...
  • Options: language, mode, tags.
  • Preview diff -> create repo skeleton.
Value

Just putting it here to have this possible desire under the radar for the team. For more details on how this is currently done within Azure context, please check these docs.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the proposed Notebook menu entry, the script and package modes, and the listed outputs such as core.py, cli.py, tests, README, and CI workflow. The issue needs a defined first scope and acceptance criteria before implementation can be considered done.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
data, developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.