code: def bump(session: nox.Session) -> None:
      """
      Set to a new version, use -- <version>, otherwise will use the latest version.
      """
      parser = argparse.ArgumentParser(
          description="Process some integers."
      )
      parser.add_argument(
          "--upstream-repository",
          metavar="UPSTREAM_REPOSITORY",
          choices=["Kitware/ninja", "ninja-build/ninja"],
          default="Kitware/ninja",
          help="Ninja upstream repository",
      )
      parser.add_argument(
          "--commit",
          action="store_true",
          help="Make a branch and commit.",
      )
      parser.add_argument(
          "version",
          nargs="?",
          help="The version to process - leave off for latest.",
      )
      args = parser.parse_args(session.posargs)
  
      if args.version is None:
          session.install("lastversion")
          version = session.run(
              "lastversion",
              "--format",
              "tag",
              args.upstream_repository,
              log=False,
              silent=True,
          ).strip()
          if version.startswith("v"):
              version = version[1:]
      else:
          version = args.version
  
      session.install("requests")
  
      extra = ["--quiet"] if args.commit else []
      session.run(
          "python",
          "scripts/update_ninja_version.py",
          "--upstream-repository",
          args.upstream_repository,
          version,
          *extra,
      )
  
      if args.commit:
          session.run(
              "git",
              "switch",
              "-c",
              f"update-to-ninja-{version}",
              external=True,
          )
          files = (
              "NinjaUrls.cmake",
              "README.rst",
              "tests/test_ninja.py",
              "docs/update_ninja_version.rst",
          )
          session.run(
              "git",
              "add",
              "-u",
              *files,
              external=True,
          )
          session.run(
              "git",
              "commit",
              "-m",
              f"Update to Ninja {version}",
              external=True,
          )
          session.log(
              'Complete! Now run: gh pr create --fill --body "Created by running `nox -s bump -- --commit`"'
          )
  
file_path: ninja-python-distributions/noxfile.py
imports: import argparse
  import sys
  from pathlib import Path
  import nox
label_desc: Use image node_id 4 for calling a global function with example usage: bump(session) without return types