Source: jellyfish
Severity: wishlist

Dear Maintainer,

after a discussion with Andreas Tille [1], I'm wondering if it would be
possible to rename the python module of the python bindings from
"jellyfish" to "dna_jellyfish", in order to avoid conflicts with an
existing PyPI [2] package, which is also in the process of being
packaged into Debian [3].

A short background on the nature of this change (more details can be
found following he linked discussions, and I'd be happy to provide more
specific pointers if needed), according to my understanding:
* both packages define a "jellyfish" module.
* a consensus in regards to the package names and the module names has
been seeked with moderate results (the most likely being that the
current DNA-jellyfish bindings should retain the "python-jellyfish"
Debian package name, but the actual Python module should be renamed).
* the upstream DNA-jellyfish author has already expressed his
willingness to rename the Python module [4] as it is still not too
widespread, although unfortunately it seems that there has not been too
much movement in this regard in the upstream repository yet.

I'm attaching two patches that would therefore solve this issue on the
Debian end, hoping we can eventually tackle the issue at the upstream
level. As for the new name, the patch uses "dna_jellyfish" since it was
the first alternative suggested by upstream - I'd be happy to switch to
another name if preferred.

Both patches are the output of plain "git diff" against the patched
Debian sources:
rename-python-module-to-dna_jellyfish.patch:
* setup.py: invokes swig using the "-module" argument [5]
* setup.py: renames the Extension and the package name, and updates the
  older check to reference the new filename.
* test_*.py: replaces the references to the "jellyfish" module with
  "dna_jellyfish".

update-debian-rules-dh_clean.patch:
* debian/rules: updates override_dh_clean to remove the swig generated
  .py file.

I still need to do another round to ensure no further changes are
needed: in particular, I still have to confirm that the python tests
are actually executed (debuild output):

---
make  check-TESTS
...
SKIP: tests/swig_python.sh
...
running install_egg_info
Writing 
/tmp/buildd/jellyfish-2.2.5/debian/python3-jellyfish/usr/lib/python3.5/dist-packages/dna_jellyfish-0.0.1.egg-in
fo
I: pybuild base:184: cd 
/tmp/buildd/jellyfish-2.2.5/.pybuild/pythonX.Y_3.5/build; python3.5 -m unittest 
discover -v 

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
...
---

The same "SKIP: tests/swig_python.sh" and "Ran 0 tests ..." lines also
seem to be present on the current 2.2.5-1 debuild log, so it might not
be an issue after all and a result of me not having gone through all
the details about the testing yet.

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=806716#79
[2] https://pypi.python.org/pypi/jellyfish
[3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=806716
[4] https://lists.debian.org/debian-python/2015/12/msg00107.html
[5] http://www.swig.org/Doc3.0/SWIGDocumentation.html#SWIG_nn2

-- 
Diego M. Rodriguez
36B3 42A9 9F2F 2CFB F79B  FF9B B6C4 B901 06BC E232

diff --git a/swig/python/setup.py b/swig/python/setup.py
index b980b87..1edd509 100644
--- a/swig/python/setup.py
+++ b/swig/python/setup.py
@@ -12,13 +12,13 @@ from distutils.core import setup, Extension
 swig_time = os.path.getmtime('../jellyfish.i')
 older = True
 try:
-    older = os.path.getmtime('jellyfish_wrap.cxx') < swig_time or os.path.getmtime('jellyfish.py') < swig_time
+    older = os.path.getmtime('jellyfish_wrap.cxx') < swig_time or os.path.getmtime('dna_jellyfish.py') < swig_time
 except FileNotFoundError:
     older = True
 
 if older:
-    print("Running swig: swig -c++ -python -o jellyfish_wrap.cxx ../jellyfish.i")
-    os.system("swig -c++ -python -o jellyfish_wrap.cxx ../jellyfish.i")
+    print("Running swig: swig -c++ -python -module dna_jellyfish -o jellyfish_wrap.cxx ../jellyfish.i")
+    os.system("swig -c++ -python -module dna_jellyfish -o jellyfish_wrap.cxx ../jellyfish.i")
 
 jf_include = [re.sub(r'-I', '', x) for x in os.popen("pkg-config --cflags-only-I jellyfish-2.0").read().rstrip().split()]
 jf_cflags  = os.popen("pkg-config --cflags-only-other jellyfish-2.0").read().rstrip().split()
@@ -28,7 +28,7 @@ jf_libdir  = [re.sub(r'-L', '', x) for x in os.popen("pkg-config --libs-only-L j
 jf_ldflags = os.popen("pkg-config --libs-only-other jellyfish-2.0").read().rstrip().split()
 
 
-jellyfish_module = Extension('_jellyfish',
+jellyfish_module = Extension('_dna_jellyfish',
                              sources = ['jellyfish_wrap.cxx'],
                              include_dirs = jf_include,
                              libraries = jf_libs,
@@ -36,9 +36,9 @@ jellyfish_module = Extension('_jellyfish',
                              extra_compile_args = ["-std=c++0x"] + jf_cflags,
                              extra_link_args = jf_ldflags,
                              language = "c++")
-setup(name = 'jellyfish',
+setup(name = 'dna_jellyfish',
       version = '0.0.1',
       author = 'Guillaume Marcais',
       description = 'Access to jellyfish k-mer counting',
       ext_modules = [jellyfish_module],
-      py_modules = ["jellyfish"])
+      py_modules = ["dna_jellyfish"])
diff --git a/swig/python/test_hash_counter.py b/swig/python/test_hash_counter.py
index 8632d6d..1b1d710 100644
--- a/swig/python/test_hash_counter.py
+++ b/swig/python/test_hash_counter.py
@@ -1,20 +1,20 @@
 import unittest
 import sys
 import random
-import jellyfish
+import dna_jellyfish
 
 class TestHashCounter(unittest.TestCase):
     def setUp(self):
-        jellyfish.MerDNA.k(100)
-        self.hash = jellyfish.HashCounter(1024, 5)
+        dna_jellyfish.MerDNA.k(100)
+        self.hash = dna_jellyfish.HashCounter(1024, 5)
 
     def test_info(self):
-        self.assertEqual(100, jellyfish.MerDNA.k())
+        self.assertEqual(100, dna_jellyfish.MerDNA.k())
         self.assertEqual(1024, self.hash.size())
         self.assertEqual(5, self.hash.val_len())
 
     def test_add(self):
-        mer  = jellyfish.MerDNA()
+        mer  = dna_jellyfish.MerDNA()
         good = True
         for i in range(1000):
             mer.randomize()
diff --git a/swig/python/test_mer_file.py b/swig/python/test_mer_file.py
index 1a1cc6c..54b6faa 100644
--- a/swig/python/test_mer_file.py
+++ b/swig/python/test_mer_file.py
@@ -1,4 +1,4 @@
-import jellyfish
+import dna_jellyfish
 import unittest
 import sys
 import os
@@ -6,7 +6,7 @@ from collections import Counter
 
 class TestMerFile(unittest.TestCase):
     def setUp(self):
-        self.mf = jellyfish.ReadMerFile(os.path.join(data, "swig_python.jf"))
+        self.mf = dna_jellyfish.ReadMerFile(os.path.join(data, "swig_python.jf"))
 
     def test_histo(self):
         histo = Counter()
@@ -46,7 +46,7 @@ class TestMerFile(unittest.TestCase):
 
     def test_query(self):
         good = True
-        qf   = jellyfish.QueryMerFile(os.path.join(data, "swig_python.jf"))
+        qf   = dna_jellyfish.QueryMerFile(os.path.join(data, "swig_python.jf"))
         for mer, count in self.mf:
             good = good and count == qf[mer]
             if not good: break
diff --git a/swig/python/test_string_mers.py b/swig/python/test_string_mers.py
index bf7d6b1..226f4b8 100644
--- a/swig/python/test_string_mers.py
+++ b/swig/python/test_string_mers.py
@@ -1,21 +1,21 @@
 import unittest
 import sys
 import random
-import jellyfish
+import dna_jellyfish
 
 class TestStringMers(unittest.TestCase):
     def setUp(self):
         bases = "ACGTacgt"
         self.str = ''.join(random.choice(bases) for _ in range(1000))
         self.k = random.randint(10, 110)
-        jellyfish.MerDNA.k(self.k)
+        dna_jellyfish.MerDNA.k(self.k)
 
     def test_all_mers(self):
         count = 0
         good = True
-        mers = jellyfish.string_mers(self.str)
+        mers = dna_jellyfish.string_mers(self.str)
         for m in mers:
-            m2 = jellyfish.MerDNA(self.str[count:count+self.k])
+            m2 = dna_jellyfish.MerDNA(self.str[count:count+self.k])
             good = good and m == m2
             count += 1
         self.assertTrue(good)
@@ -23,9 +23,9 @@ class TestStringMers(unittest.TestCase):
 
     def test_canonical_mers(self):
         good = True
-        mers = jellyfish.string_canonicals(self.str)
+        mers = dna_jellyfish.string_canonicals(self.str)
         for count, m in enumerate(mers):
-            m2 = jellyfish.MerDNA(self.str[count:count+self.k])
+            m2 = dna_jellyfish.MerDNA(self.str[count:count+self.k])
             rm2 = m2.get_reverse_complement()
             good = good and (m == m2 or m == rm2)
             good = good and (not (m > m2)) and (not (m > rm2))
diff --git a/debian/rules b/debian/rules
index 790ad39..5d9557e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -55,7 +55,7 @@ override_dh_clean:
 	    rmdir debian/tmp_save_tests ; \
 	fi
 	rm -f tests/compat.sh
-	rm -f swig/python/jellyfish*
+	rm -f swig/python/jellyfish* swig/python/dna_jellyfish.py
 
 override_dh_auto_build:
 	mkdir -p debian/tmp_save_tests

Attachment: signature.asc
Description: Digital signature

Reply via email to