I suggest that you read this introduction to pymc3 distributions. It introduces the two alternatives that you have: define a class that inherits from Distribution and write down both the logp and random methods, or wrap a single logp definition with a DensityDist.