Skip to main content

Python at Recursion

Installing a new python version

I get errors after a new pyenv install X that I don’t get on versions I’ve been using awhile (e.g. 3.9.15). This section is attempting to collect all the commands I ran over time to make new versions work.

  1. Confirm new version is active with pyenv version
  • If not, activate new version with pyenv local X or pyenv global X
  1. Solve clang error…how?
  2. Run pip install -U 'roadie[cli]'

Set up a new Python project on my laptop

  1. Confirm desired pyenv version is active with pyenv version
  2. Confirm roadie is installed and up-to-date with pip install -U 'roadie[cli]'
  3. Create venv by running roadie venv
  • or run my rv alias (which runs pip install -U 'roadie[cli]' && roadie venv, which creates new pyenv shell case)
  • It’s safe to delete a project’s venv folder(s) + rerun the above steps anytime (e.g. if dependency-related issues come up and seem difficult to debug).
  • The rv alias is safe to rerun anytime.
  1. Update my venv, edit and run aliases to include cases for this project

Links:

Updating Python dependencies

  • Update the lock file by running roadie lock or roadie lock -c to update everything

Pandas DataFrames

  • Series = entire column
    • you can modify an entire column at once with a single expression (e.g. line 63 of phenoapp/plots/heatmap/__init__.py):
      • plot_value = plotdf.distance * COLOR_DARKENING_FACTOR — this multiplies every cell in the “distance” column by the darkening factor and returns the modified series (kind of like an Array.map)

Inbox