How set the type of node editor window to "compositing"?
If you mouse over the property you will see it is the SpaceNodeEditor.tree_type property you want to set.  The screen is split into areas, these areas have regions, toolbar header etc, and spaces.  I've put a print statement in to show the spaces for the area.  To get the space associated with an area use area.spaces.active or context.space_data (after changing the context.area.type)

import bpy
from bpy import context

area = context.area

area.type = 'NODE_EDITOR'
# the context area is now a node editor
# the space has the tree_type enum

for sp in area.spaces:
    print(sp, sp.type, "has tree_treetype", hasattr(sp, "tree_type"))

space = context.space_data
# or better still
space = area.spaces.active
# set to compositing    
space.tree_type = 'CompositorNodeTree'


To find space.tree_type = 'CompositorNodeTree' run code above with space.tree_type = 'Blah' which gives the options in the error message.

TypeError: bpy_struct: item.attr = val: 
enum "Blah" not found in 
('ShaderNodeTree', 'CompositorNodeTree', 'TextureNodeTree')