Your question is too broad for a complete answer in one place. Below I outline the solution and suggest areas of research for specific steps. Please try to put together a complete script on your own and then come back with specific questions about areas where you are stuck.
Yes it is programmatically possible. I assume by "position the viewport" you mean "position the camera". Here's a step by step commentary on your pseudocode. With a little additional research you should be able to piece together the script you need.
model = load("my_model.blend")
Your model can be stored in a separate Blend file in one of two ways. You'll have to decide between
- library linking; or
- the new asset library
For now I recommend library linking. There are several questions with good answers about how to gather a model from library by linking
textures = ["stone", "wood", "glass"]
You've forgotten to mention how the materials that these textures name will be created. You could place them in a separate blend file; you could create them manually; or you could create them using Python. There are several questions with good answers about creating materials and modifying the material node trees to get what you want. But in your case I would recommend storing them in a separate blend file and then linking them, just as with the model.
view_port.set_position(100,200,300)
view_port.set_rotation(-42,0)
I've treated the above lines together. You want to create a camera, using code like this:
camera_data = bpy.data.cameras.new(name="Camera")
my_camera = bpy.data.objects.new("Camera", camera_data)
bpy.context.scene.collection.objects.link(my_camera)
and then move it using the transform operations, as you would with any object. There are a lot of questions about how to use Python to move objects.
for each component in model do:
Let's assume you've placed your model's components in a specific collection. This becomes for each object in bpy.data.collections[MODEL_COLLECTION_NAME_HERE].objects
for each texture in textures do:
This becomes for texture in textures:
component.set_texture(texture)
This becomes object.material_slots[0] = bpy.data.materials[texture]
component.save_png()
This requires some setup. You'll need to specify render properties like which render engine, render resolution, et cetera. Again, you can find questions here discussing each of these.
After the setup comes the render: bpy.ops.render...
See the manual page for render for details.
Having rendered the model, you need to save the render file. Look for questions about saving images for specifics.