"Communist" is a proper noun when it refers to an organized group, the whole or part. When "communist" refers to a general philosophy, it is not a proper noun.
This will probably be a useful guide:Writing Explained
Example:
Erik was a Communist only in name. At heart he was a democratic socialist, but the Communist Party was the only political organization allowed.
And
Reg was a pariah in the Labour Party due to his communist opinions.
If dealing with political identities other than "communist", the same principles apply. The only major concern is the need to capitalize any identity derived from a proper noun.
He is not a communist, he is a Peronista.