Posts

uv and VSCODE how to use this on different machines and not break

 You have a system at the office and at home You use uv to manage python projects and venvs by default uv puts the interpreter in a hidden directory locally, on windows something like '"C:\Users\cl\AppData\Roaming\uv\python\cpython-3.12.9-windows-x86_64-none\python.exe'    This is butt, because only one machine will have this exact directory structure. How to fix this. delete .venv uv sync    # uses uv.lock to see what you've already downloaded and recreate a working venv locally next: Create a folder named .vscode in your project root (if you haven't already). Create a file inside it named settings.json . Add this configuration: JSON { "python.defaultInterpreterPath" : "${workspaceFolder}/.venv/Scripts/python.exe" , "python.terminal.activateEnvironment" : true } After doing all of this vscode may still show squigglies like it can't find the right interpreter. How to fix this. ctrl + shift + p find "developer: Reload...

Python--set up and use UV in linux (Raspberry Pi)

12/7/2025 10:26:33 I am running "Trixie" version of Raspberry Pi install lite  ======== #hint: to make my SSH terminal not look crap, make sure to use UTF-8 encoding (I use secureCRT9.6 and properties > appearace > encoding default is "automatic" which isn't working) #install uv  apt update apt install curl #needed for next command #install uv using less HD space vs using pip #alternate/better way (from chatGPT--assumes curl is installed) curl -LsSf https://astral.sh/uv/install.sh | sh ===== #SET PATH needed for terminal app to find uv when you try to run it #put into path--for rpi I could skip this step and just restart bash; not sure w othr distros echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc #for some distros .local above is replaced by .cargo #restart bash   bash   #is uv working?  uv #CREATE NEW PROJECT #cd to ~ you should do the next command from your home dir. uv init ide-test-uv  #replace ide-test-uv with name of...

Installing Python virtual environments on Windows using pyenv and vscode's terminal Salesforce tix 8868

  3/14/2025 05:44:37 https://www.youtube.com/watch?v=Zn5tmx0ynw8 This Alejandro video is for Mac, how about Windows there, bud? (winget is like apt install for Windows--did you know that? i have used it for PSH but not for the W11 OS at large It does not abstract PATH changes however it seems....at least for installing python) We want to install pyenv windows port. pyenv is not native to windows. https://github.com/pyenv-win/pyenv-win  #home page for pyenv-win port. Powershell install didn't work--used git to install. #First install git. From terminal elevated to local admin winget install git.git #followed instructions here. https://github.com/pyenv-win/pyenv-win/blob/master/docs/installation.md#git-commands #install using git. git clone  https://github.com/pyenv-win/pyenv-win.git  "$HOME\.pyenv" #set PATH Variables using these 4 statements from terminal run as local admin [System.Environment]::SetEnvironmentVariable('PYENV',$env:USERPRO...

How to use UV (windows)-- CL notes from Salesforce ticket 8869

 UV replaces things like pip and pyenv, it is one tool to do most everything for interpreter management, virtual env, and adding packages--all the basic Python "use venvs and leave your system python alone" necessities. This ticket goes over installing UV on Windows, working within virtual environments, and using VSCODE as IDE Your steps will vary if: --You are not using Windows as OS --You are not using VSCODE as IDE --You are not using VENVs ============= DO THIS FROM ELEVATED CMD PROMPT IN WINDOWS! 3/14/2025 08:41:34 Good link for UV https://www.youtube.com/watch?v=Zn5tmx0ynw8 good vid: https://www.youtube.com/watch?v=AMdG7IjgSPM **is UV already installed?** from cmd or terminal run uv if it throws up a "here are UV commands you can use" you are good to go. If not, keep reading about how to install. **INSTALL UV AND ADD TO WINDOWS SYSTEM PATH*** #install uv from "system" python using PIP (not sure if this is the best way to do it but it works) python -m...

Python POOP: "name mangling"--how to make class data private or public (odd in Python!)

https://www.youtube.com/watch?v=6cvFzLB6hbA they way Python OOP ("Poop") deals with private and public data in classes is strange indeed. by default all class attributes and methods are public (so, no encapsulation, of any kind, at all) There is no reserved words "public" private protected that the interpreter recognizes. To get around this python employs "name mangling": __x = 7 two underscores means the variable or method is private to the class. If you go outside the class and try to print __x you get an error. However, you can still see the value for this name-mangled variable:  _classname.__x  (one underscore classname, dot, two underscores, variable name) So it's not really private, it is psuedo-private.   Whatever.

Python POOP: static, class methods

 https://www.youtube.com/watch?app=desktop&v=rq8cL2XMM5M You want to create a method that applies to every instantiated object in class "Employee" @classmethod  #keyword def raise_everyone(cls, amount):     cls.raise_amount = amount To use: Employee.raise_amount = 1.05

MAKING SOME POOP==Python classes constructor and instantiating; class variables

https://www.youtube.com/watch?v=ZDa-Z5JzLYM    << intro video on POOP https://www.youtube.com/watch?v=BJ-VvGyQxho&t=1s << class variables. SYNTAX IS A BIT FUCKED UP FOR PYTHON POOP. Easiest way to get going: class Employee:     pass Constructor uses odd syntax "self". I hear self can be anything you want, not sure why they didn't use something like (UserInstantiated) Self can be anything but everyone uses self --we require attributes for firstname, lastname, and pay. class Employee:      def __init__(self, firstname, lastname, pay):          self.first           self.last            self.pay           self.email = first + '.' + last + '@piscesinc.com'      Once constructor is set, you instantiate: emp1 = Employee("charlie", "lamm",50000) emp2 = Employee("Bob", "Kaake",70000) To add a method--creating ful...