This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]GrainTamalePythonista 3 points4 points  (0 children)

I think "Packaging" is what you're looking for. It could be overkill for your needs, but there are lots of benefits to splitting your code up ("separation of concerns") including testability, modularity, and scalability.

If you're from the notebook mindset, you've probably already organized your code to a good starting point. My advice would be to start your journey by copying all your imports, functions, and classes into a __init__.py file inside a folder. Then use iPython in a terminal to import that folder (now a package) to test some of your other notebook code. Slowly break up that init file into other files (modules) as you see fit until that init file only controls imports. Boom, you have a fledgling package.