How to make an object transparent in the viewport? I would like to make one of my objects transparent in the 3D Viewport. When I look around I get tons of answers - all different, and some of them a lot more complicated than others and also older from versions of Blender. I can't get any of them to work. I just want the simplest way to make anything transparent; like descreasing the alpha channel or checking an x-ray parameter or something like that. Any ideas?
I tried bpy.context.active_object.show_transparent=True but I'm sure what it does, but it seems like what I want.
Here are some of the links I found:

Blender view-port transparent objects How to This illustrates the effect I would like and it is only a few simple commands, but I can't find the functionality he describes.

Show transparent viewport image (via script) - Very complicated and incomplete

https://www.katsbits.com/tutorials/blender/scene-view-alpha-transparency.php - Very long and comprehensive.

Material Opacity in viewport? - Just what I want, but I can't find the functions.

I also think I read something about an x-ray setting. But this might have been an addon. But that would be fine for my purpose.
One option is to set the alpha value (fourth component) of Material.diffuse_color:

float array of 4 items in [0, inf], default (0.8, 0.8, 0.8, 0.8)

import bpy

# Get the object in context
obj = bpy.context.object

# Get the active material
mat = obj.active_material

# Set the alpha value of the diffuse color
mat.diffuse_color = (0.0 , 0.0 , 1.0 , 0.7)