flit
flit copied to clipboard
flit-core is installed alongside with tests
Hello,
When tackling the update of flit in Fedora I came across a difference in installation of flit and flit-core - the latter is installed with tests/. I wonder if this is by design, as usually packages tend not to bring tests (as in this case, flit).
Would you consider a change in installation process for flit-core?
I'm interested you say packages tend not to do this, because I thought that a lot of packages do - e.g. numpy, matplotlib, Jupyter packages all include their tests in the package that gets installed. Maybe it's more common in the scientific Python world than beyond that.
There's no particular reason flit & flit-core differ; I go back & forth on which way I prefer, and flit has caught both sides of that.
I checked ~10 most popular packages from PyPI stats where none of them gets installed with tests. Those you mention, however are. As from packager point of view, the tests are an important part of build, but kinda lose their importance in the resulting package - the package size is reduced without them and it's not that likely final users would want to test the library. There is no problem in handling this downstream, it's just always more sustainable to get the "ideal" state from the upstream developers, hence my question.
I've seen some packages where the tests were just wired badly, and didn't run at all except as part of the installed wheel. But yeah, generally the point of tests is to run them as part of the process of making final distribution artifacts. Sadly there's no way for pip to automatically do this for you, but meta-package managers generally do.
Anyway... looks like the wheel file would drop from 48K to 24K if the tests are removed (324K to 92K for the extracted directory), so halving the network usage seems useful.
At any rate, this doesn't exactly provide a test entry point, so users wanting to test this would probably have to do something like:
$ python
>>> import flit_core.tests, os.path, pytest
>>> pytest.main([os.path.dirname(flit_core.tests.__file__)])
Which seems a bit convoluted and, unlike https://github.com/takluyver/flit/blob/b944ecceabe6c01f45d80c3c4c9160f97829e4c3/tox.ini#L14-L34 from the root of the git repo or sdist, is very much not documented.