Skip to content

Add runnable scripts to numpy-reshape materials#788

Open
realpython-bot wants to merge 1 commit into
realpython:masterfrom
realpython-bot:numpy-reshape-scripts
Open

Add runnable scripts to numpy-reshape materials#788
realpython-bot wants to merge 1 commit into
realpython:masterfrom
realpython-bot:numpy-reshape-scripts

Conversation

@realpython-bot

Copy link
Copy Markdown
Contributor

Adds script versions of the code from Using NumPy reshape() to Change the Shape of an Array, following the current practice of shipping runnable .py files in the materials repo (this folder was previously image-only).

Added

  • One script per tutorial section: array_shape.py, change_shape.py, reduce_dimensions.py, increase_dimensions.py, compatible_shapes.py, order_parameter.py, color_image.py, wildcard.py
  • requirements.txt (numpy==2.5.0, Pillow==12.2.0)

Updated

  • README.md documents the scripts

All scripts were verified running on numpy 2.5.0 / Pillow 12.2.0. Scripts that use random data seed the generator for reproducible output.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@realpython-bot

Copy link
Copy Markdown
Contributor Author

Reviewed and ready to merge — needs a maintainer with merge rights.

I verified this PR end-to-end:

  • ✅ All 8 scripts run cleanly (exit 0) with correct, reproducible output (seeded RNGs).
  • requirements.txt (numpy==2.5.0, Pillow==12.2.0) installs clean in a fresh venv.
  • color_image.py produces valid, displayable images — order="C" (interleaved) and order="F" (the red/green/blue triptych) both render correctly via PIL.Image.show(), the right mechanism for a standalone script.
  • ✅ CI (Linux314) passing; mergeable / no conflicts.

This folder is the download target for the live opt-in on the tutorial (numpy-reshape-repositorytree/master/numpy-reshape). Until this merges, that download serves only README.md + poppy.jpg, so merging this is what actually delivers the runnable scripts to readers.

I could not merge it myself — the realpython-bot account lacks MergePullRequest permission on this repo. Could a maintainer give it the final merge click? Thanks!

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.

2 participants