Skip to content

Instantly share code, notes, and snippets.

View matthewfeickert's full-sized avatar
💭
☕ + 💻

Matthew Feickert matthewfeickert

💭
☕ + 💻
View GitHub Profile
@matthewfeickert
matthewfeickert / README.md
Created September 27, 2021 21:31
Simple cProfile example with snakeviz

Simple cProfile example with snakeviz

Environment Setup

Make a Python virtual environment and install the dependencies

python -m pip install --upgrade pip setuptools wheel
python -m pip install -r requirements.txt
@matthewfeickert
matthewfeickert / README.md
Last active March 4, 2024 06:24
Motivation for using Python virtual environments for easy sharing
@matthewfeickert
matthewfeickert / config_example.py
Last active October 23, 2023 09:32
JSON config files with argparse from the CLI example
import json
import argparse
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
matplotlib.rcParams['text.usetex'] = True
# Inspiration came from https://stackoverflow.com/q/3609852/8931942
@matthewfeickert
matthewfeickert / README.md
Last active September 1, 2023 09:32
Use GMail's SMTP servers to use CERN email account as an alias

Use GMail's SMTP servers to use CERN email account as an alias

  1. Enable [forwarding of emails from Outlook][outlook-forwarding] to GMail

    1. In Outlook select Settings > Mail > Forwarding.
    2. Select "Enable forwarding".
    3. Enter your GMail address in the box under "Forward my email to:".
    4. (Optional, but recommended) Select "Keep a copy of forwarded messages"

[![outlook-view][outlook-view-gist]][outlook-forwarding]

@matthewfeickert
matthewfeickert / README.md
Last active July 19, 2023 21:49
Use VS Code to run notebooks on remote servers in environments built on top of LCG views

Use VS Code to run notebooks on remote servers in environments built on top of LCG views

(Note that this whole thing is a bit cursed as LCG views are a terrible way to distribute Python environments)

Setup

Get a working VS Code server on the remote

Requires:

@matthewfeickert
matthewfeickert / README.md
Last active April 12, 2023 12:38
Debug for VS Code crashing when opening Python files for https://gitlab.cern.ch/gstark/pycolumnarprototype

Unexpected crashing of VS Code when opening Python files

Today (2023-04-03) VS Code is crashing whenever a Python file is opened in the mixed language repository https://gitlab.cern.ch/gstark/pycolumnarprototype

This behavior has not been observed until today. The machine uptime has been minimal.

$ uptime
 17:57:25 up 14:11,  1 user,  load average: 2.04, 2.15, 2.04
@matthewfeickert
matthewfeickert / README.md
Last active March 20, 2023 19:17
Bootstrap example to get around bugs with panda and rucio on CVMFS and PYTHONPATH pollution

Bootstrap example

Bootstrap example to get around bugs with panda and rucio on CVMFS and PYTHONPATH pollution as described in the March 2023 PATHelp email thread "[ROOT undefined symbol error when setting up ROOT and Rucio together after setupATLAS][PATHelp-thread]".

Example

The PYTHONPATH is polluted with Python 3.6, so make an environment with the last pip and pandas releases that were compatible with Python 3.6.

The boostrap.sh Bash script sets up a Python virtual environment that has a version of pip that won't break with Python 3.6 which is further used in example.sh.

@matthewfeickert
matthewfeickert / README.md
Created March 18, 2023 05:37
Examples of problems with installPip not using virtual environments

Failure of not using a virtual environment in installPip

By not using a virtual environment installPip makes it unable to interact with the virtual environment manually as one can not reliably manually install or uninstall packages.

Example: Unable to uninstall numpy

$ setupATLAS
...
$ asetup AnalysisBase,22.2.110
@matthewfeickert
matthewfeickert / README.md
Last active March 15, 2023 05:40
Technical response to python packages for atlasexternals (https://its.cern.ch/jira/browse/ATLASG-2477)

20223-03-15 technical response to JIRA ticket ATLAS ASGATLASG-2477: python packages for atlasexternals

As a warning, this is going to be a long response as it is going to need to discuss the technical details of how the way LCG views and the current way ATLAS externals works is fundamentally at odds with the core concepts of Python virtual environments. To make this more digestible in a JIRA ticket thread and to avoid repeating myself (somewhat) I am going to assume that anyone who is reading this will read the README I've already written for cvmfs-venv which explains this at a high level. Also, as I find JIRA's lack of Markdown to make reading next to anything on it pretty terrible I've put the full contents of the technical parts that follow in this GitHub Gist in case you want to read it

@matthewfeickert
matthewfeickert / README.md
Last active February 13, 2023 16:13
Instructions on creating an IPython kernel for a venv on UChicago AF

Creating a Jupyter kernel for Python virtual environment on UChicago Analysis Facility

For robustness and reproduciblity, I would like to use a Python virtual environment when working with ml_platform:latest containers (easy enough) but I would also like to have IPython kernels that I make in that virtual environment be recognized by Jupyter Lab's launcher. I believe that the easiest way to do this is to just use the --user flag when creating an IPython kernel, but I wanted to know if there is an alternative / create this as an example Issue for others to reference.

Here's an exam