-
-
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
Initial pass at the cookbook #483
Conversation
I love the idea @FollowTheProcess! I would like to keep this on the docs, but maybe we should ask another maintainer, like @theacodes. |
This looks really nice! Here are a couple of simpler recipes I use a lot. Maybe recipes could be collection in GitHub Discussions Show & Tell, then the best added? # Sphinx
@nox.session(reuse_venv=True)
def docs(session):
"""
Build the docs. Pass "serve" to serve.
"""
session.install("-e", ".[docs]")
session.chdir('docs')
if "pdf" in session.posargs:
session.run("sphinx-build", "-M", "latexpdf", ".", "_build")
return
session.run("sphinx-build", "-M", "html", ".", "_build")
if "serve" in session.posargs:
session.log("Launching docs at http://localhost:8000/ - use Ctrl-C to quit")
session.run("python", "-m", "http.server", "8000", "-d", "_build/html")
elif session.posargs:
session.error("Unsupported argument to docs")
# MkDocs
@nox.session(reuse_venv=True)
def docs(session: nox.Session) -> None:
"""
Build the docs.
"""
session.install("-e", ".[docs]")
if session.posargs:
if "serve" in session.posargs:
session.run("mkdocs", "serve")
else:
session.error("Unrecognized args, use 'serve'")
else:
session.run("mkdocs", "build") @nox.session(reuse_venv=True)
def lint(session):
"""
Run the linter.
"""
session.install('pre-commit')
session.run('pre-commit', 'run', '--all-files', *session.posargs) @nox.session(reuse_venv=True)
def build(session):
"""
Build an SDist and wheel.
"""
session.install('build')
session.run('python', '-m', 'build', *session.posargs) |
@FollowTheProcess, can you please update this branch, so we can go ahead with the PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll wait a little before merging, to see if someone has concerns about this :)
I'm gonna go ahead and merge this in once the branch has updated, it's been hanging around for a while 🙂 |
Closes #471
This is my initial scaffold for the "cookbook" talked about in the linked issue. I added two of my more "interesting" nox sessions I use regularly to kind of kick it off.
Happy to go any way with this really. If we want it in the docs that's cool, or maybe break out into something separate. Just kicking off a potential idea.
Let me know if we want any changes.
Thanks 👍🏻