In Chapter 6, Creating Reusable Modules, we looked at a number of things that make a module or package suitable for reuse:
It must function as a standalone unit
A package should ideally use relative imports
Any external dependencies in your module or package must be clearly noted
It should solve a general problem
Your code should follow standard coding conventions
Your module or package should be clearly documented
The first step in preparing your module or package for publication is to ensure that you've followed at least the first three of these, and, ideally, all six of these guidelines.
The second step is to make sure that you've written at least a few unit tests and your module or package passes all of these. Finally, you will need to decide how you want to publish your code.
If you want to share your code with friends or work colleagues or write a blog post...