Search code examples
pythonpypytox

How do I specify tox + python version specific requirements


Currently I have the following:

[gh-actions]
python =
    3.7: py37
    3.8: py38
    3.9: py39
    3.10: py310
    pypy-3.7: pypy3
    pypy-3.8: pypy3

[tox]
minversion = 1.9
envlist =
    lint
    py{37,38,39,py3}-django22-{sqlite,postgres}
    py{37,38,39,310,py3}-django32-{sqlite,postgres}
    py{38,39,310,py3}-django40-{sqlite,postgres}
    py310-djangomain-{sqlite,postgres}
    docs
    examples
    linkcheck

toxworkdir = {env:TOX_WORKDIR:.tox}

[testenv]
deps =
    Pillow
    SQLAlchemy
    mongoengine
    django22: Django>=2.2,<2.3
    django32: Django>=3.2,<3.3
    django40: Django>=4.0,<4.1
    djangomain: https://github.com/django/django/archive/main.tar.gz
    py{37,38,39,310}-django{22,32,40,main}-postgres: psycopg2-binary
    py{py3}-django{22,32,40,main}-postgres: psycopg2cffi

I need to install a different psycopg2 depending on cpython vs pypy. I've tried all kinds of combinations, and nothing, it all ends in failure. I can't get any of the *-postgres envs to install.

What I'm doing wrong?


Solution

  • The issue was never tox or tox's configuration.

    The issue was github actions, when you use tox-environment or python-version + tox-environment, tox-gh-actions won't parse it correctly. Causing it to never match.

    This is what I removed. This is what tox.ini looks like and what github actions looks like [and line 47]