Skip to content
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

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

Scott-Simmons
Copy link

@Scott-Simmons Scott-Simmons commented Dec 24, 2022

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 in setup.cfg to include the python versions you want to test on, and then run:

tox -r

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.txt

Tips for reviewing/running

By default, tox will look in binary directories for any relevant python interpreters. For example, if

envlist = (py37, py38)

exists in setup.cfg, then tox 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:

envlist = py37, py38, py39, py310, py311

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 with tox

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 by tox by default. A recommended solution to this is to make a .python-version file, with the versions of python that you want tox to look for.

For example, if the output of running

pyenv versions

shows that you have installed python 3.7.16 and python 3.8.16, then you should put 3.7.16 and 3.8.16 as separate lines in the .python-version file. Running tox -r will then run the tests for python3.7.16 and python3.8.16, and tox will know where to find the relevant python interpreters.

pyenv important note

The python version that the tox command is initially invoked from matters!

Running pyenv which python will show the version of python from which the tox command will be invoked from. If tox is initially invoked from a version of python that is not supported by the package (i.e. package is invoked from python 3.6 and python_requires is >=3.7), then tox will fail for all environments, including python versions that would otherwise work if tox 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 tsfresh python_requires (such as 3.8).

Log files

Log files are stored in the .tox directory which is created once tox is run.

@codecov-commenter
Copy link

codecov-commenter commented Dec 24, 2022

Codecov Report

Base: 93.42% // Head: 93.42% // No change to project coverage 👍

Coverage data is based on head (42b5dd3) compared to base (6714034).
Patch coverage: 100.00% of modified lines in pull request are covered.

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           
Impacted Files Coverage Δ
tsfresh/feature_extraction/feature_calculators.py 92.46% <100.00%> (ø)
tsfresh/transformers/feature_selector.py 98.14% <100.00%> (ø)

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.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Scott-Simmons
Copy link
Author

The main changes are in setup.cfg and .gitignore. The changes to the other files are style changes in order to pass the pre-commit hook.

@Scott-Simmons Scott-Simmons marked this pull request as draft December 26, 2022 01:45
@Scott-Simmons Scott-Simmons marked this pull request as ready for review December 26, 2022 04:41
@@ -23,7 +23,7 @@ classifier =
Topic :: Software Development

[options]
python_requires = >= 3.7
python_requires = >= 3.7, <3.11
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<3.11 due to a numba dependency requirement

@nils-braun nils-braun force-pushed the feature/software-testing-for-multiple-python-versions branch from e381ced to 42b5dd3 Compare February 21, 2023 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants