2026-03-03
Workshop website: https://pythonforrusers.github.io/Python-Workshop.github.io/
👉Find session handouts, assignments, and extra tutorials
👉Ask questions (GitHub Discussion page)
The goal of the workshop is to learn programming in Python using modern, reproducible tools that can be integrated into your own work.
Session 1
venv, Positron IDE, GitHub, Jupyter Notebooks).Session 2 and 3
pandas and great_tables data manipulation.Session 4
scikit-learn and pytorch.plotnine and seaborn visualization.In this session, we will familiarize with Python and essential tools for building reproducible Python projects.
💡 Python overview: What is Python? Python vs. R?
💡 Virtual environments: venv for creating reproducible virtual environments
💡 Integrated development environments Positron and interactive code editng tool Jupyter Notebook
💡 Python reproducible workflow: Integrate GitHub, virtual environments, and Positron IDE into your Python programming projects.
Python is an open-source, high-level, interpreted, general-purpose programming language
Python and R differ in programming philosophy, computational capacity, and extensibility.
| Feature / Task | R | Python |
|---|---|---|
| Scope of functionality | Primarily for statistical and data analysis | General-purpose: ML & AI, software development, scripting, etc. |
| Programming style | Function-oriented | Object-oriented |
| Computational power |
✅ Vectorized operations ⚠️ Memory-intensive for large data and loops |
✅ Faster loop performance ✅ Strong GPU support ✅ Efficient memory use |
| Package ecosystem |
✅Open source: CRAN, Bioconductor, GitHub ✅ Rich ecosystem of statistical tools ⚠️ Fewer ML/AI tools |
✅Open source: PyPI, GitHub ☑️ Emerging statistical packages ✅ Extensive ML/AI tools |
While R is the go-to language for statistical analysis, Python has caught up with many equivalent pacakges that offers similar functionality and styles:
statsmodels / scipy.stats provide regression modeling and hypothesis testing.scikit-survival / lifelines support survival analysis and plotting.polars (~dplyr data cleaning) / great_tables (~gt tables) / plotnine (~ggplot2 visualizations)Python dominates in machine learning and AI development:
scikit-learn is a comprehensive machine learning library that supports supervised regression and classification (e.g., random forests, gradient boosting) and unsupervised clustering (e.g., K-means) analysesTensorFlow / PyTorch are deep learning libraries widely used for computer vision and natural language processing (NLP).optuna / Ray can be integrated into ML/DL workflows for easy and efficient model training, hyperparameter tuning, fine-tuning, etc.Emerging bioinformatics packages that provide standard omics data preprocessing and analysis pipeliness:
scanpy, anndata are libraries for single-cell RNA-seq data loading, preprocessing, and analysisBiopython is a set of tools for biological computation that performs file parsering, sequence analysis, clustering algorithms, etc.pysam works with raw input files (e.g., BAM/SAM/VCF)Make your python project reproducible!
Pip is command line interface (CLI) for managing Python packages. It installs packages from Python Package Index (PyPI) and other sources such as GitHub.
Since Python 3.4+, pip is automatically installed for:
pip <command>
venv
Environments are isolated, self-contained folders with their own Python interpreter and set of installed packages.
Creating virtual environments allows them to operate fully independently and not interfere with each other!
You may find the flexibility of environments helpful when you have multiple project with slightly different dependency requirements…
requirements.txt file.An Integrated Development Environment (IDE) is a suite of tools contained in a software application, which typically includes:
An IDE brings together everything you need to write and run code and manage projects.
Positron
Positron is a new IDE (released 2025) designed for Python + R with many great features:
Jupyter Notebook
Jupyter is an interactive computing tool that lets you combine executable code, Markdown text, and visual components in one file called a notebook (.ipynb).
Positron + Jupyter notebooks for Python = RStudio + RMarkdowns for R.
Git is a version control system that tracks local code changes.
GitHub is a cloud-based platform built on Git for storing, sharing, and collaborating on code.
Why use Git/GitHub?
venv.ipynb) fileSelect your computer’s OS (Windows/macOS) from the Downloads dropdown menu.
💡Recommend Python 3.12, the most recent stable release.
.exe for Windows / .pkg for macOS).For Windows, when the “Install Python” window appears:
For macOS:
.command file. This will open a temporary Terminal shell window. Ensure that you see [Process completed] before closing the window.✅ You should see something like Python 3.12.10 and pip 25.0.1.
If installations not found, it usually means PATH wasn’t correctly updated or you have another Python version in PATH that interferes with the current installation.
Now, you can start coding in Python in the terminal!
And you will see something like:
Now, you can type Python commands directly. For example, importing a package:
💡Before proceeding, ensure you have the following:
The git command line tool is an alternative to GitHub Desktop. If you are comfortable with commands in the terminal, git offers the same functionality and flexibility for managing your code versions.
⏳Take a second to install necessary tools – Any questions?
Type a name in the “Repository name” box (e.g., workshop-project)
Add README.md (optional) and .gitignore (choose Python template)
Click “Create repository”
The .gitignore file tells Git which files/folders to ignore when making commits. E.g., the environment folder (.venv/) that we will later create. This is a good practice to avoid pushing overly large files and/or sensitive data.
git CommandsAn alternative to the previous actions – Using Git CLI.
workshop-project):Or navigate to an existing one:
Create a .gitignore file to avoid committing large and misc files. For example:
Launch Positron.
Open your project folder:
From the Welcome page:
Or
By selecting File > Open Folder (Ctrl+K / Ctrl+O).
Select you folder (<workshop-project>)
venvNote: While Positron has built-in support for Python, you still need it installed locally. Ensure you have followed the previous steps to install python and pip .
Ctrl+Shift+P or Cmd+Shift+P) and type “Python: Create Terminal”python -m venv <env-name>:python command..venv/ folder inside the project directory.Add .venv to .gitignore
The .venv/ folder is often large and specific to your computer. Therefore, it is generally recommended to add it to your .gitignore file and bypass Git tracking.
💡Instead, only commit the requirements.txt file–which lists all dependencies for the virtual environment.
Other useful commands:
To remove an environment:
💡Since a venv is just a folder, you can delete it safely, either by deleting the .venv/ folder or removing via terminal commands:
pip and requirements.txtPip can be used to install, upgrade, and uninstall packages from a virtual environment.
Some useful pip (or pip3 for macOS) commands include:
Packages can also be installed at once using a requirements.txt file:
👉Download the requirements.txt file for this Python workshop series from GitHub repo: https://github.com/PythonForRUsers/Python-Workshop.github.io/blob/main/Downloadable/requirements.txt.
Avoid installing packages into the wrong environment!
Before running pip install, always confirm your environment is activated (you should see (.venv) in your terminal prompt). If forgotten, pip install will install into your global Python which can cause conflicts.
.ipynb)First, let’s organize the folder.
Keep requirements.txt and .gitignore files in the parent directory and create separate folders for scripts, data files, etc.
notebooks/ folder from the Explorer bar on the left side and create a new Jupyter Notebook file:Python 3.x .venv)Select + Code or + Markdown from the top of the notebook (or use keyboard shortcut A or B)
Markdown cells allows add texts, headings, links, images – everything that is not code to execute. Some examples are:
Code chunks are executable.
You can import packages, assign variables, and execute functions by clicking the Run icon to the lelft of the cell. The output will then be displayed below the code chunk.
Now, try run the following in a notebook cell:
This should return the path of the python.exe executable in your .venv/ folder.
<workshop-project> repositoryrequirements.txtnotebooks\<sess1-demo>.ipynb.venv\ –should be included in .gitignore and not be commited!.gitignore when creating the repo, it would be included in the previous (initial) commit.You now have a Python project for the Workshop sessions with a .gitignore file, Git version control, a local project-specific virtual environment, and a working notebook folder inside the Positron workspace.
Questions?
Books / Websites:
Python for Data Analysis, 3ed by Wes McKinney (one of the creators of pandas!)
Git and GitHub learning resources by GitHub Docs with links to free online courses and tutorials.
Official Positron Guide by Posit PBC.
Your first Python project in Positron. for creating new projects and virtual environments using the Positron GUI.
Python Rgonomics by Emily Riederer – Python counterparts of R packages (we will cover some like great_tables and plotnine in later sessions. Stay tuned!)