  The pseudo-$C_\ell$ is an algorithm for estimating the angular power and
cross-power spectra that is very fast and, in realistic cases, also nearly
optimal. The algorithm can be extended to deal with contaminant deprojection
and $E/B$ purification, and can therefore be applied in a wide variety of
scenarios of interest for current and future cosmological observations. This
paper presents NaMaster, a public, validated, accurate and easy-to-use software
package that, for the first time, provides a unified framework to compute
angular cross-power spectra of any pair of spin-0 or spin-2 fields,
contaminated by an arbitrary number of linear systematics and requiring $B$- or
$E$-mode purification, both on the sphere or in the flat-sky approximation. We
describe the mathematical background of the estimator, including all the
features above, and its software implementation in NaMaster. We construct a
validation suite that aims to resemble the types of observations that
next-generation large-scale structure and ground-based CMB experiments will
face, and use it to show that the code is able to recover the input power
spectra in the most complex scenarios with no detectable bias. NaMaster can be
found at https://github.com/LSSTDESC/NaMaster, and is provided with
comprehensive documentation and a number of code examples.
