Python scripting (cheatsheet)
Occasionally, you might need to resort to some scripting for bulk changes, due to various reasons.
For instance, a recent encounter for me was bulk deletion of targets in Snyk.
Snyk UI provides a good way to bulk delete projects, but not their targets.
I came across this awesome snyk-cx-tools that did exactly that.
Other use cases are side quests your team might come across, like grabbing specific data from Datadog APIs, etc.
I would like to just keep track of a process that helps keep Python.
So, one of the challenges you'll come across in Python is to have some proper isolation.
I like what Conda does with virtual environments. It is one step ahead of what out-of-the-box venv provides.
How to
conda / venv for clean envs
Create a conda env w/ pip
You can list envs with:
Create a new one with pip and Python 3.10, for example:
Activate env
Switch env simply with:
Install deps
Congrats, you have an isolated env tailored to your Python script needs:
Install deps with:
Profit
Run script with: