When writing programs, simply import the package (or components that are needed from it). When developing a library, I start out by creating a proper package including __init__.py
, __all__
and a /tests
directory. The library code is run from the latter and as soon as something works properly I convert the code to a pytest compatible test fixture. When done, there is no more code, only tests that can be run by typing pytest
. I usually ship the tests along with the package so that if something doesn't work on a different platform people can send me test output.