Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Releasing a python package - should you include doc and tests?

So, I've released a small library on pypi, more as an exercise (to "see how it's done") than anything else.

I've uploaded the documentation on readthedocs, and I have a test suite in my git repo.

Since I figure anyone who might be interested in running the test will probably just clone the repo, and the doc is already available online, I decided not to include the doc and test directories in the released package, and I was just wondering if that was the "right" thing to do.

I know answers to this question will be rather subjective, but I felt it was a good place to ask in order to get a sense of what the community considers to be the best practice.

like image 443
astrognocci Avatar asked Jul 15 '13 23:07

astrognocci


1 Answers

It is not required but recommended to include documentation as well as unit tests into the package.

Regarding documentation:

Old-fashioned or better to say old-school source releases of open source software contain documentation, this is a (de facto?) standard (have a look at GNU software, for example). Documentation is part of the code and should be part of the release, simply because once you download the source release you are independent. Ever been in the situation where you've been on a train somewhere, where you needed to have a quick look into the documentation of module X but didn't have internet access? And then you relievedly realized that the docs are already there, locally.

Another important point in this regard is that the documentation that you bundle together with the code for sure applies to the code version. Code and docs are in sync.

One more thing especially regarding Python: you can write your docs using Sphinx and then build beautiful HTML output based on the documentation source in the process of installing the package. I have seen various Python packages doing exactly this.

Regarding tests:

Imagine the tests are bundled in the source release and are easy to be run by the user (you should document how to do this). Then, if the user observes a problem with your code which is not so easy to track down, he can simply run the unit tests in his environment and see if at least those are passing. If not, you've probably made a wrong assumption when specifying the behavior of your code, which is good to know about. What I want to say is: it can be very good for you as a developer if you make it very simple for the user to execute unit tests.

like image 137
Dr. Jan-Philip Gehrcke Avatar answered Oct 31 '22 01:10

Dr. Jan-Philip Gehrcke