Skip to content

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

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

lpozo wants to merge 17 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. 🎉

lpozo and others added 17 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>
The scripts use Path.cwd() while the notebook uses Path.cwd().parent,
because a notebook's kernel starts in the notebook's own folder. Make
that assumption visible instead of silent.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copy-on-Write is the default in pandas 3.0, so .rename() already returns
an independent object and the later assignments cannot reach the original
sales DataFrame. Verified: sales keeps produce_name and its original
categories without the copy.

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