In this work, a non-isospectral and variablecoefficient Kadomtsev–Petviashvili equation is considered using Hirota’s bilinear form and a direct assumption with arbitrary functions. Analytical rational solutions in light of positive quadratic functions and lump solutions of the variable-coefficient Kadomtsev–Petviashvili equation are obtained. These lump solutions describe two types of characters by some three dimensional graphs and contour plots, which contain bright lump wave and bright–dark lump wave. Mean while, periodic structure of the lump wave is also shown.