We present Diffractio, an open-source Python package for the analysis of diffraction and interference phenomena in Optics, both within the scalar and vector optics approach. It is based on three main modules: Sources (for generation of light sources), Masks (for generation of optical elements, amplitude and phase masks, diffractive optical elements, and polarizers for vector optics) and Fields (for propagation, data analysis, storage, visualization, and video rendering). Within the scalar wave optics approach, Diffractio implements several algorithms for plane-to-plane propagation, such as the Fast Fourier Transform (FFT), Rayleigh-Sommerfeld propagation (RS), and Chirped Z-Transform (CZT). Additionally, Diffractio contains algorithms for step-by-step propagation, including Beam Propagation Method (BPM) and Wave Propagation Method (WPM). Our package further extends its capabilities to vector wave propagation using the Vector Fast Fourier Transform (VFFT), Vector Rayleigh-Sommerfeld (VRS), and Vector Chirped Z-Transform (VCZT) algorithms. All these algorithms are adaptable to various dimensions for faster computations: X, XY, XZ, and XYZ. In addition, the graphical representation functions included in Diffractio help to better analyze the fields and the associated variables, such as field and intensity distributions. Besides, when a deeper polarization analysis is necessary, Diffractio works seamless with our Py-Pol open-source package. This comprehensive suite of functionalities within the Diffractio library, positions it as a valuable tool for scientists, teachers, and engineers engaged in the study and application of Optics, offering well-established solutions for scalar and vector wave optics analysis down to the mesoscale. The software is available from the Python Package Index (PyPI) and Github repositories, at https://pypi.org/project/diffractio/ and https://github.com/optbrea/diffractio, respectively. Additionally, an online documentation resource is available at https://diffractio.readthedocs.io/en/latest/. This documentation illustrates the operation of the library and its practical application in physical optics with numerous examples. Users can take advantage of these instructional materials to gain a profound understanding of the software's functionalities and implement it in their optical analyses.