Abstract: magpylib is a Python package for calculating magnetic fields of magnets, currents and moments (sources). It provides convenient methods to generate, geometrically manipulate, group and visualize assemblies of sources. The magnetic fields are determined from underlying (semi-analytical) solutions with fast computation times (sub-millisecond) requiring little computation power. The package is free to use (open source) and was specifically designed for magnetic system design. It gives quick and easy access to magnetic field calculations in Python (and by extension in Matlab) and can be used for quick layout optimization and estimation before heavy numerical solvers are put to work.