The Python Ad-Hoc Workflow I’ve Been Waiting For
Python is not just a programming language, it's a useful toolbox: analyze CSV file, visualize some data, try out some library or API. Personally I even use it as a calculator on PC (I hate Windows built-in calculator). But these is a catch. It's all good only if standard library and terminal REPL are enough for you or for the current task i.e. ad hoc.
In this case you're a going to do the following:
- create a "project" directory
- initialize a virtual environment and activate it
- install required packages
- install Jupyter and start it
The alternative is to just mess with your Python's system packages, which is going to lead to dependency conflicts eventually.
|
| Rick & Morty - S3E6 |
Today all you need is
uv
— blazingly fast Python package manager. It allows to start
working on a problem via one line command:
uvx marimo edit script.py --sandbox
-
uvx
- an alias for
uv run tool -
marimo edit- opens the script as notebook (yes, like Jupyter) using marimo -
script.py- your beautiful script -
--sandbox- run the notebook in an isolated environment, with dependencies tracked via PEP 723 inline metadata
Now you are working in the browser tab. When the task is complete, close it
and stop the terminal process. The environment was born for the task, and it
died with the task. This is the definition of a clean, modern, ad-hoc
workflow.

Comments
Post a Comment