How to use the submit50.__version__ function in submit50

To help you get started, we’ve selected a few submit50 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cs50 / submit50 / submit50 / __main__.py View on Github external
def main():
    sys.excepthook = excepthook

    parser = argparse.ArgumentParser(prog="submit50")
    parser.add_argument("--logout", action=LogoutAction)
    parser.add_argument("-v", "--verbose",
                        action="store_true",
                        help=_("show commands being executed"))
    parser.add_argument("-V", "--version", action="version", version=f"%(prog)s {__version__}")
    parser.add_argument("slug", help=_(
        "prescribed identifier of work to submit"))

    args = parser.parse_args()

    excepthook.verbose = args.verbose
    if args.verbose:
        logging.basicConfig(level=os.environ.get("SUBMIT50_LOGLEVEL", "INFO"))
        # Disable progress bar so it doesn't interfere with log
        lib50.ProgressBar.DISABLED = True

    check_announcements()
    check_version()

    user_name, commit_hash, message = lib50.push("submit50", args.slug, CONFIG_LOADER, prompt=prompt)
    print(message)
github cs50 / submit50 / submit50 / __main__.py View on Github external
def check_version():
    """Check that submit50 is the latest version according to submit50.io."""
    # Retrieve version info
    res = requests.get(f"{SUBMIT_URL}/versions/submit50")
    if res.status_code != 200:
        raise Error(_("You have an unknown version of submit50. "
                      "Email sysadmins@cs50.harvard.edu!"))

    # Check that latest version == version installed
    required_version = pkg_resources.parse_version(res.text.strip())
    local_version = pkg_resources.parse_version(__version__)

    if required_version > local_version:
       raise Error(_("You have an outdated version of submit50. "
                     "Please upgrade."))

submit50

This is submit50, with which you can submit solutions to problems for CS50.

GPL-3.0
Latest version published 6 months ago

Package Health Score

60 / 100
Full package analysis

Similar packages