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 session.interactive to easily determine if Nox is being run by a human. #189

Closed
theacodes opened this issue May 16, 2019 · 7 comments
Closed

Comments

@theacodes
Copy link
Collaborator

How would this feature be useful?
In many cases its useful to know if nox is being run in an actual terminal or via CI or some other "headless" means.

Describe the solution you'd like
A new property on Session called interactive. It would look like this:

@nox.session
def docs(session):
    if session.interactive:
        session.run("sphinx-autobuild", ...)
    else:
        session.run("sphinx")
@dhermes
Copy link
Collaborator

dhermes commented May 17, 2019

Why can't nox users just call sys.stdout.isatty()?

@theacodes
Copy link
Collaborator Author

They can. But why make it harder than it needs to be?

@theacodes
Copy link
Collaborator Author

Also, we could add flags such as --non-interactive to force session.interactive to be false.

@dhermes
Copy link
Collaborator

dhermes commented May 17, 2019

But why make it harder than it needs to be?

Well session.interactive and sys.stdout.isatty() are about the same number of characters.

The --non-interactive flag is another story though.

@theacodes
Copy link
Collaborator Author

theacodes commented May 17, 2019 via email

@AGeekInside
Copy link
Contributor

I took a stab at adding the interactive attribute. There is a pull request with the initial changes to add the interactive attribute. I have not added the --non-interactive flag yet.

@theacodes
Copy link
Collaborator Author

theacodes commented Aug 1, 2019

This was implemented in #196

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

No branches or pull requests

3 participants