From 90360489c5ae864d73ec513e75a807b4e9a7d01d Mon Sep 17 00:00:00 2001
From: Blaise Li <blaise.li__git@nsup.org>
Date: Thu, 10 Sep 2020 13:57:29 +0200
Subject: [PATCH] Python version constraint.

---
 .gitignore          | 11 +++++++++++
 bin/split_merged.py |  4 ++++
 setup.py            |  4 +++-
 3 files changed, 18 insertions(+), 1 deletion(-)
 create mode 100644 .gitignore

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b4e1667
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,11 @@
+# Compiled python modules.
+*.pyc
+
+# Setuptools distribution folder.
+/dist/
+
+# Python egg metadata, regenerated from source files by setuptools.
+/*.egg-info
+
+# Backups
+*~
diff --git a/bin/split_merged.py b/bin/split_merged.py
index 1d99ae4..1b8ffff 100755
--- a/bin/split_merged.py
+++ b/bin/split_merged.py
@@ -19,6 +19,9 @@ subgroups of those reads based on similarity.
 """
 
 import sys
+major, minor = sys.version_info[:2]
+if major < 3 or (major == 3 and minor < 8):
+    sys.exit("Need at least python 3.8\n")
 import logging
 from pathlib import Path
 import multiprocessing as mp
@@ -59,6 +62,7 @@ def main():
             pool.apply_async(
                 split_fasta, args=(
                     in_fname,
+                    # "Walrus" assignment expression introduced in Python 3.8
                     cell_id := in_fname.name[:-len("_merged.fasta")],
                     out_dir.join_path(cell_id)))
             for in_fname in in_fnames]
diff --git a/setup.py b/setup.py
index 0e7560c..74930c1 100644
--- a/setup.py
+++ b/setup.py
@@ -39,7 +39,9 @@ setup(
     author="Blaise Li",
     author_email="blaise.li@normalesup.org",
     license="GNU GPLv3",
-    python_requires=">=3.4, <4",
+    # >=3.8 because using := in bin/split_merged.py
+    # Requirement could be relaxed to >=3.6 otherwise.
+    python_requires=">=3.8, <4",
     packages=find_packages(),
     scripts=["bin/split_merged.py"],
     #ext_modules = extensions,
-- 
GitLab