Okay I don't think this can be done with standard pygame since it's built on top of SLDSDL 1, and if SDL supports the GL core profile, it's not exposed in pygame from what i can tell.
However, there is a port of pygame to SDL 2 on github which is a drop in replacement which does expose the required attributes so you can specify a specific context.
So basically you will need the below changes, this got me a 3d triangle using 330 shaders on a linux laptop.
import pygame_sdl2
pygame_sdl2.init()
pygame_sdl2.display.gl_set_attribute(GL_ALPHA_SIZE, 8)
pygame_sdl2.display.gl_set_attribute(pygame_sdl2.GL_CONTEXT_MAJOR_VERSION, 3)
pygame_sdl2.display.gl_set_attribute(pygame_sdl2.GL_CONTEXT_MINOR_VERSION, 3)
pygame_sdl2.display.set_mode((self.viewport[2], self.viewport[3]), OPENGL|DOUBLEBUF)
Hope this helps.