From e73a9b03b137ca2b2118b2acb3b2bfc9ddce3c5e Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Fri, 4 Jan 2019 14:29:06 +0500 Subject: [PATCH 01/25] disable-pyemd --- setup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9982cfaeea..71c0c293bd 100644 --- a/setup.py +++ b/setup.py @@ -228,7 +228,10 @@ def finalize_options(self): 'pytest-rerunfailures', 'mock', 'cython', - 'pyemd', + # Disable pyemd, something wrong with compilation + # See https://github.com/RaRe-Technologies/gensim/issues/2309#issuecomment-450046496 + # + # 'pyemd', 'testfixtures', 'scikit-learn', 'Morfessor==2.0.2a4', From d9872c57a987579109a3086a489a3009110672b5 Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Fri, 4 Jan 2019 14:48:20 +0500 Subject: [PATCH 02/25] revert pyemd to setup.py (it still works on linux) --- setup.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 71c0c293bd..9982cfaeea 100644 --- a/setup.py +++ b/setup.py @@ -228,10 +228,7 @@ def finalize_options(self): 'pytest-rerunfailures', 'mock', 'cython', - # Disable pyemd, something wrong with compilation - # See https://github.com/RaRe-Technologies/gensim/issues/2309#issuecomment-450046496 - # - # 'pyemd', + 'pyemd', 'testfixtures', 'scikit-learn', 'Morfessor==2.0.2a4', From dcecf19523e87e690d0f69519f4d90467ecacc83 Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Fri, 4 Jan 2019 14:49:03 +0500 Subject: [PATCH 03/25] extend 'catch' on import --- gensim/models/deprecated/keyedvectors.py | 2 +- gensim/models/keyedvectors.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gensim/models/deprecated/keyedvectors.py b/gensim/models/deprecated/keyedvectors.py index 8f5ccaf355..5ead121e48 100644 --- a/gensim/models/deprecated/keyedvectors.py +++ b/gensim/models/deprecated/keyedvectors.py @@ -86,7 +86,7 @@ try: from pyemd import emd PYEMD_EXT = True -except ImportError: +except (ImportError, ValueError): PYEMD_EXT = False from numpy import dot, zeros, dtype, float32 as REAL,\ diff --git a/gensim/models/keyedvectors.py b/gensim/models/keyedvectors.py index 0b2be1d732..7911fe5805 100644 --- a/gensim/models/keyedvectors.py +++ b/gensim/models/keyedvectors.py @@ -172,7 +172,7 @@ try: from pyemd import emd PYEMD_EXT = True -except ImportError: +except (ImportError, ValueError): PYEMD_EXT = False from numpy import dot, float32 as REAL, empty, memmap as np_memmap, \ From dbfd07b97637ce6465577470dc5e1ed93d80c962 Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Fri, 4 Jan 2019 14:49:26 +0500 Subject: [PATCH 04/25] correct test skipping --- gensim/test/test_similarities.py | 32 ++++++++++++-------------------- gensim/test/test_word2vec.py | 15 +++++---------- 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/gensim/test/test_similarities.py b/gensim/test/test_similarities.py index 4965d96d6f..5a52ed9dd2 100644 --- a/gensim/test/test_similarities.py +++ b/gensim/test/test_similarities.py @@ -29,7 +29,7 @@ try: from pyemd import emd # noqa:F401 PYEMD_EXT = True -except ImportError: +except (ImportError, ValueError): PYEMD_EXT = False sentences = [doc2vec.TaggedDocument(words, [i]) for i, words in enumerate(texts)] @@ -80,7 +80,7 @@ def testFull(self, num_best=None, shardsize=100): def testNumBest(self): if self.cls == similarities.WmdSimilarity and not PYEMD_EXT: - return + self.skipTest("pyemd not installed or have some issues") for num_best in [None, 0, 1, 9, 1000]: self.testFull(num_best=num_best) @@ -166,7 +166,7 @@ def testIter(self): def testPersistency(self): if self.cls == similarities.WmdSimilarity and not PYEMD_EXT: - return + self.skipTest("pyemd not installed or have some issues") fname = get_tmpfile('gensim_similarities.tst.pkl') index = self.factoryMethod() @@ -186,7 +186,7 @@ def testPersistency(self): def testPersistencyCompressed(self): if self.cls == similarities.WmdSimilarity and not PYEMD_EXT: - return + self.skipTest("pyemd not installed or have some issues") fname = get_tmpfile('gensim_similarities.tst.pkl.gz') index = self.factoryMethod() @@ -206,7 +206,7 @@ def testPersistencyCompressed(self): def testLarge(self): if self.cls == similarities.WmdSimilarity and not PYEMD_EXT: - return + self.skipTest("pyemd not installed or have some issues") fname = get_tmpfile('gensim_similarities.tst.pkl') index = self.factoryMethod() @@ -228,7 +228,7 @@ def testLarge(self): def testLargeCompressed(self): if self.cls == similarities.WmdSimilarity and not PYEMD_EXT: - return + self.skipTest("pyemd not installed or have some issues") fname = get_tmpfile('gensim_similarities.tst.pkl.gz') index = self.factoryMethod() @@ -250,7 +250,7 @@ def testLargeCompressed(self): def testMmap(self): if self.cls == similarities.WmdSimilarity and not PYEMD_EXT: - return + self.skipTest("pyemd not installed or have some issues") fname = get_tmpfile('gensim_similarities.tst.pkl') index = self.factoryMethod() @@ -273,7 +273,7 @@ def testMmap(self): def testMmapCompressed(self): if self.cls == similarities.WmdSimilarity and not PYEMD_EXT: - return + self.skipTest("pyemd not installed or have some issues") fname = get_tmpfile('gensim_similarities.tst.pkl.gz') index = self.factoryMethod() @@ -298,12 +298,10 @@ def factoryMethod(self): # Override factoryMethod. return self.cls(texts, self.w2v_model) + @unittest.skipIf(PYEMD_EXT == False, "pyemd not installed or have some issues") def testFull(self, num_best=None): # Override testFull. - if not PYEMD_EXT: - return - index = self.cls(texts, self.w2v_model) index.num_best = num_best query = texts[0] @@ -319,15 +317,13 @@ def testFull(self, num_best=None): self.assertTrue(numpy.alltrue(sims[1:] > 0.0)) self.assertTrue(numpy.alltrue(sims[1:] < 1.0)) + @unittest.skipIf(PYEMD_EXT == False, "pyemd not installed or have some issues") def testNonIncreasing(self): ''' Check that similarities are non-increasing when `num_best` is not `None`.''' # NOTE: this could be implemented for other similarities as well (i.e. # in _TestSimilarityABC). - if not PYEMD_EXT: - return - index = self.cls(texts, self.w2v_model, num_best=3) query = texts[0] sims = index[query] @@ -337,12 +333,10 @@ def testNonIncreasing(self): cond = sum(numpy.diff(sims2) < 0) == len(sims2) - 1 self.assertTrue(cond) + @unittest.skipIf(PYEMD_EXT == False, "pyemd not installed or have some issues") def testChunking(self): # Override testChunking. - if not PYEMD_EXT: - return - index = self.cls(texts, self.w2v_model) query = texts[:3] sims = index[query] @@ -358,12 +352,10 @@ def testChunking(self): self.assertTrue(numpy.alltrue(sim > 0.0)) self.assertTrue(numpy.alltrue(sim <= 1.0)) + @unittest.skipIf(PYEMD_EXT == False, "pyemd not installed or have some issues") def testIter(self): # Override testIter. - if not PYEMD_EXT: - return - index = self.cls(texts, self.w2v_model) for sims in index: self.assertTrue(numpy.alltrue(sims >= 0.0)) diff --git a/gensim/test/test_word2vec.py b/gensim/test/test_word2vec.py index de8abd702a..fb62c13bd6 100644 --- a/gensim/test/test_word2vec.py +++ b/gensim/test/test_word2vec.py @@ -26,7 +26,7 @@ try: from pyemd import emd # noqa:F401 PYEMD_EXT = True -except ImportError: +except (ImportError, ValueError): PYEMD_EXT = False @@ -1023,12 +1023,11 @@ def test_compute_training_loss(self): # endclass TestWord2VecModel class TestWMD(unittest.TestCase): + + @unittest.skipIf(PYEMD_EXT == False, "pyemd not installed or have some issues") def testNonzero(self): '''Test basic functionality with a test sentence.''' - if not PYEMD_EXT: - return - model = word2vec.Word2Vec(sentences, min_count=2, seed=42, workers=1) sentence1 = ['human', 'interface', 'computer'] sentence2 = ['survey', 'user', 'computer', 'system', 'response', 'time'] @@ -1037,12 +1036,10 @@ def testNonzero(self): # Check that distance is non-zero. self.assertFalse(distance == 0.0) + @unittest.skipIf(PYEMD_EXT == False, "pyemd not installed or have some issues") def testSymmetry(self): '''Check that distance is symmetric.''' - if not PYEMD_EXT: - return - model = word2vec.Word2Vec(sentences, min_count=2, seed=42, workers=1) sentence1 = ['human', 'interface', 'computer'] sentence2 = ['survey', 'user', 'computer', 'system', 'response', 'time'] @@ -1050,12 +1047,10 @@ def testSymmetry(self): distance2 = model.wv.wmdistance(sentence2, sentence1) self.assertTrue(np.allclose(distance1, distance2)) + @unittest.skipIf(PYEMD_EXT == False, "pyemd not installed or have some issues") def testIdenticalSentences(self): '''Check that the distance from a sentence to itself is zero.''' - if not PYEMD_EXT: - return - model = word2vec.Word2Vec(sentences, min_count=1) sentence = ['survey', 'user', 'computer', 'system', 'response', 'time'] distance = model.wv.wmdistance(sentence, sentence) From 3cdaa1c3cc67c40eabe88ba4971126b4adf6d040 Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Fri, 4 Jan 2019 15:01:27 +0500 Subject: [PATCH 05/25] fix flake8 --- gensim/test/test_similarities.py | 8 ++++---- gensim/test/test_word2vec.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gensim/test/test_similarities.py b/gensim/test/test_similarities.py index 5a52ed9dd2..84290e9066 100644 --- a/gensim/test/test_similarities.py +++ b/gensim/test/test_similarities.py @@ -298,7 +298,7 @@ def factoryMethod(self): # Override factoryMethod. return self.cls(texts, self.w2v_model) - @unittest.skipIf(PYEMD_EXT == False, "pyemd not installed or have some issues") + @unittest.skipIf(PYEMD_EXT is False, "pyemd not installed or have some issues") def testFull(self, num_best=None): # Override testFull. @@ -317,7 +317,7 @@ def testFull(self, num_best=None): self.assertTrue(numpy.alltrue(sims[1:] > 0.0)) self.assertTrue(numpy.alltrue(sims[1:] < 1.0)) - @unittest.skipIf(PYEMD_EXT == False, "pyemd not installed or have some issues") + @unittest.skipIf(PYEMD_EXT is False, "pyemd not installed or have some issues") def testNonIncreasing(self): ''' Check that similarities are non-increasing when `num_best` is not `None`.''' @@ -333,7 +333,7 @@ def testNonIncreasing(self): cond = sum(numpy.diff(sims2) < 0) == len(sims2) - 1 self.assertTrue(cond) - @unittest.skipIf(PYEMD_EXT == False, "pyemd not installed or have some issues") + @unittest.skipIf(PYEMD_EXT is False, "pyemd not installed or have some issues") def testChunking(self): # Override testChunking. @@ -352,7 +352,7 @@ def testChunking(self): self.assertTrue(numpy.alltrue(sim > 0.0)) self.assertTrue(numpy.alltrue(sim <= 1.0)) - @unittest.skipIf(PYEMD_EXT == False, "pyemd not installed or have some issues") + @unittest.skipIf(PYEMD_EXT is False, "pyemd not installed or have some issues") def testIter(self): # Override testIter. diff --git a/gensim/test/test_word2vec.py b/gensim/test/test_word2vec.py index fb62c13bd6..11257bebb1 100644 --- a/gensim/test/test_word2vec.py +++ b/gensim/test/test_word2vec.py @@ -1024,7 +1024,7 @@ def test_compute_training_loss(self): class TestWMD(unittest.TestCase): - @unittest.skipIf(PYEMD_EXT == False, "pyemd not installed or have some issues") + @unittest.skipIf(PYEMD_EXT is False, "pyemd not installed or have some issues") def testNonzero(self): '''Test basic functionality with a test sentence.''' @@ -1036,7 +1036,7 @@ def testNonzero(self): # Check that distance is non-zero. self.assertFalse(distance == 0.0) - @unittest.skipIf(PYEMD_EXT == False, "pyemd not installed or have some issues") + @unittest.skipIf(PYEMD_EXT is False, "pyemd not installed or have some issues") def testSymmetry(self): '''Check that distance is symmetric.''' @@ -1047,7 +1047,7 @@ def testSymmetry(self): distance2 = model.wv.wmdistance(sentence2, sentence1) self.assertTrue(np.allclose(distance1, distance2)) - @unittest.skipIf(PYEMD_EXT == False, "pyemd not installed or have some issues") + @unittest.skipIf(PYEMD_EXT is False, "pyemd not installed or have some issues") def testIdenticalSentences(self): '''Check that the distance from a sentence to itself is zero.''' From 9ac2dcf557e54f39209a28f25a973914bdd30d20 Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Fri, 4 Jan 2019 15:24:44 +0500 Subject: [PATCH 06/25] fix docs building --- docs/src/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/conf.py b/docs/src/conf.py index 3ba4ae06b2..15835ed5c1 100644 --- a/docs/src/conf.py +++ b/docs/src/conf.py @@ -17,7 +17,7 @@ # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.append(os.path.abspath('.')) +sys.path.insert(0, os.path.abspath('..')) # -- General configuration ----------------------------------------------------- From ad8fddcdfc332e448d9588cd00faee77f29d8b56 Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Fri, 4 Jan 2019 15:32:42 +0500 Subject: [PATCH 07/25] correct skipping if pyemd not available --- gensim/test/test_fasttext.py | 8 ++++++++ gensim/test/test_fasttext_wrapper.py | 9 +++++++++ gensim/test/test_similarities.py | 4 +++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/gensim/test/test_fasttext.py b/gensim/test/test_fasttext.py index c9935431e4..1bb3c80e4b 100644 --- a/gensim/test/test_fasttext.py +++ b/gensim/test/test_fasttext.py @@ -18,6 +18,13 @@ from gensim.models.keyedvectors import Word2VecKeyedVectors from gensim.test.utils import datapath, get_tmpfile, temporary_file, common_texts as sentences + +try: + from pyemd import emd # noqa:F401 + PYEMD_EXT = True +except (ImportError, ValueError): + PYEMD_EXT = False + logger = logging.getLogger(__name__) IS_WIN32 = (os.name == "nt") and (struct.calcsize('P') * 8 == 32) @@ -357,6 +364,7 @@ def test_contains(self): self.assertFalse('nights' in self.test_model.wv.vocab) self.assertTrue('nights' in self.test_model.wv) + @unittest.skipIf(PYEMD_EXT is False, "pyemd not installed or have some issues") def test_wm_distance(self): doc = ['night', 'payment'] oov_doc = ['nights', 'forests', 'payments'] diff --git a/gensim/test/test_fasttext_wrapper.py b/gensim/test/test_fasttext_wrapper.py index bc995f8159..66dd7b47c5 100644 --- a/gensim/test/test_fasttext_wrapper.py +++ b/gensim/test/test_fasttext_wrapper.py @@ -18,6 +18,14 @@ from gensim.models import keyedvectors from gensim.test.utils import datapath, get_tmpfile + +try: + from pyemd import emd # noqa:F401 + PYEMD_EXT = True +except (ImportError, ValueError): + PYEMD_EXT = False + + logger = logging.getLogger(__name__) @@ -311,6 +319,7 @@ def testContains(self): self.assertFalse('a!@' in self.test_model.wv.vocab) self.assertFalse('a!@' in self.test_model) + @unittest.skipIf(PYEMD_EXT is False, "pyemd not installed or have some issues") def testWmdistance(self): """Tests wmdistance for docs with in-vocab and out-of-vocab words""" doc = ['night', 'payment'] diff --git a/gensim/test/test_similarities.py b/gensim/test/test_similarities.py index 84290e9066..a254568a9d 100644 --- a/gensim/test/test_similarities.py +++ b/gensim/test/test_similarities.py @@ -78,7 +78,6 @@ def testFull(self, num_best=None, shardsize=100): index.destroy() def testNumBest(self): - if self.cls == similarities.WmdSimilarity and not PYEMD_EXT: self.skipTest("pyemd not installed or have some issues") @@ -110,6 +109,9 @@ def test_scipy2scipy_clipped(self): def testEmptyQuery(self): index = self.factoryMethod() + if isintance(index, similarities.WmdSimilarity) and not PYEMD_EXT: + self.skipTest("pyemd not installed or have some issues") + query = [] try: sims = index[query] From 4f38b0938d7ff10488e3c8fa4603cd197e3f4f3f Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Fri, 4 Jan 2019 15:35:25 +0500 Subject: [PATCH 08/25] fix typo --- gensim/test/test_similarities.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gensim/test/test_similarities.py b/gensim/test/test_similarities.py index a254568a9d..e1f876e216 100644 --- a/gensim/test/test_similarities.py +++ b/gensim/test/test_similarities.py @@ -109,7 +109,7 @@ def test_scipy2scipy_clipped(self): def testEmptyQuery(self): index = self.factoryMethod() - if isintance(index, similarities.WmdSimilarity) and not PYEMD_EXT: + if isinstance(index, similarities.WmdSimilarity) and not PYEMD_EXT: self.skipTest("pyemd not installed or have some issues") query = [] From e02e082cbfc5281fdaf68df0d408f640bd26924b Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Fri, 4 Jan 2019 15:53:34 +0500 Subject: [PATCH 09/25] upd --- docs/src/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/conf.py b/docs/src/conf.py index 15835ed5c1..b9534bc0de 100644 --- a/docs/src/conf.py +++ b/docs/src/conf.py @@ -17,7 +17,7 @@ # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.insert(0, os.path.abspath('..')) +sys.path.insert(0, os.path.abspath('.')) # -- General configuration ----------------------------------------------------- From 002943d856a63d438259a9a43520bd2a49ee0441 Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Fri, 4 Jan 2019 16:18:57 +0500 Subject: [PATCH 10/25] pin sphinx --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9982cfaeea..4a75519b11 100644 --- a/setup.py +++ b/setup.py @@ -352,7 +352,7 @@ def finalize_options(self): 'distributed': distributed_env, 'test-win': win_testenv, 'test': linux_testenv, - 'docs': linux_testenv + distributed_env + ['sphinx', 'sphinxcontrib-napoleon', 'plotly', 'pattern <= 2.6', 'sphinxcontrib.programoutput'], + 'docs': linux_testenv + distributed_env + ['sphinx==1.8.2', 'sphinxcontrib-napoleon', 'plotly', 'pattern <= 2.6', 'sphinxcontrib.programoutput'], }, include_package_data=True, From 4027565fffc551aeed074f2548d35813f17e795b Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Fri, 4 Jan 2019 16:28:40 +0500 Subject: [PATCH 11/25] revert sphinx pin --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4a75519b11..9982cfaeea 100644 --- a/setup.py +++ b/setup.py @@ -352,7 +352,7 @@ def finalize_options(self): 'distributed': distributed_env, 'test-win': win_testenv, 'test': linux_testenv, - 'docs': linux_testenv + distributed_env + ['sphinx==1.8.2', 'sphinxcontrib-napoleon', 'plotly', 'pattern <= 2.6', 'sphinxcontrib.programoutput'], + 'docs': linux_testenv + distributed_env + ['sphinx', 'sphinxcontrib-napoleon', 'plotly', 'pattern <= 2.6', 'sphinxcontrib.programoutput'], }, include_package_data=True, From cb83e1c5a098317cc591216dc1d33db93248db0d Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Fri, 4 Jan 2019 16:29:08 +0500 Subject: [PATCH 12/25] disable -W for sphinx (REVERT ME), issue not reproduced locally, only here --- docs/src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/Makefile b/docs/src/Makefile index 30cbe5a869..a19f5a2306 100644 --- a/docs/src/Makefile +++ b/docs/src/Makefile @@ -5,7 +5,7 @@ # pip3 install sphinx sphinxcontrib-napoleon # You can set these variables from the command line. -SPHINXOPTS = -W +SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build From 80625a5172acb151bc866ae42683c69e2c757f25 Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Fri, 4 Jan 2019 16:44:17 +0500 Subject: [PATCH 13/25] more verbosity --- docs/src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/Makefile b/docs/src/Makefile index a19f5a2306..bdc24131d3 100644 --- a/docs/src/Makefile +++ b/docs/src/Makefile @@ -5,7 +5,7 @@ # pip3 install sphinx sphinxcontrib-napoleon # You can set these variables from the command line. -SPHINXOPTS = +SPHINXOPTS = -T -v SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build From 565d640672d04fbfdf4e577ec565d8ade0e82682 Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Fri, 4 Jan 2019 16:47:17 +0500 Subject: [PATCH 14/25] MOAR verbosity --- docs/src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/Makefile b/docs/src/Makefile index bdc24131d3..a66e55adf9 100644 --- a/docs/src/Makefile +++ b/docs/src/Makefile @@ -5,7 +5,7 @@ # pip3 install sphinx sphinxcontrib-napoleon # You can set these variables from the command line. -SPHINXOPTS = -T -v +SPHINXOPTS = -T -vv SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build From bf8355370bae8bbcf6ebed3b6ecd2e04e8e610b6 Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Fri, 4 Jan 2019 17:18:45 +0500 Subject: [PATCH 15/25] try to use different path --- docs/src/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/conf.py b/docs/src/conf.py index b9534bc0de..da7d0a1994 100644 --- a/docs/src/conf.py +++ b/docs/src/conf.py @@ -17,7 +17,7 @@ # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.insert(0, os.path.abspath('.')) +sys.path.insert(0, os.path.abspath('../..')) # -- General configuration ----------------------------------------------------- From 9abae6864423b31a1116ed5e71f2d4679bac759f Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Mon, 7 Jan 2019 12:13:24 +0500 Subject: [PATCH 16/25] build binaries before docs --- tox.ini | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index c5446a8097..ba1131ed94 100644 --- a/tox.ini +++ b/tox.ini @@ -74,9 +74,10 @@ basepython = python2 recreate = True whitelist_externals = make deps = .[docs] -changedir = docs/src -commands = make clean html +commands = + python setup.py build_ext --inplace + make -C docs/src clean html [testenv:docs-upload] From 6f67f4f98c45389fd973c97bb4e3ff97a6ef76f4 Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Mon, 7 Jan 2019 12:18:59 +0500 Subject: [PATCH 17/25] pin previous version of programoutput (avoid bug from 0.13) --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9982cfaeea..ba770a4bdb 100644 --- a/setup.py +++ b/setup.py @@ -352,7 +352,7 @@ def finalize_options(self): 'distributed': distributed_env, 'test-win': win_testenv, 'test': linux_testenv, - 'docs': linux_testenv + distributed_env + ['sphinx', 'sphinxcontrib-napoleon', 'plotly', 'pattern <= 2.6', 'sphinxcontrib.programoutput'], + 'docs': linux_testenv + distributed_env + ['sphinx', 'sphinxcontrib-napoleon', 'plotly', 'pattern <= 2.6', 'sphinxcontrib.programoutput == 0.11'], }, include_package_data=True, From 5e2ee2119e9cb9fef2b734476913ec3965007771 Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Mon, 7 Jan 2019 12:19:27 +0500 Subject: [PATCH 18/25] revert Makefile --- docs/src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/Makefile b/docs/src/Makefile index a66e55adf9..30cbe5a869 100644 --- a/docs/src/Makefile +++ b/docs/src/Makefile @@ -5,7 +5,7 @@ # pip3 install sphinx sphinxcontrib-napoleon # You can set these variables from the command line. -SPHINXOPTS = -T -vv +SPHINXOPTS = -W SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build From 2a0204cc7031268d239fe304d2ab0c92dc850a36 Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Mon, 7 Jan 2019 12:38:07 +0500 Subject: [PATCH 19/25] fix --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index ba770a4bdb..bdf390e326 100644 --- a/setup.py +++ b/setup.py @@ -352,7 +352,7 @@ def finalize_options(self): 'distributed': distributed_env, 'test-win': win_testenv, 'test': linux_testenv, - 'docs': linux_testenv + distributed_env + ['sphinx', 'sphinxcontrib-napoleon', 'plotly', 'pattern <= 2.6', 'sphinxcontrib.programoutput == 0.11'], + 'docs': linux_testenv + distributed_env + ['sphinx', 'sphinxcontrib-napoleon', 'plotly', 'pattern <= 2.6', 'sphinxcontrib.programoutput==0.11'], }, include_package_data=True, From f9d538a3050410ba9eba2135224e0699fe95be50 Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Mon, 7 Jan 2019 14:44:06 +0500 Subject: [PATCH 20/25] disable programoutput sphinx plugin --- docs/src/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/conf.py b/docs/src/conf.py index da7d0a1994..0fa670665e 100644 --- a/docs/src/conf.py +++ b/docs/src/conf.py @@ -25,7 +25,7 @@ # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc', 'sphinxcontrib.napoleon', 'sphinx.ext.imgmath', 'sphinxcontrib.programoutput'] +extensions = ['sphinx.ext.autodoc', 'sphinxcontrib.napoleon', 'sphinx.ext.imgmath'] # temporary disable plugin by 'numpy.ufunc has the wrong size' reason., 'sphinxcontrib.programoutput'] autoclass_content = "both" napoleon_google_docstring = False # Disable support for google-style docstring From b2bd87a5b988c143ae037af9fadf81a8b10a7119 Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Mon, 7 Jan 2019 14:45:33 +0500 Subject: [PATCH 21/25] revert pinning --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index bdf390e326..9982cfaeea 100644 --- a/setup.py +++ b/setup.py @@ -352,7 +352,7 @@ def finalize_options(self): 'distributed': distributed_env, 'test-win': win_testenv, 'test': linux_testenv, - 'docs': linux_testenv + distributed_env + ['sphinx', 'sphinxcontrib-napoleon', 'plotly', 'pattern <= 2.6', 'sphinxcontrib.programoutput==0.11'], + 'docs': linux_testenv + distributed_env + ['sphinx', 'sphinxcontrib-napoleon', 'plotly', 'pattern <= 2.6', 'sphinxcontrib.programoutput'], }, include_package_data=True, From 747724bcb8ce0432c1fb78fa168a45cbee3a3379 Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Mon, 7 Jan 2019 15:50:47 +0500 Subject: [PATCH 22/25] one more attempt --- .circleci/config.yml | 2 +- docs/src/conf.py | 2 +- tox.ini | 10 ++++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d2125123c3..fd4dc7f12f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -30,7 +30,7 @@ jobs: name: Build documentation command: | source venv/bin/activate - tox -e docs -vv + tox -e compile,docs -vv - store_artifacts: path: docs/src/_build diff --git a/docs/src/conf.py b/docs/src/conf.py index 0fa670665e..da7d0a1994 100644 --- a/docs/src/conf.py +++ b/docs/src/conf.py @@ -25,7 +25,7 @@ # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc', 'sphinxcontrib.napoleon', 'sphinx.ext.imgmath'] # temporary disable plugin by 'numpy.ufunc has the wrong size' reason., 'sphinxcontrib.programoutput'] +extensions = ['sphinx.ext.autodoc', 'sphinxcontrib.napoleon', 'sphinx.ext.imgmath', 'sphinxcontrib.programoutput'] autoclass_content = "both" napoleon_google_docstring = False # Disable support for google-style docstring diff --git a/tox.ini b/tox.ini index ba1131ed94..58131e949f 100644 --- a/tox.ini +++ b/tox.ini @@ -69,6 +69,14 @@ deps = flake8-rst == 0.4.3 commands = flake8-rst gensim/ docs/ {posargs} +[testenv:compile] +basepython = python2 +recreate = True + +deps = numpy == 1.11.3 +commands = python setup.py build_ext --inplace + + [testenv:docs] basepython = python2 recreate = True @@ -76,10 +84,8 @@ whitelist_externals = make deps = .[docs] commands = - python setup.py build_ext --inplace make -C docs/src clean html - [testenv:docs-upload] recreate = True whitelist_externals = make From 75d8c4d6501c3979bd06a0e3ceecd33dea1fda41 Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Mon, 7 Jan 2019 16:06:26 +0500 Subject: [PATCH 23/25] cleanup --- tox.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 58131e949f..4604784abe 100644 --- a/tox.ini +++ b/tox.ini @@ -82,9 +82,9 @@ basepython = python2 recreate = True whitelist_externals = make deps = .[docs] +changedir = docs/src -commands = - make -C docs/src clean html +commands = make clean html [testenv:docs-upload] recreate = True From ed9b2bd89f531212656c1160bcf93c6cd62eac78 Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Mon, 7 Jan 2019 16:11:18 +0500 Subject: [PATCH 24/25] cleanup[2] --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index 4604784abe..df760d469a 100644 --- a/tox.ini +++ b/tox.ini @@ -77,6 +77,7 @@ deps = numpy == 1.11.3 commands = python setup.py build_ext --inplace + [testenv:docs] basepython = python2 recreate = True From e86f94ead1c0c219756d8faf300a7b5eabe5514a Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Mon, 7 Jan 2019 16:15:57 +0500 Subject: [PATCH 25/25] fix --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index df760d469a..eb7db07013 100644 --- a/tox.ini +++ b/tox.ini @@ -77,7 +77,6 @@ deps = numpy == 1.11.3 commands = python setup.py build_ext --inplace - [testenv:docs] basepython = python2 recreate = True @@ -87,6 +86,7 @@ changedir = docs/src commands = make clean html + [testenv:docs-upload] recreate = True whitelist_externals = make