Guiding a mentee towards greater independence
Disclaimer: I am a current PhD student and speak from personal experience as one who has guided both masters as well as undergraduate students.

Learning how to code appropriately takes skill, time and confidence (among other things). My strategy for this while mentoring students is as follows:


Develop a small project which will have some significant coding component in it but will still add to the overall project. Lay out the coding expectations and deliverables very clearly. Don't start with something too difficult.
Consider using version control tools (such as git) to manage your mentee's code. Be very clear about what languages/libraries etc. you plan to use and how this code will add to the project.
Lay out a timeline with your mentee with very specific coding expectations.
Achieve each small component with your mentee. Guide (but don't spoonfeed/handhold) your mentee. Make sure that he/she codes everything by him/herself.
Give him/her a small reward. (coffee/sugary thingy/beer) This always makes my students very happy. :)


In my experience, once a mentee has achieved a small project by him/herself, they are usually quick and eager to move onto the next objective. I use this to ramp up the difficulty level slowly but surely.

Regarding the second part of your question, I would definitely keep your supervisor/adviser in the loop regarding this. He/She may have much better suggestions than any that I have to offer here.