8 Weeks minimum really. I would advise searching for a reputable breeder of the breed you are interested in in your area, and ideally meet at least one, if not both parents to get an idea of their temperament and physical condition. Probably not gumtree TBH.
There are a lot of puppy farms or people breeding for the money, where the animals are not well looked after etc. A good breeder should have had them vet checked, and used good quality flea and worming products as a minimum. Ideally they will have started getting them used to a lead and collar and started socialising them too. If they haven’t done this then I would not consider getting a dog from them.
Alternatively there’s always the option of a rescue dog, although that might not be the best option for everyone. We have had a rescue and an 11 week old puppy from Preloved. Not great (but not terrible either) experiences with either so we would go with the responsible breeder option should we get another one.