Roel Schroeven <r...@roelschroeven.net> writes: > dieter schreef op 7/02/2018 8:21: > ... >> Likely, there are many ways to execute tests for your package. > >> I am using "setuptools" for packaging (an extension >> of Python's standard "disutils"). Its "setup.py" supports the "test" >> command. This means, properly set up, I can run tests >> with "python setup.py test". > > That can solve the testing issue, I guess, even though it feels weird > to me that the most straightforward way doesn't work. > > But testing is not the only issue. Often I'd like to start the Python > interpreter to load one of the modules in the package to try some > things out, or write a little script to do the same. These things are > very natural to me when writing Python code, so it seems very strange > to me that there's no easy way when working on a packages.
I use a "virtualenv" for this: it is like a private Python environment with its own set of packages. The "setup" from "setuptools" not only supports a "test" command but also a "develop" command. This "links" the package (source) into Python's (the one you used to run "setup.py"; i.e. usually the one of a "virtualenv") library and thereby makes it available for this Python. -- https://mail.python.org/mailman/listinfo/python-list