-
-
Notifications
You must be signed in to change notification settings - Fork 151
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
Unable to pass a function to session.notify
(misleading docstring?)
#748
Comments
The simplest fix would be to compare Line 313 in 5c82dc5
If we go this way, the parameter type would need to change. I don't think there's a reasonable way to get hold of the Line 26 in 5c82dc5
Line 59 in 5c82dc5
They're currently not part of the public interface. |
We should also consider changing the docstring and type to simply disallow this. It never worked, and I'm not sure there's a use case for it. update: On second thoughts, I think there is a case for allowing this. If you pass the function instead of a string, typos can be caught at type-check time (in other words, you get a wiggly line in your editor). It doesn't constrain the order of the function definitions because the |
IMO, we should change the docstring for now, and not add this until after working on any reworks planned, like #631 or #167 (comment), as it might complicate those. Long term, I think it makes sense. |
This would be great! Here is a workaround I'm currently using to get this: @nox.session()
def some_session(session: nox.Session):
session.notify(some_other_session.__name__) Perhaps this could suggested in the docstring if useful? |
Current Behavior
The docs and docstring for
session.notify
say that the target "may be specified as the appropriate string [...] or using the function object". I assumed this meant you could pass a@nox.session
-decorated function intosession.notify
. However, the type annotation (target: str | SessionRunner
) doesn't permit this, and indeed it doesn't work:Am I misinterpreting the docstring, or is this not actually supported?
Expected Behavior
Passing a function should run that session as documented.
Steps To Reproduce
With this noxfile:
Run
nox -s notify
. The above error is raised.For comparison, this noxfile works as expected:
Environment
Anything else?
It seems like this behaviour/documentation may have been present since all the way back when notify was introduced (d6b3a5a)?
Session.notify
:Manifest.notify
:target
appears to be passed verbatim tosession
, so I'm not sure if this ever actually worked.The text was updated successfully, but these errors were encountered: