Skip to content
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

Pin mypy to 0.790 to prevent linting errors when running v 0.8 #11422

Merged
merged 1 commit into from
Feb 20, 2021

Conversation

jdavcs
Copy link
Member

@jdavcs jdavcs commented Feb 19, 2021

Running make update-dependencies will update mypy to version 0.8, which will cause the following error:

mypy run-test: commands[0] | mypy test lib
lib/galaxy/tools/bundled/data_source/data_source.py: error: Duplicate module named 'data_source' (also at 'test/functional/tools/data_source.py')
lib/galaxy/tools/bundled/data_source/data_source.py: error: Are you missing an __init__.py?
Found 2 errors in 1 file (errors prevented further checking)
ERROR: InvocationError for command /home/runner/work/galaxy/galaxy/.tox/mypy/bin/mypy test lib (exited with code 2)

I'm looking into the error, but for now I think it's reasonable to just pin it.

@jdavcs jdavcs added this to the 21.05 milestone Feb 19, 2021
@jdavcs
Copy link
Member Author

jdavcs commented Feb 19, 2021

It appears that mypy 0.790 was not discovering all modules to test, which was a bug, fixed in 0.8 (see python/mypy#8548 and python/mypy#9614). In our case, running mypy separately on test and then on lib solves the error cited above (duplicate module names), but then it discovers more modules (1648 vs 1504) - and more errors (see below). The most recent version (0.812) provides a way to exclude directories, but given the variety of errors it finds, I don't think it's a viable solution.
I haven't looked closely at the newly discovered errors, but in any case it seems reasonable to stick with 0.790 until we address all these errors.

(.venv) rivendell$ mypy test lib
lib/galaxy/tools/bundled/data_source/data_source.py: error: Duplicate module named 'data_source' (also at 'test/functional/tools/data_source.py')
lib/galaxy/tools/bundled/data_source/data_source.py: note: Are you missing an __init__.py? Alternatively, consider using --exclude to avoid checking one of them.
Found 1 error in 1 file (errors prevented further checking)
(.venv) rivendell$ mypy test
test/integration/test_job_environments.py:19: error: First argument to namedtuple() should be 'JobEnviromentProperties', not 'JobEnvironmentProperties'
test/unit/tools/test_toolbox.py:38: error: First argument to namedtuple() should be 'REPO_TYPE', not 'DEFAULT_TEST_REPO'
test/integration/test_cli_runners.py:15: error: First argument to namedtuple() should be 'RemoteConnection', not 'remote_connection'
test/integration/test_kubernetes_runner.py:25: error: First argument to namedtuple() should be 'Config', not 'ConfigTuple'
test/integration/test_datatype_upload.py:18: error: First argument to namedtuple() should be 'TestData', not 'UploadDatatypesData'
test/integration/test_repository_operations.py:9: error: First argument to namedtuple() should be 'REPO_TYPE', not 'Repository'
Found 6 errors in 6 files (checked 292 source files)
(.venv) rivendell$ mypy lib
lib/galaxy/tools/bundled/metag_tools/blat_wrapper.py:7: error: Unsupported operand types for >= ("_version_info" and "float")
lib/galaxy/tools/bundled/filters/sff_extract.py:45: error: Need type annotation for 'ssahapematches' (hint: "ssahapematches: Dict[<type>, <type>] = ...")
lib/galaxy/tools/bundled/filters/sff_extract.py:47: error: Need type annotation for 'linkerlengths' (hint: "linkerlengths: Dict[<type>, <type>] = ...")
lib/galaxy/tools/bundled/metag_tools/shrimp_color_wrapper.py:12: error: Unsupported operand types for >= ("_version_info" and "float")
lib/galaxy/tools/bundled/extract/liftOver_wrapper.py:60: error: Incompatible types in assignment (expression has type "float", variable has type "str")
lib/galaxy/tools/bundled/extract/liftOver_wrapper.py:76: error: Item "None" of "Optional[IO[bytes]]" has no attribute "read"
lib/galaxy/tools/bundled/next_gen_conversion/solid2fastq.py:11: error: Module 'string' has no attribute 'maketrans'
lib/galaxy/tools/bundled/next_gen_conversion/solid2fastq.py:11: error: Name 'maketrans' already defined on line 9
lib/galaxy/tool_util/deps/mulled/util.py:19: error: First argument to namedtuple() should be 'PARSED_TAG', not 'ParsedTag'
lib/galaxy/tool_shed/tool_shed_registry.py:16: error: First argument to namedtuple() should be 'AUTH_TUPLE', not 'AuthSetting'
lib/galaxy/tool_util/deps/mulled/mulled_build_files.py:29: error: First argument to namedtuple() should be 'FALLBACK_LINE_TUPLE', not '_Line'
lib/galaxy/tools/toolbox/base.py:58: error: First argument to namedtuple() should be '_ToolConfRepository', not 'ToolConfRepository'
lib/galaxy/tools/__init__.py:194: error: First argument to namedtuple() should be 'safe_update', not 'SafeUpdate'
Found 13 errors in 10 files (checked 1356 source files)

@jdavcs
Copy link
Member Author

jdavcs commented Feb 20, 2021

Failing tests unrelated.

@jmchilton
Copy link
Member

I merged two related PR that created conflicting fixture data huh? Opps.

@jmchilton jmchilton merged commit 63540d5 into galaxyproject:dev Feb 20, 2021
@github-actions
Copy link

This PR was merged without a "kind/" label, please correct.

@jdavcs jdavcs added the kind/refactoring cleanup or refactoring of existing code, no functional changes label Feb 20, 2021
@jdavcs jdavcs deleted the dev_mypy_pin branch April 5, 2021 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dependencies kind/refactoring cleanup or refactoring of existing code, no functional changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants