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

Add ability to specify which Python versions to run with from the command line. #95

Closed
theacodes opened this issue Jul 29, 2018 · 12 comments

Comments

@theacodes
Copy link
Collaborator

Context: https://github.com/theacodes/nox/pull/94/files/ad56baafab381ef967f504b1c2d9dc30d61bc96e#r205984653

@stsewd
Copy link
Collaborator

stsewd commented Nov 4, 2018

What about implicit specifying the python version on the session name? Something like:

@nox.session(python=['3.5', '3.6'])
def test():
    ...
$ nox -s test-3.7
nox> Warning: running session with custom interpreter
...

@theacodes
Copy link
Collaborator Author

I think that's a separate use case, but a useful one. Wanna file a separate bug for it?

@stsewd
Copy link
Collaborator

stsewd commented Nov 11, 2018

So, this issue is about something like filtering by python interpreter?

@stsewd
Copy link
Collaborator

stsewd commented Nov 11, 2018

I opened #158

@jarus
Copy link

jarus commented May 5, 2019

This would be a super helpful enhancement and would make nox even more useful, especially in situations where the developer would like to run a session(s) with one or multiple selected python version(s).

Do you have already a favourite solution for this problem which you would like to see in nox?

As a short term solution, I think it would be sufficient to add the python version in a normalized form (3.7 => py37) to the keyword list beside the SessionRunner.signature so that nox -k py37 only select sessions with the python 3.7 interpreter. Is that something you would welcome? If yes, I can create a pull request.

In general, I like nox's and pytest's intention to reuse an already known and established syntax like Python's logical operators for selecting sessions or tests but the current simple implementations with Python eval function also come with some disadvantages. For example it blocks the usage of keywords that don't follow the Python variable name rule like 3.7, test-3.7 or from. Therefore it is maybe a good idea to think about replacing eval with an own matcher with a more flexible syntax.

@theacodes
Copy link
Collaborator Author

@jarus, that sounds great - do you want to create a separate issue for that so we can track it? I'm more than happy to see a PR for that.

@theacodes
Copy link
Collaborator Author

This issue is actually a great first issue. It involves:

  1. Adding a new command-line parameter --python (or similar)
  2. Updating manifest's filtering to filter based on the --python parameter.

@vikrambhat11
Copy link
Contributor

Hi @theacodes ,

I would like to take a look at this issue if no one is already working on it.
Just had some questions before I start this.

Should the --python parameter work only with a specified task? My question is, will this be a supported case nox --python 3.7 on the command line? Or should it always be nox --session s1 --python 3.7

I have a couple of ideas to work on this depending on what we decide on this. Would love to discuss this.

@theacodes
Copy link
Collaborator Author

theacodes commented Aug 28, 2019 via email

@maciej-lech
Copy link
Contributor

As @vikrambhat11 has not been prepared a PR for this one, I'd like to propose my implementation as it would be a more convenient way for filtering by python interpreter versions comparing to using keywords.

@pradyunsg
Copy link
Contributor

This can be closed, given #304 is merged?

@theacodes
Copy link
Collaborator Author

Yup, thanks.

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

No branches or pull requests

6 participants