Skip to content

Sample code for: Positron IDE: A Hands-on Python Tutorial - #826

Open
lpozo wants to merge 13 commits into
masterfrom
positron-ide
Open

lpozo wants to merge 13 commits into
masterfrom
positron-ide

Conversation

@lpozo

@lpozo lpozo commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Where to put new files:

  • New files should go into a top-level subfolder, named after the article slug. For example: my-awesome-article

How to merge your changes:

  1. Make sure the CI code style tests all pass (+ run the automatic code formatter if necessary).
  2. Find an RP Team member on Slack and ask them to review & approve your PR.
  3. Once the PR has one positive ("approved") review, GitHub lets you merge the PR.
  4. 🎉

Sample code for Positron IDE: A Hands-on Python Tutorial, revised in CMS post 2375. The positron-ide/ folder contains the sales-data preparation and analysis scripts, a Jupyter notebook, the original 5,130-row dataset with attribution and its Apache 2.0 license, and a reproducible starting environment.

The examples inspect and prepare the data, summarize its distribution, compare median retail and wholesale order values by product category, and create Matplotlib and Plotly charts. Plotly is intentionally added during the tutorial; it is absent from the starting dependency files. Notebook outputs are cleared.

This is a separate replacement proposal for the earlier bike-share materials in #822. That PR remains open and unchanged.

Validation: preparation and analysis scripts run successfully against the supplied CSV; the notebook was executed in a fresh kernel, including Plotly, before clearing outputs. Ruff 0.14.1 formatting and lint checks pass. Positron GUI steps and screenshots remain part of the article review.

lpozo and others added 13 commits September 11, 2026 18:19
The notebook now covers the full arc of src/prepare_sales.py and
src/analyze_sales.py, from loading the raw CSV through cleaning,
describing, grouping, and charting, so it runs without the scripts.

Drop the parent-directory fallback and use PROJECT_ROOT to match the
tutorial's code blocks.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
requires-python in pyproject.toml and the lockfile already constrain
the interpreter to 3.14, and the tutorial has the reader pick 3.14 in
Positron's Create Environment flow.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Match the folder name, the branch, and the tutorial slug.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The notebook holds the cleaned DataFrame in memory, so it no longer
writes data/sales_clean.csv or reads it back. The analysis cells work
from clean_sales directly. The scripts still use the CSV to hand data
from prepare_sales.py to analyze_sales.py.

Pin Matplotlib to 3.11.2 to match the version the tutorial states.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Positron starts a session in the folder holding the file, so Path.cwd()
pointed at src/ or notebooks/ and the data path missed by one level.
Use Path.cwd().parent in both scripts and the notebook, and document
running them from their own folder.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The tutorial no longer walks through nlargest, so remove it from the
script and the notebook.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Positron's Console starts at the workspace root, so the scripts use
Path.cwd(). A notebook kernel starts in the notebook's own folder, so
the notebook keeps Path.cwd().parent.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The tutorial doesn't cover it, so the script's last cell is now just the
to_csv call and the notebook goes straight from cleaning to the analysis.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The tutorial no longer covers installing an external package, so the
interactive chart cell and its uv add instructions are gone.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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