This invention discloses 5-phenyl-1H-pyridin-2-one and 6-phenyl-2H-pyridazin-3-one derivatives according to generic FormulaeI-IV:wherein variables R, X, Y1, Y2, Y2', Y3, Y4, n and m are defined as described herein, which inhibit Btk. The compounds disclosed herein are useful to modulate the activity of Btk and treat diseases associated with excessive Btk activity. The compounds are further useful to treat inflammatory and auto immune diseases associated with aberrant B-cell proliferation such as rheumatoid arthritis. Also disclosed are compositions comprising compounds of FormulaeI-IVand at least one carrier, diluent or excipient.本發明揭示通式I-IV之5-苯基-1H-吡啶-2-酮及6-苯基-2H-嗒-3-酮衍生物:其中變數R、X、Y1、Y2、Y2'、Y3、Y4、n及m係如本文所述定義,其抑制Btk。本文揭示之化合物可用於調節Btk活性及治療與過度Btk活性有關之疾病。該等化合物進一步可用於治療與異常B細胞增殖有關之炎症及自身免疫疾病,例如類風濕性關節炎。本發明亦揭示包含式I-IV之化合物及至少一種載劑、稀釋劑或賦形劑的組合物。