-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added functionality to test multiple versions of python using tox #994
Added functionality to test multiple versions of python using tox #994
Conversation
Codecov ReportBase: 93.42% // Head: 93.42% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## main #994 +/- ##
=======================================
Coverage 93.42% 93.42%
=======================================
Files 20 20
Lines 1886 1886
Branches 371 371
=======================================
Hits 1762 1762
Misses 85 85
Partials 39 39
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
The main changes are in |
e381ced
to
42b5dd3
Compare
@nils-braun is there still a need for this PR or should it be closed? Happy to pick it up again and get it over the line (if needed) |
If so, will clean up the commits too... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙀 I am so sorry @Scott-Simmons - your PR just slipped through and I never ever had a look into it. Really sorry, this is not a good experience for you. Thanks for taking the time. Please do ping me earlier next time :)
I like the changes. If you update to the newest version of main
, the pre-commit changes should also not be need anymore. After that, I think the changes are already ready to be merged. Do you think it makes sense to also add parts of your PR description into the how_to_contribute.rst
document?
setup.cfg
Outdated
python -m pip install -r requirements.txt | ||
python -m pip install -r test-requirements.txt | ||
python -m pip install -r optional-requirements.txt | ||
python -m pip install -r rdocs-requirements.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to install the docs requirements for the tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed f848737
eee6081
to
1e9f9d1
Compare
Adds tox support for testing against multiple versions of python
1e9f9d1
to
f848737
Compare
No apologies needed, all good with me. Only recently remembered this.
If I understand you correctly, I've added something to that effect here
Looks like the builds are failing for unrelated reason w.r.t this PR. Can look at updating the actions file in a new PR. |
Add example of how to raise a PR.
a590777
to
b7de7d0
Compare
@nils-braun marking as ready for review despite the above |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure this PR is needed anymore since we have https://github.com/blue-yonder/tsfresh/blob/1297c8ca5bd6f8f23b4de50e3f052fb4ec1307f8/.github/workflows/test.yml#
Yes, definitely your PR ist still needed. The file you point to is for CI/CD, but it does not help the average developer. We have this matrix since the start of the library, but we never had it usable for developers. So your change is still needed! |
Ah sorry, what you did is also great, but I actually meant adding the description on how to run the tox tests into the document (basically the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now @Scott-Simmons!
You can or can not add the description on the tox -r
command - I leave it up to you. I will merge the PR tomorrow :)
Thanks again for the contribution!
Adds a comment about how to run tests locally on multiple versions of python. Ensures it is clear that it only works if particular version of python is installed on the users machine. Recommends `pytest` as a possible way to manage multiple local versions of python. Note the hyperlink out to `setup.cfg` is pinned to commit sha 1297c8c instead of pinning to main branch.
Added in 1e9c3bc
Was thinking about this, maybe we could have a docker container for local testing as well? To get around the developer needing to have python versions 3.7, ...3.12 on their development machine. Something like:
TEST_DOCKERFILE := Dockerfile-test
TEST_CONTAINER := test-tsfresh
test-all:
docker build -f $(TEST_DOCKERFILE) -t $(TEST_CONTAINER) .
docker run --rm $(TEST_CONTAINER)
FROM python:3.10-slim # could be something else too...
# Haven't tested this probably more dependencies required...
RUN apt-get update && \
apt-get install -y python3.7 python3.8 python3.9 python3.10 python3.11 python3.12
RUN pip install tox
# Just an idea may not need to copy whole thing in....
WORKDIR /app
COPY . .
CMD ["tox -r"] @nils-braun if this is something that looks useful I can take this on - I don't think it will be too much work but could be useful for developer experience? |
What functionality changed?
This PR adds functionality to be able to locally test multiple versions of python using
tox.
This PR will run the test suite for python versions 3.7, 3.8, 3.9, 3.10, and 3.11 for whichever platform the user runs the tests on. The specific microversion of python depends on what is installed on the user's machine.
tox
will skip over running the test suite for a given version if it cannot find a particular python environment.How to run?
To test on multiple python versions, edit
envlist
insetup.cfg
to include the python versions you want to test on, and then run:in the top-level directory for tsfresh. Currently the versions being tested span between python 3.7-3.11
Why?
This PR will make it much easier to (locally) test tsfresh against multiple versions of python, for a given platform
What code changed?
setup.cfg
was changed to include some extra configuration information.tox
was added to test-requirements.txtTips for reviewing/running
By default,
tox
will look in binary directories for any relevant python interpreters. For example, ifexists in
setup.cfg
, thentox
will look inside binary directories for python executables named similar to python3.7.X and python 3.8.X. If it cannot find any executables for a given python version, then it will skip over testing that version.Note that in this PR:
But it should also be noted that while included in the envlist, py311 is currently not compatible with tsfresh due to a numba dependency conflict.
Using
pyenv
in tandem withtox
A recommended way to handle multiple versions of python is with
pyenv
.pyenv
will allow you to install multiple versions of python in a well-organised fashion.If you choose to use
pyenv
to manage the different python versions installed on your machine, then the executables of each python version will be in~/.pyenv/shims/
which will not be found bytox
by default. A recommended solution to this is to make a.python-version
file, with the versions of python that you wanttox
to look for.For example, if the output of running
shows that you have installed python 3.7.16 and python 3.8.16, then you should put
3.7.16
and3.8.16
as separate lines in the.python-version
file. Runningtox -r
will then run the tests for python3.7.16 and python3.8.16, andtox
will know where to find the relevant python interpreters.pyenv
important noteThe python version that the
tox
command is initially invoked from matters!Running
pyenv which python
will show the version of python from which thetox
command will be invoked from. Iftox
is initially invoked from a version of python that is not supported by the package (i.e. package is invoked from python 3.6 andpython_requires
is >=3.7), thentox
will fail for all environments, including python versions that would otherwise work iftox
was originally invoked from a version of python supported with the package.Note that we can still test tsfresh on unsupported versions of python (such as 3.6), provided that
tox
is initially invoked from a version of python that is in tsfreshpython_requires
(such as 3.8).Log files
Log files are stored in the
.tox
directory which is created oncetox
is run.