I want to do switching overvoltage simulation in power system. What are the recommended practices to do the job? Can we do it without any commercial software (e.g build own algorithm in Python)? Thank you in advance.
Without circuit simulators it is possible to solve only very simple circuits, containing only several reactive elements. That is, to solve only second or third order differential equations. But it also take time. Accurate computation of switching or lightning overvoltage can not be performed on simple circuits. Try commercial but demonstration or evaluation versions of software. I, for example use Micro-Cap Evaluation/Student Version. Try it or EMTP-RV Demo. Or something else. Don't waste your time.
If the circuit size is small, there is no need to use a special software for simulating the electromagnetic transients. It will be easy to build and simulate the model using the matlab. You may in this case use the PSCAD, ETAP, or EMPT, or ATP for verification purposes. These softwares are also suitable for large scale problems.
You can of course build your own code but then you need to do model validation. You should decide if it is worth the effort, based on your problem and future needs. Might be easier to use well established tools.
Agree with above comments that using free edition of commercial software for a small switching study. It seems the Matlab Simlink is capable to doing this kind of transient studies http://www.iitk.ac.in/npsc/Papers/NPSC2002/48.pdf, but you probably need to more works on modeling.
I use Matlab Simulink and PSCAD to simulate switching transition.
Independently on software you will use remember that you may face with solution's computational instability that is one of the features of simulation this kind of modes.