How many pets can I have?

What is the maximum amount of pets a character can have, with mechanical rules. I am defining a pet as

An animal, or other creature, that can be permanently around and has mechanical implications.

I have a few ideas, beastmaster ranger, find familiar, urchin background…

All official books and UA allowed.

I’d prefer the most powerful version of the pet, so for example, a third level warlock, with pact of the chain, is better than a level 1 wizard for just find familiar.

Only one pet per spell/ ability – so creating 10 undead with a spell is only one pet, and casting animate dead twice is still only one pet.