mozilla / mozanalysis

A library for Mozilla experiments analysis
https://mozilla.github.io/mozanalysis/
Mozilla Public License 2.0
9 stars 13 forks source link

Update Python version under which tests are run #210

Closed dzeber closed 5 months ago

dzeber commented 5 months ago

Currently tests are run under Python 3.8. This sometimes causes issues as dependencies aren't pinned and no Python verison is specified in setup.py.

We should update the tests to default to a more recent Python version.

dzeber commented 5 months ago

@mikewilli @danielkberry @m-d-bowerman what are your thoughts? I don't have a good sense of what dependencies this may affect.

jaredsnyder commented 5 months ago

Does tox make it easy to test multiple versions? It'd be nice to specify which versions are supposed in the setup.py and then test all of them (at least at the minor version level) via tox

mikewilli commented 5 months ago

Yes we should definitely specify a python version. I'd suggest 3.10 as that's what Jetstream uses and mozanalysis seems to work ok in there. I also think 3.10 is the most common version I've seen on projects I've touched lately. 3.11 would be fine too, just would want to do extra testing.

And while I think tox can handle multiple versions pretty easily (just specify in the envlist in tox.ini), I think we may want to settle on a single version to simplify CI (which uses docker containers pinned to specific python versions).

dzeber commented 5 months ago

I was thinking 3.10 as well. I agree we should have a main supported version which is used in CI - we can always run tests locally for other Python versions by passing a version arg to tox.

jaredsnyder commented 5 months ago

Been taking a stab this morning and I think pytest-black might be broken by pytest version 8. There is a breaking change with hooks in pytest v8 and pytest-black hasn't been updated since 2020. Do we want to explore other options for enforcing black formatting? I could look for another library to replace pytest-black or we could use pre-commit?

jaredsnyder commented 5 months ago

Well it seems like there isn't a limit on the pytest version here, so maybe something is wrong on my end... https://docs.pytest.org/en/7.1.x/reference/plugin_list.html

jaredsnyder commented 5 months ago

Looks like it's an issue others have encountered :( https://github.com/jaraco/path/issues/219

jaredsnyder commented 5 months ago

In setup.py, python_requires set to allow 3.10 and 3.11

danielkberry commented 5 months ago

We should probably aim to 1) keep our analysis tools in sync and 2) limit the set of supported versions to reduce the testing load. I'd be ok with formally supporting 3.10 and 3.11 now.