What we did with Beaux is every time he bit, we popped him on the nose and put him down on the floor (if on our lap). It seems to have worked as he seldom, if ever, bites anymore. Our other cat, an older female, hisses at him if he gets too rowdy and bops him in the face. He IS learning acceptable behavior.
Your kitty just needs to learn boundaries. If he is being sweet and cuddly, and you are petting him, notice if his tail starts to twitch. If it does, it means he is getting irritated and you need to stop the petting and get your hands out of his reach. If he comes after them even when you stopped the petting, pop him lightly on the nose, say "NO" and put him down on the floor. It may take a few times for him to learn, but he has to learn what we like and don't like - it is NOT intuitive. Good luck!
One more thing...keep his claws clipped. Get him used to you doing this every month or so. It will help to limit injuries if he does catch you off guard. He's not being mean, just playing and learning right from wrong so hitting him, unlike how dogs may be trained, does NOT work on cats. It causes resentment and fear of you, neither of which makes a happy cat nor loving relationship.
Good advice, very reasonable.
When we trim Rocket’s claws he whimpers like we are cutting his toes off. Missy, the gray tabby ... well you need them leather gauntlets for her. I’ve bled many times trying to cut her toes off.