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

Have friendlier message if no noxfile.py found. #462

Closed
FollowTheProcess opened this issue Jul 5, 2021 · 1 comment
Closed

Have friendlier message if no noxfile.py found. #462

FollowTheProcess opened this issue Jul 5, 2021 · 1 comment

Comments

@FollowTheProcess
Copy link
Collaborator

How would this feature be useful?

If you run nox in a directory with no noxfile.py you get a scary looking exception:

image

This is clearly the intended behaviour as using nox without a noxfile is a bit of a non-starter to say the least, and most people could easily figure out what it's trying to tell you, but this traceback is somewhat distracting and slightly off-putting (especially to newer python developers).

A friendlier message could just provide a nicer experience for people new to this whole thing.

Describe the solution you'd like

If nox hits a FileNotFoundError whilst trying to load noxfile.py it could instead return a friendlier log message without the traceback along the lines of "no noxfile.py found in current directory, create one and try again." with maybe a link to the docs or something like that?

It could perhaps even generate a "hello world" style placeholder noxfile along the lines of:

import nox


@nox.session
def hello(session: nox.Session):
    """
    Your first nox session!
    """
    session.log("Hello world!")

But that might be unnecessary I don't know, keen for maintainers input here!

This seems pretty simple to implement and I'd be more than happy to submit a PR if this is something you'd like?

Thanks!

@cjolowicz
Copy link
Collaborator

Thanks for raising this, PR welcome! I'd suggest to keep it simple, along the lines of "noxfile.py not found".

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

No branches or pull requests

2 participants