Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Fix compatibility with tox>=4 #163

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ZenulAbidin
Copy link

@ZenulAbidin ZenulAbidin commented May 11, 2023

This commit introduces compatibility with Tox version 4 by making the following changes:

  • The deleted _split_envs function is surgically pasted from old Tox code to v4_workarounds.
  • The hooks are now defined using the @impl decorator and not @tox.hookimpl.
  • The addoption hook is renamed to add_option, while the configure hook is switched to tox_env_config (I wasn't 100% sure doing this, but it seems to make tox4 run successfully, so let me know if there is a more correct way to port it.)

If you need Tox4 support immediately and can't wait for this to get merged, put this in your requirements.txt:

tox-travis @ git+https://github.com/ZenulAbidin/tox-travis@b07180da9508e9a6de3fa516f6fcc95f4e85759f

I have not been able to test this live on Travis CI, because builds have been completely broken for me since recently and customer support is non-responsive.

Copy link
Collaborator

@ryanhiebert ryanhiebert left a comment

Choose a reason for hiding this comment

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

Makes sense to me, but I similarly cannot test it or debug it.

@ZenulAbidin
Copy link
Author

@ryanhiebert I can make a mock project using cookiecutter-pypackage, which features tox-travis integration, and then attempt to link it to a new Travis CI account and hopefully I'll be able to see if the changes work properly.

@ZenulAbidin
Copy link
Author

ZenulAbidin commented May 12, 2023

So I have some good news, after making a new travis account with a boilerplate cookiecutter project, which includes my build of tox-travis, the (Gitlab) project has successfully built on Travis CI, and tox tests completed successfully. Results are here: https://app.travis-ci.com/gitlab/ZenulAbidin/Ragnarok

Ideally let's get this merged before my Travis trial credit expires again :)

@ZenulAbidin
Copy link
Author

@ryanhiebert any update on this?

@tox.hookimpl
def tox_addoption(parser):
@impl
def tox_add_option(parser):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we know when this was added to tox? Do we need to restrict the lower bound?

Copy link
Member

Choose a reason for hiding this comment

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

Likely you should restrict to latest release, because that's also against what you're running the CI.

Copy link
Author

Choose a reason for hiding this comment

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

See my comment below - this is not compatible with tox<4.

@ZenulAbidin
Copy link
Author

ZenulAbidin commented May 15, 2023 via email

@ryanhiebert
Copy link
Collaborator

Are we talking about restricting the tox version at requirements.txt, or somewhere else?

In the setup.py is what I was referring to, which constrains people from using tox-travis with a lower version of tox, for example if the hooks we're starting to use here were only introduced in a later version of tox.

@ZenulAbidin
Copy link
Author

@ryanhiebert

The change appears to have kicked in starting from tox-dev/tox#1991 (Changed Files), which was packaged in version 4.0.0a7.

Looks like it really is tox>=4-only material.

Also there is this thing at the bottom of the Changelog page of Tox:

Warning

The current tox is the second iteration of implementation. From version 0.5 all the way to 3.X we numbered the first iteration. Version 4.0.0a1 is a complete rewrite of the package, and as such this release history starts from there. The old changelog is still available in the legacy branch documentation.

Perhaps we should make a branch of the existing codebase with a name like tox-v3 or something that is only for older tox versions.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants