Cool, dry environment. No extreme temperatures or humidity. Original black powder is still fully potent after 300 years. Some of the substitutes that are made with sugar (sucrose based) deteriorate after opening.
I had a revolver with Pyrodex loaded for over 3 years. Five went bang one squib.
The real question is citrus based subs. T-7 I would not trust over 3 or 4 years.
Also you should re-cap if in very humid areas. Many old gunslingers re-capped
(re-coned) every morning. If kept loaded I would re-cap every six months in
normal humidity. Caps vary. Test your caps for stability and load accordingly.