  The positron excess measured by PAMELA and AMS can only be explained if there
is one or several sources injecting them. Moreover, at the highest energies, it
requires the presence of nearby ($\sim$hundreds of parsecs) and middle age
(maximum of $\sim$hundreds of kyr) sources. Pulsars, as factories of electrons
and positrons, are one of the proposed candidates to explain the origin of this
excess. To calculate the contribution of these sources to the electron and
positron flux at the Earth, we developed EDGE (Electron Diffusion and Gamma
rays to the Earth), a code to treat the propagation of electrons and compute
their diffusion from a central source with a flexible injection spectrum. Using
this code, we can derive the source's gamma-ray spectrum, spatial extension,
the all-electron density in space, the electron and positron flux reaching the
Earth and the positron fraction measured at the Earth. We present in this paper
the foundations of the code and study how different parameters affect the
gamma-ray spectrum of a source and the electron flux measured at the Earth. We
also studied the effect of several approximations usually performed in these
studies.
