Heat the oven to 200C (180C fan)/390F/gas 6. Cut the pumpkin into halves or quarters, depending on its size, and scoop out the seeds and stringy bits.
To roast the seeds at a later date, clean them first, then boil for five minutes, drain and dry. Toss with a little oil, and bake, spread out on a tray, in a 180C (160C fan)/350F/gas 4 oven for about 10 minutes.
Arrange the pumpkin skin side up in a roasting tin just big enough to fit it all in one layer, then scatter over two tablespoons of cold water.
Bake for about 30 minutes, until the flesh is tender all the way through, then remove and set aside to cool slightly. Turn off the oven unless you’re using ready-made pastry.
Once the pumpkin is a comfortable temperature to handle, peel off and discard the skin and scoop the flesh into the bowl of a food processor.
Whizz until you have a smooth puree, then transfer to a fine sieve set over a bowl or the sink. Leave to drain while you make the pastry (or for about half an hour if you’re not).
Sift the flour into a bowl, stir in the salt, then grate in the butter. Rub in with your fingertips, until the mix looks like coarse sand, then stir through the sugar.
Mix the egg yolk with two tablespoons of iced water, and sprinkle half of this over the dough mixture. Stir until it comes together into a firm but not damp ball – add a little more of the egg yolk mix, if need be.
Grease a 20cm tart tin. Roll out the pastry on a lightly floured surface to about 3mm thick, and use to line the tin. Prick all over with a fork, and chill for 30 minutes.
Heat the oven to 180C (160C fan)/350F/gas 4, then line the case with greaseproof paper and baking beans or rice.Bake the pastry case for 15 minutes, then remove the hot paper and beans, and bake for another five to 10 minutes, until the base is pale golden.
While the crust is baking, put 250g of the pumpkin puree into a bowl with a pinch of salt, and discard the liquid that has drained from it.
Stir the maple syrup, rum (if using; most dark spirits or liqueurs will work here, incidentally) and spices into the pumpkin puree. Taste for sweetness, adding a little more syrup or spice if you think it necessary, then beat in the eggs.
Pour the filling into the blind-baked pastry case, and bake for about 40 minutes, checking on it from half an hour onwards, until the filling is set, but still slightly wobbly in the centre.
Leave to cool in the tin for at least an hour before serving, so the filling has time to set.