Place the diced sweet potatoes in a steamer pot with 2-3 inches of water and steam for about 15-20 minutes or until completely soft.
In the meantime, make the pesto. In a food processor, add the almonds and pulse a few times to coarsely chop. Add the basil, lemon zest and juice. While processing, start pouring in olive oil to make a smooth, loose paste. If pesto is still a little thick, you can add a little water or more oil to loosen.
Put a large pot of water on the stove to heat. When the sweet potatoes are cooked, drain and allow to steam dry for a few minutes in a large bowl. Mash with a potato masher or ricer.
Fold in ricotta, egg yolk and salt. Add in 3/4 of the flour and stir in. Add more flour, a couple of tablespoons at a time until you have a soft but stiff dough. Leave mixture to rest for 5 minutes.
On a well-floured work surface, working with a cup of the mixture, roll out dough to thumb-sized, fat logs. Add more flour when rolling, as needed, to prevent sticking. Leave for a couple of minutes to firm up before cutting.
Cut rolls into 1 inch long pieces with a knife. Set aside on a sheet pan as you roll and cut the remaining dough.
Cook gnocchi in boiling, salted water for 2-3 minutes or until gnocchi start to float to the surface. Remove with a strainer and place into a large bowl. Toss with as much or as little of the pesto as you like. Garnish with grated parmesan, if desired, and serve immediately.