It does depend on the shaft size and amount of power to be transmitted. For a very small DC motor as used in model cars etc with a 2 mm dia or smaller shaft, in my opinion a high precision heavy press fit is the best most concentric way to mount a gear or pulley IF the gear or pulley is made of durable material ie steel, hard brass, bronze etc.
If the gear or pulley is zinc or aluminum die casting alloy the best method is Loctite cylindrical fit locating compound. Press fit is not recommended for zinc or aluminum alloys because these materials will creep away from a high stress press fit and loosen over time.
Loctite cylindrical fit locating compound will also work for steel brass or bronze gears and pulleys but in my opinion press fit is better because it requires no part to shaft clearance so concentricity control is better.
For plastic gears a press fit onto a splined shaft is not bad if power is low, but slots in the plastic hub engaging with a pin in a cross drilled hole is far better if the shaft is large enough to drill. If designing such a joint from scratch, I have had good luck with hexagonal shaft press fitted into a hexagonal hub on the plastic gear or pulley, but care must be taken with corner radii, and to design a very strong hub. Loctite is NOT recommended for use with plastic gears or pulleys.
If you use key and keyway or grub screws on small shafts it is just about guaranteed your gear or pulley will not run concentric to the shaft, at least that has been my experience.
JD