TheLartians / PyPropagate

A paraxial wave propagation framework for python
GNU General Public License v3.0
5 stars 7 forks source link

Improve imports and documentation #46

Open godot11 opened 3 years ago

godot11 commented 3 years ago

I'm using this library to cross-check some of my results, and in the process of understanding it I could make some basic non-feature improvements, like tidying imports and adding some documentation to functions. Does this repo accept such contributions?

Right now a high number of imports are done inside functions, which is usually regarded as unpythonic and breaks editor hints. If there's no reason that makes module-level imports unpractical, I would make these module-level. Also, I would change absolute imports from pypropagate to relative ones where possible, as the former - again - breaks editor hints (at least in VS Code), and in presets/_init.py the (non-)relative import import time collides with the built-in time module. This caused some trouble with my system.

TheLartians commented 3 years ago

Hey @godot11, thanks for using the library! I agree that the code could use some tidying up and I'd be more than happy to accept contributions in that direction! Changing absolute imports to relative sounds like a good idea. About the function level imports, I also agree that module level would be cleaner. I believe my intent at the time was to lower the number of non-optional dependencies, though imo probably isn't a real issue nowadays anyways. So go ahead. :)

TheLartians commented 3 years ago

Also, feel free to ask anytime if something isn't clear!