Theaboutbox Tech Blog

  • Home

  • Pyenv, Pipenv, Dotenv, oh-my-zsh challenges

    October 26th, 2022

    Filing this one for: I hope I find this post when I have this problem again.

    Like many developers, I have a need to juggle multiple python versions: Python 3.8 to run in AWS Lambda; Anaconda for machine learning models; Latest stable version for everyday development.

    It seems like these days, the multi-python toolchain looks like this:

    • pyenv to install other python versions, along with pyenv-virtualenv to better support conda.
    • venv, generally managed by higher-level tools like Poetry, Pipenv or Hatch.
    • Dotenv to keep track of environment variables that need to be provided to 12-factor applications.

    I am also a fan of oh-my-zsh to automate some basic tasks like:

    • Showing Git branch and commit status in the terminal
    • Activating a project’s virtual environment
    • Adding the variables in .env to the current environment

    But when I tried to get this all working on my new Mac, I could not activate any virtual environment. Ultimately I discovered it was because the shell would prompt me to source .env, and that prompt somehow messed up the activation process via the virtual environment. There seem to be two solutions:

    • Tell oh-my-zsh to always source .env. This breaks the virtual environment the first time, so you need to exit and then cd back to the directory. Or,
    • Don’t use the .env plugin.
  • Self-Serving First Post

    October 7th, 2022

    After a long hiatus from screaming into the ether, I warm up my vocal chords again to shout into the void. Perhaps the void will shout back. Perhaps two years from now when I cannot figure out a basic problem, I will concoct some Google searches that will lead me back here to learn that former-me solved this problem after way-too-much effort.

    But now I find myself confronted with messy problems, and writing about them helps to give them some form and structure, and that’s enough, for now.

Get new content delivered directly to your inbox

  • Follow Following
    • Theaboutbox Tech Blog
    • Already have a WordPress.com account? Log in now.
    • Theaboutbox Tech Blog
    • Edit Site
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar