diff --git a/setup.py b/setup.py index 8215430ff..5706d61c1 100644 --- a/setup.py +++ b/setup.py @@ -106,7 +106,7 @@ "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Natural Language :: English", - "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.7", "Topic :: Scientific/Engineering :: Bio-Informatics", ], ) diff --git a/snakemake/common/__init__.py b/snakemake/common/__init__.py index 852abd70d..3119ec81c 100644 --- a/snakemake/common/__init__.py +++ b/snakemake/common/__init__.py @@ -21,7 +21,7 @@ del get_versions -MIN_PY_VERSION = (3, 5) +MIN_PY_VERSION = (3, 7) DYNAMIC_FILL = "__snakemake_dynamic__" SNAKEMAKE_SEARCHPATH = str(Path(__file__).parent.parent.parent) UUID_NAMESPACE = uuid.uuid5(uuid.NAMESPACE_URL, "https://snakemake.readthedocs.io") @@ -32,30 +32,19 @@ ON_WINDOWS = platform.system() == "Windows" -if sys.version_info < (3, 7): - - def async_run(coroutine): - loop = asyncio.get_event_loop() - return loop.run_until_complete(coroutine) - -else: - - def async_run(coroutine): - """Attaches to running event loop or creates a new one to execute a - coroutine. - - .. seealso:: - - https://github.com/snakemake/snakemake/issues/1105 - https://stackoverflow.com/a/65696398 - - """ - try: - _ = asyncio.get_running_loop() - except RuntimeError: - asyncio.run(coroutine) - else: - asyncio.create_task(coroutine) +def async_run(coroutine): + """Attaches to running event loop or creates a new one to execute a + coroutine. + .. seealso:: + https://github.com/snakemake/snakemake/issues/1105 + https://stackoverflow.com/a/65696398 + """ + try: + _ = asyncio.get_running_loop() + except RuntimeError: + asyncio.run(coroutine) + else: + asyncio.create_task(coroutine) # A string that prints as TBD diff --git a/tests/testapi.py b/tests/testapi.py index 925a21534..b06a0b9d5 100644 --- a/tests/testapi.py +++ b/tests/testapi.py @@ -53,10 +53,7 @@ async def main(): async_run(dummy_task()) test_run_script_directive() - if sys.version_info < (3, 7): - async_run(main()) - else: - asyncio.run(main()) + asyncio.run(main()) def test_dicts_in_config():