I have just created my own package and would like to publish it on GitHub and PyPi.
I am currently checking the dependencies of the package using the tox library. My package, for example, uses the Pandas library
The package tests pass on Pandas 1.1.4 and Pandas 1.3.4. Is it correct to assume that the tests will also pass on every Pandas version between 1.1.4 and 1.3.4?
Same question with the Python version. If the package tests pass on Python 3.8.2 and Python 3.10.0, is it correct to assume that every Python version between these two is compatible with my code?
If the assumption is incorrect, is there a way to automate the process with the tox library?
Just in case, I will list other package dependencies:
- matplotlib
- beautifulsoup4
- requests
- numpy
CodePudding user response:
Unfortunately, you cannot assume your package will work for a Python or a e.g. Pandas version you do not test.
This means, if you really want to make sure your package works with all combinations, you need to test them.
tox
is a great tool for that.
You need to use factors
in tox
.
Especially the Django community use this feature a lot, e.g.:
https://github.com/jazzband/django-auditlog/blob/3dee9f1555239ae9c4a50afeaa487547247d2d96/tox.ini
And here is the link to the relevant part in the tox
documentation:
https://tox.wiki/en/latest/config.html?highlight=factors#factors-and-factor-conditional-settings
For testing this matrix on GitHub, I recommend to use this tox
plugin
https://github.com/ymyzk/tox-gh-actions
Disclaimer: I am one of the tox
maintainers.