posit-dev / posit-dev/positron
Cells-to-Script (C2S) functionality for Positron notebooks
Nobody has claimed this yet.
- 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 (
keep,cli,params,report,ignore) decide where each cell goes (Assistant-assisted if needed?) - Outputs:
- Script mode: single
.pywithmain(). - Package mode:
core.py(functions),cli.py(Typer args), tests, README (from markdown/plots), CI template.
- Script mode: single
- 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
- Bridges exploration -> production cleanly;
- Reduces "notebook debt";
- Gives teams refactored workflow/CI-ready code in minutes.
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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