Revisit your dotfiles...often.

So, this happened. Today I learned a hard lesson: you should revisit, refine, and clean up your dotfiles on a regular basis. Like maybe more than once a decade, Ian. I definitely make changes on a weekly basis, but there's plenty of stuff in here with which I've taken the set-it-and-forget-it approach. That changes today.

I wanted to deal with some Pyright/Python bullshit

We have these libs at work that use some Python magic to group a bunch of separate libraries into a namespace. For the purposes of this post, I'll call it: prestige.

So we have a lot of imports that look like this:

from prestige.snowflake import SnowflakeClient
from prestige.ioc import Provider
...and so on

But these are actually all published individually from repos to libs like:

  • prestige-service-snowflake-client
  • prestige-service-ioc
  • etc.

Pyright can't figure this out because in your .venv folder, they're in folders that are named by the library, not one big folder /prestige. And I was tired of manually finding module code I wanted to look at, and wanted to be able to just hit gd (go to definition) in my Neovim.

I didn't want this on other computers

This is a work-only problem. I didn't need this config on other computers or in my .dotfiles, so I (along with the robot) made a local config for Pyright that gets conditionally loaded into my main Neovim config.

This was a new file in my dotfiles, so I needed to make sure it was put in the right place. I use rcm to manage my dotfiles. It's a simple tool that just builds symlinks in your home directory, but when you add a new file, you must re-run it to link that file.

I added these changes and ran rcup like I always do...

...and it just sat there and nothing happened. So, off I went with the robot to try and figure out what the hell was going on.

The robot immediately pointed at my fonts folder, which is a submodule of powerline fonts I have. Why? I dunno, I pretty much never use them. I've been ride-or-die with Victor Mono for quite some time. Should probably just remove that folder, but fine, robot. It wasn't in my SYMLINK_DIRS, so I added it.

Same issue.

Now it's suggesting that there's a 2nd stale rcup running and I need to kill it. Nope, checked ps aux | rg rcup... nuthin'. That didn't sound likely, anyway.

Next, it started checking what rcm thinks it should be managing with a RCRC=/Users/ian.fosbery/.dotfiles/.rcrc lsrc -F. The output looked reasonable and matched what it should be.

Getting impatient, I explicitly told it that I thought it was pi-related. I ran an rcup command, let it hang, and told the robot to look there. At this point, it started doing some crazy perl, lsof, grep kung-fu and saw that the current working directory was inside of the node_modules of pi. WAT?

  1. Verified it shouldn't be doing that with:
λ RCRC=/Users/ian.fosbery/.dotfiles/.rcrc lsrc -F | rg '\.pi'
/Users/ian.fosbery/.pi:/Users/ian.fosbery/.dotfiles/pi:$
  1. It told me to try using env RCRC=..., which I knew I shouldn't have to
  2. ...it works. WAT?

I use the Fish shell, so when I run commands and need an environment variable, I can just prefix it with SOME_ENV_FILE=blah my_command. I do this daily for various tasks.

I also recently started using pi and have a new ~/.pi folder with some settings and some homegrown extensions to make it my own, as Mario suggested. That's really all that's changed recently.

So my hunch is it's something there, but what could it be? Wait, how do I ask fish what a command actually is...?

λ type -a rcup
rcup is a function with definition
# Defined via `source`
function rcup --description 'alias rcup=env RCRC=~/.dotfiles/.rcrc rcup'
env RCRC=~/.dotfiles/.rcrc rcup $argv
end
rcup is /opt/homebrew/bin/rcup

Shit.

At some point, I aliased rcup to override the command and force the env RCRC=~/.dotfiles/.rcrc prefix. Setting aside that this is a bad idea to begin with, this is a problem because I know that you can't use ~—you have to use the absolute path for it to work correctly. I even wrote it in my README to remind myself. So, when the hell did I do this?

λ git blame config/fish/config.fish
...
...
...
7c4d0d41 (Ian Fosbery 2017-02-13 10:41:57 -0500 46) alias rcup="env RCRC=~/.dotfiles/.rcrc rcup"

Twenty-freakin'-seventeen. Cool. How has this ever worked correctly? sigh. Probably hasn't. :facepalm:

Moral of the story

Revisit your dotfiles and clean up old unused or obsolete things. And also dumb mistakes. And do it more than once a decade.