-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
cli: add header or footer to nox -l #454
Comments
I like this idea. The module docstring seems a good fit for this IMO, as we already use docstrings of session functions. Would this be done unconditionally, or require some specific markup? Looking at pip, pipx, urllib3, and Nox itself, only pip uses a module docstring, which is simply "Automation using nox". From this partial evidence, I'd say probably no need for specific markup. |
I use nox for all my python projects and I rate this idea! Out of curiosity I forked and made a (very) naive implementation: Which when you add the docstring at the top of Exhibits the desired behaviour: I just took the functionality of Do either of you have any pointers? I'd be more than happy to implement this if so, I use nox a lot and would love the opportunity to contribute back (albeit a small amount). Edit: We'd probably want to do a |
Thanks for your interest in implementing this! The question is how to pass the user module, or just the docstring, from the My first thought would be to store the docstring in the session manifest (class |
@cjolowicz Thanks for the pointer! I'll play around a bit more and see what I can come up with! |
@cjolowicz I've had a first shot at this and have submitted a PR #459. Let me know what you think when you get a chance to look. I also added some tests and fixed the ones I broke with this change. I was getting a failing test locally: |
* Add header from noxfile.py docstring #454 This commit adds the functionality for using the `noxfile.py` module docstring as a header description for the `nox -l` option. The module docstring is now an attribute in `Manifest` which is now populated in `discover_manifest` which is in-turn passed to `honor_list_request` which will print the docstring if it is present, and do nothing if it is not present. I've also added two tests which cover these conditions (existent and non-existent module docstring) and added to an existing parametrized test. * Standardise printed docstring whitespace Co-authored-by: Claudio Jolowicz <[email protected]>
Fixed in #459 |
How would this feature be useful?
nox -l
is great; one of the best features is the fact that it shows the help text from the session's docstrings. It makes it a great entrypoint (and if there was a way to make the "default" be to show the sessions, such asnox.sessions = "-l"
, I'd probably tend to use that in most of my noxfiles). However, it would be very nice if there was a way to add general information at the top or bottom (don't care which) of that printout. For example, I often would like to add a little help snippet like this:since we've added support for running nox directly from pipx in the manylinux images, this is a handy note to add.
Describe the solution you'd like
This could either be something explicit like
nox.header='...'
, or it could take the module docstring for the noxfile.The text was updated successfully, but these errors were encountered: