Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Migrate to tox-dev and v4 support #34

Closed
gaborbernat opened this issue Aug 29, 2021 · 8 comments
Closed

Migrate to tox-dev and v4 support #34

gaborbernat opened this issue Aug 29, 2021 · 8 comments

Comments

@gaborbernat
Copy link

Python Version

No response

Package Version

No response

Description

Hello, would you consider moving the project under the tox-dev umbrella? See documentation under https://tox.readthedocs.io/en/rewrite/plugins.html#adoption-of-a-plugin-under-tox-dev-github-organization

Furthermore, tox v4 is getting ready and we'd like to make sure this plugin is supported from day 1, we're collecting feature gaps for this under tox-dev/tox#1974. Would be great if you could join our development chat under https://discord.gg/tox so we can assist with this. If you do so please drop in a line in the #plugin chat with the name of the repository you maintain. Thanks!

@adamchainz
Copy link
Owner

Yes I'd be happy to move under the tox-dev organization.

This plugin is very small, so a good test bed. (I find it a bit surprising the functionality isn't even built-in.)

I've added testing of the plugin against tox 4 in #35 and it works perfectly. I also checked with a mini project locally and that worked fine.

mini project

tox.ini

[tox]
skipsdist = True
envlist =
    py{36,39}-{a,b}

[testenv]
commands = python -c "print('hi')"

shell

$ tox --py current
...
  py39-a: commands succeeded
  py39-b: commands succeeded
  congratulations :)

$ tox --py 36
...
  py36-a: commands succeeded
  py36-b: commands succeeded
  congratulations :)

$ tox --py 38  # matches no envs
...
  congratulations :)

@gaborbernat
Copy link
Author

gaborbernat commented Aug 30, 2021

Currently, tox_configure is not called at all in v4. If it works then it must work out of the box 🤔 For what's worth I'm not against adding this functionality to the core though in v4.

@adamchainz
Copy link
Owner

Right you are. I made a mistake in #35 and tox 3 was still being installed. I have fixed that now in #36.

Getting a way to do this in tox core would be great. I have a few suggestions for how it could be added:

  • -e could support a special form for "environments matching the the current python version / version x", such as a glob or regex.
  • A new argument could be added.
  • More simply, --skip-missing-interpreters could return a non-zero exit code if no environments run.

@gaborbernat
Copy link
Author

  • -e could support a special form for "environments matching the the current python version / version x", such as a glob or regex.

-e is defined as a list of environments to run, there's no space here to overload it with additional content.

  • A new argument could be added.

It could be though mutually exclusive with a --py flag 🤔 However, some environments might not use a python runner in which case this makes less sense (think node environments). So that might need more thought 🤔

  • More simply, --skip-missing-interpreters could return a non-zero exit code if no environments run.

If --skip-missing-interpreters is False we already fail with a non-zero exit code.

@adamchainz
Copy link
Owner

adamchainz commented Aug 30, 2021

If --skip-missing-interpreters is False we already fail with a non-zero exit code.

I mean if one runs tox --skip-missing-interpreters, but that ends up not matching any environments, the exit code is currently 0 even though nothing has run. Instead, it could be non-zero in that case.

This would fit my use case of launching one CI run per Python version. My fear with the current behaviour of --skip-missing-interepreters is that I'd accidentally configure CI to run nothing and end up with green checkmarks.

@gaborbernat
Copy link
Author

That feels something we could do 👍

@gaborbernat
Copy link
Author

Done via tox-dev/tox#2206

@adamchainz
Copy link
Owner

Thanks to that change, this plugin won't support tox 4. Instead users will be encouraged to use --skip-missing-interpreters, which I'm adding to the README. Thanks again @gaborbernat .

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

No branches or pull requests

2 participants