Summary and Setup

This lesson teaches how to share Python code, both in the form of packages, and reproducible scripts. The teaching philosophy is to cover “good enough” practices, with more content linked out when necessary.

Prerequisite

Knowledge of the interactive terminal or a Jupyter instance suffices.

PYTHON

a = [3,5,6.0]

def mysquarer(_a):
    for x in _a:
        x=x**2
    return _a

mysquarer(a)

Navigation of the file system through a terminal will suffice, as well as remembering that everything is a file on Unix systems, as far as the contents of the lesson at any rate.

BASH

# get files in directory
ls
# get directory name
pwd
# view first few lines of a file
head readme.org

Software setup


Discussion

Details

We basically require pixi and uv. For conciseness, we reproduce the most direct instructions below.

Technically any Python interpreter suffices, here we use pixi to handle system dependencies and run tasks, with uv for managing Python dependencies and environments.

Following along with the pixi instructions upstream here.

BASH

powershell -ExecutionPolicy Bypass -c "irm -useb https://pixi.sh/install.ps1 | iex"

Along with uv from the official installation documentation.

BASH

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Following along with the pixi instructions upstream here.

BASH

curl -fsSL https://pixi.sh/install.sh | sh

Along with uv from the official documentation.

BASH

curl -LsSf https://astral.sh/uv/install.sh | sh

Accounts required


To finalize publishing to an index 1 we need:

A Git instance in the cloud
Any of Github, Gitlab, Sourcehut etc. would work, Github is recommended.
An index account
For the tutorial Test PyPI will suffice, for production, an account on PyPI would be required as well.
Checklist

  1. Making the code widely available over the net↩︎