pypsa-earth
pypsa-earth copied to clipboard
Move from os to pathlib
From Discord: "os.path vs pathlib": https://builtin.com/software-engineering-perspectives/python-pathlib The os module represents paths as strings with which you cannot do much. The pathlib module represents paths as special objects with useful methods and attributes.
Max: Let's use Pathlib by default. Tracking this here as a feature request so someone can work on the transition in future. I think it is a nice exercise for new contributors to get familiar with the code & the git workflow
Hi all, I picked up this issue as a good first issue to get familiar with the code :)
A few important notes:
- pathlib.Path.walk is available starting from the Python version 3.12. Hence for the moment I am keeping the equivalent command from the os package (i.e. os.walk)
- pathlib does not provide an equivalent command to os.chdir. Hence I kept the latter
Hey @finozzifa! Perfect, thanks a lot for taking this :)
@pz-max if you have any insights on that, feel free to share :D