Steampunk looking lamp :)
Made with a mix of PLA and iron tubes :)
Made with a mix of PLA and iron tubes :)

PLA is not a safe or code compliant material for an electrical enclosure. If you have a metal elncosure inside the decorative PLA cover that would be safe and code compliant in most places in the US.

If you wrap the wiring in heatshrink insulation, will that be OK, or does the PLA in close proximity to mains cables tend to melt/ignite/otherwise fail catastrophically?

The idea is that if there is an electrical fire it will spread out via the holes in the wall. Fire resistant enclosures are meant to give you time by containing the fire in the wall longer. PLA will not only melt immediately but it will also catch fire and fall to the ground. This will reduce the time you have to safely exit your home. Due to the prevalence of plastics in modern homes you’ve already got very little time even in a code compliant home.
well then i am happy to not live in the worst country in the world, but thanks for the tip :)
If you get some PETG V0 or ABS V0, that will be perfectly safe and probably up to code. That shit can self extinguish when it catches on fire.
Code is written in blood. PLA is such a terrible idea for an electrical box. No grounding, melt in a heart beat, and then you’re just another statistic as your house burns down around you (in a best case scenario)
ok since everyone is so concerned: please tell me and educate me on how a lamp would catch on fire? (just based on the 3 images you see in this post without knowing what country i live in, how wiring of the lamp is done and what safety-precausions are in place electricity wise)
Listen man, you do what you want. I’ve done some sketchy stuff myself.
Most people don’t care that it’s illegal, heck most people on here are pirates anyway.
People care about you, and they want you to understand the danger of what you’re doing.
Most of them aren’t judging you, I’m certainly not.
Will using PLA for a light enclosure definitely cause a fire? Probably not. The odds are very low. In fact the odds are very low that normal wiring in a normal enclosure will overheat. You’ll likely never see it.
The problem is the what if. The chance. IF the wiring shorts out, overheats, whatever. A normal enclosure might contain it completely. Or at worst it will resist catching on fire, and fill your house with smoke first, giving you time to realize what’s happening and save your life.
PLA will do neither of those things. It will in fact do the opposite. So in the admittedly rare chance that your wiring falls, and gets hot, PLA will actually readily ignite. And then, worse, it WILL drip flaming plastic onto the floor, causing it to spread immediately and without warning.
Your time to notice a fire and save yourself goes from minutes to seconds. It’s potentially the difference from waking up to a smoke alarm and a smokey house, to waking up to a smoke alarm and a wall of fire blocking your only exit.
I’m not trying to be extreme, it’s just the facts. That’s why people say codes are written in blood. The wrong plastics have been used before, and people have died, so now in many lands it’s a law.
No one is making you follow the law. They just want you to be informed, so that if you choose to continue, you do so without ignorance to the risks.
I wish you well.
Edit:
Now, if you changed the configuration of the lamp, if you put all the AC wiring and DC conversion circuits in a metal enclosure, and then ran low voltage wiring to low voltage bulbs, that would be still unwise, but significantly safer.
The concern is that AC circuits, while only using enough power to run a lamp in this scenario, have access to more than enough power to run a space heater. If your AC wiring becomes a space heater in your ceiling, nothing will stop it, and PLA will make it worse 🤷♂️

Fire will kill you no matter what country you live in. And it will kill you a lot faster if the only thing between it and you is PLA.
It’s not even like a non-American company has gone out of their way to make a fire resistant materials, for electrical boxes.
A lot of the hardware fixtures in my mom’s house are actually made from pieces of plumbing like that. Her towel bars, toilet paper holders and such were all put together by her in the plumbing section of a couple different hardware stores in town.
She likes that rustic/industrial look.
She was probably steam punk before steam punk was cool.