From c316d07cd8c64c59e9adc2ef3b55ca0593a941d0 Mon Sep 17 00:00:00 2001 From: Eriq Augustine Date: Sun, 17 Dec 2023 22:07:25 -0600 Subject: [PATCH] Lowered the Python version support to 3.8. --- .github/workflows/main.yml | 4 ++++ autograder/cli/util/extract-code.py | 3 ++- autograder/code.py | 6 ++++++ requirements.txt | 1 + setup.py | 4 ++-- 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1a21cab5..47122c27 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,6 +38,10 @@ jobs: shell: bash run: pip3 install -U -r requirements.txt + - name: Check Python Version Compatibility + shell: bash + run: vermin --no-tips --no-parse-comments --exclude ast.unparse --target=3.8- --violations autograder + - name: Run Tests shell: bash run: ./run_tests.py diff --git a/autograder/cli/util/extract-code.py b/autograder/cli/util/extract-code.py index 57c40bde..cebe58d0 100644 --- a/autograder/cli/util/extract-code.py +++ b/autograder/cli/util/extract-code.py @@ -17,7 +17,8 @@ def run(args): def _get_parser(): parser = argparse.ArgumentParser(description = - "Pull the code from a file and output the sanitized version as if it was being graded.") + "Pull the code from a file and output the sanitized version as if it was being graded." + + " Requires Python >= 3.9.") parser.add_argument('path', metavar = 'PATH', action = 'store', type = str, diff --git a/autograder/code.py b/autograder/code.py index 07137a8c..85aa8f66 100644 --- a/autograder/code.py +++ b/autograder/code.py @@ -140,4 +140,10 @@ def sanitize_code(source_code): return module_ast def ast_to_source(module_ast): + """ + Get code from an AST. + Note that this function requires Python 3.9 (greater than our declared Python version, + and should not be used in any core functionality. + """ + return ast.unparse(module_ast) diff --git a/requirements.txt b/requirements.txt index 76cf0aec..b73c23ca 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,3 +6,4 @@ platformdirs>=3.10.0 build twine packaging>=21.3 +vermin diff --git a/setup.py b/setup.py index 0fd5c16d..4ea37ba1 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ def get_description(): classifiers = [ 'Intended Audience :: Education', 'License :: OSI Approved :: MIT License', - 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.8', ], packages = setuptools.find_packages( @@ -47,5 +47,5 @@ def get_description(): license_files = (LICENSE_PATH, ), - python_requires = '>=3.10' + python_requires = '>=3.8' )