We provide a diagrammatic formulation of perturbative quantum field theory in a finite interval of time τ, on a compact space manifold Ω. We explain how to compute the evolution operator U(tf, ti) between the initial time ti and the final time tf = ti + τ, study unitarity and renormalizability, and show how to include purely virtual particles, by rendering some physical particles (and all the ghosts, if present) purely virtual. The details about the restriction to finite τ and compact Ω are moved away from the internal sectors of the diagrams (apart from the discretization of the three-momenta), and coded into external sources. Unitarity is studied by means of the spectral optical identities, and the diagrammatic version of the identity U†(tf, ti)U(tf, ti) = 1. The dimensional regularization is extended to finite τ and compact Ω, and used to prove, under general assumptions, that renormalizability holds whenever it holds at τ = ∞, Ω = ℝ3. Purely virtual particles are introduced by removing the on-shell contributions of some physical particles, and the ghosts, from the core diagrams, and trivializing their initial and final conditions. The resulting evolution operator Uph(tf, ti) is unitary, but does not satisfy the more general identity Uph(t3, t2)Uph(t2, t1) = Uph(t3, t1). As a consequence, Uph(tf, ti) cannot be derived from a Hamiltonian in a standard way, in the presence of purely virtual particles.