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

Skip factors that don't start with an alphabetic character #2764

Closed
wants to merge 1 commit into from

Conversation

nsoranzo
Copy link

A numeric factor in an environment name can wrongly cause a "conflicting factors" error.
Fix #2657 .

Thanks for contribution

Please, make sure you address all the checklists (for details on how see
development documentation)!

  • ran the linter to address style issues (tox -e fix)
  • wrote descriptive pull request text
  • ensured there are test(s) validating the fix
  • added news fragment in docs/changelog folder
  • updated/extended the documentation

A numeric factor in an environment name can wrongly cause a
"conflicting factors" error.
Fix tox-dev#2657 .
@@ -128,6 +128,9 @@ def default_base_python(self, conf: Config, env_name: str | None) -> list[str]:
def extract_base_python(env_name: str) -> str | None:
candidates: list[str] = []
for factor in env_name.split("-"):
if not factor[0].isalpha():
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't this break names like 3.7 that is valid (and used https://github.com/psycopg/psycopg/actions/runs/3642624184/jobs/6149941052) ? Or 3?

Copy link
Author

Choose a reason for hiding this comment

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

@gaborbernat Sorry for the late reply, holiday season!
I've looked at your example (had to go back to commit psycopg/psycopg@14bfb96 because they just removed their use of tox) and if their use of 3.7 as environment name was supposed to run tests under Python 3.7 it didn't work under tox 3 (see https://gist.github.com/nsoranzo/a291d87bbfa43c37a9c01a6aaf0d887b , where tox3 creates the 3.7 environment using Python 3.8) and I don't think it was never documented as supported, only py37.

Copy link
Member

Choose a reason for hiding this comment

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

It is supported with tox 4 though 🤔so we should add this feature by supporting it. 😅

Copy link
Author

Choose a reason for hiding this comment

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

tox 4 has been use in for just 20 days, this change is not documented (what environment factor may now be used as Python specifier? py37, 3.7, 37, 3?) and, most importantly, breaks environment names (as reported in #2657) which have been valid for years.
I don't think we can implement this feature without breaking some tox configuration that was working under the assumption that a number as environment factor is not interpreted as a Python specifier, but happy to help if you have a reasonable specification in mind.

Copy link
Member

Choose a reason for hiding this comment

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

py37, 3.7, 37, 3

mostly these 🤔

Copy link
Member

Choose a reason for hiding this comment

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

An easy fix will be that if we find 3.x.y, 3.x, 3x, or 3 factors, we still accept those here and pass them through but not other numbers.

@gaborbernat
Copy link
Member

Replaced by #2849 (review)

@stephenfin
Copy link
Contributor

@nsoranzo In summary, #2849 reverts to a modified version of the behaviour found in tox 3. The only changes are that more interpreter implementations are supported (rustpython, ironpython, and cpython, in addition to pypy and jython) and you can place a period between the MAJOR and MINOR versions. As such, py3, ironpython2.7 or py3.8 are all valid, while django3.2, 3.2 or py-3.2 are not. That should address the issues.

@nsoranzo nsoranzo deleted the fix_2657 branch January 11, 2023 18:06
@nsoranzo
Copy link
Author

@gaborbernat Sorry I didn't have time to follow up on your suggestions!

@stephenfin Thanks a lot for working on this and for your explanation, my issue is indeed fixed! 🎉

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

Successfully merging this pull request may close these issues.

Numeric factor in environment name wrongly causes "conflicting factors" error
3 participants