Skip to content

Commit

Permalink
make python 3.6 the minimum required version.
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneskoester committed Nov 2, 2020
1 parent a813ea9 commit 0357911
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import versioneer


if sys.version_info < (3, 7):
print("At least Python 3.7 is required.\n", file=sys.stderr)
if sys.version_info < (3, 6):
print("At least Python 3.6 is required.\n", file=sys.stderr)
exit(1)


Expand Down Expand Up @@ -91,7 +91,7 @@
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Topic :: Scientific/Engineering :: Bio-Informatics",
],
)
5 changes: 5 additions & 0 deletions snakemake/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2182,6 +2182,11 @@ def get_argument_parser(profile=None):

def main(argv=None):
"""Main entry point."""

if sys.version_info < (3, 6):
print("Snakemake requires at least Python 3.6.", file=sys.stderr)
exit(1)

parser = get_argument_parser()
args = parser.parse_args(argv)

Expand Down
11 changes: 11 additions & 0 deletions snakemake/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import inspect
import uuid
import os
import asyncio
import sys

from ._version import get_versions

Expand All @@ -25,6 +27,15 @@
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:
async_run = asyncio.run



class TBDInt(int):
"""An integer that prints into <TBD>"""

Expand Down
7 changes: 3 additions & 4 deletions snakemake/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
)
from snakemake.logging import logger
from inspect import isfunction, ismethod

from snakemake.common import DYNAMIC_FILL, ON_WINDOWS
from snakemake.common import DYNAMIC_FILL, ON_WINDOWS, async_run


class Mtime:
Expand Down Expand Up @@ -134,7 +133,7 @@ def __init__(self, max_wait_time):
self.max_wait_time = max_wait_time

def mtime_inventory(self, jobs):
asyncio.run(self._mtime_inventory(jobs))
async_run(self._mtime_inventory(jobs))

async def _mtime_inventory(self, jobs, n_workers=8):
queue = asyncio.Queue()
Expand Down Expand Up @@ -252,7 +251,7 @@ def wrapper(self, *args, **kwargs):
return wrapper

def inventory(self):
asyncio.run(self._inventory())
async_run(self._inventory())

async def _inventory(self):
"""Starting from the given file, try to cache as much existence and
Expand Down

0 comments on commit 0357911

Please sign in to comment.