This commit refactors the Partitioner class and turns it into a proper factory class and also includes type hints to facilitate it's use from an API POV. Related to #1498