If I get half an hour to prepare, I'd build a barricade and block the area in front of it with caltrops and chains that are stretched from house to house, over the street. The barricade and the upper floors of the surrounding houses will be manned by crossbowmen. The doors of said houses are boarded up and the stairs are blocked with furniture (the men in the houses can retreat through a series of wall breakthroughs - the last one is so low that they have to crawl, this way enemies following them present their heads and necks to a guard with an axe).