From 4b449e5688b1927461a649b0a90dbfc1c71146df Mon Sep 17 00:00:00 2001 From: Fenil Suchak Date: Thu, 18 Apr 2019 16:03:26 +0530 Subject: [PATCH 1/4] remove build files --- .coveragerc | 1 + .travis.yml | 1 + package/.coveragerc | 2 ++ package/setup.py | 15 +++++++++++++-- 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 package/.coveragerc diff --git a/.coveragerc b/.coveragerc index b1c22d95e71..e4450a53647 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,6 +1,7 @@ [run] branch = True source = MDAnalysis +plugins = Cython.Coverage omit = */migration/* */MDAnalysis/tests/* diff --git a/.travis.yml b/.travis.yml index 3aeb35f9a61..b35e7b427c3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,6 +34,7 @@ env: - PIP_DEPENDENCIES="duecredit" - NUMPY_VERSION=stable - INSTALL_HOLE="true" + - CYTHON_TRACE_NOGIL=1 matrix: # Run a coverage test for most versions diff --git a/package/.coveragerc b/package/.coveragerc new file mode 100644 index 00000000000..37388f00129 --- /dev/null +++ b/package/.coveragerc @@ -0,0 +1,2 @@ +[run] +plugins = Cython.Coverage \ No newline at end of file diff --git a/package/setup.py b/package/setup.py index fc19059ff9b..ebe6ca321d9 100755 --- a/package/setup.py +++ b/package/setup.py @@ -94,6 +94,7 @@ "parallelization module".format( Cython.__version__, required_version)) cython_found = False + cython_linetrace = True except ImportError: cython_found = False if not is_release: @@ -320,6 +321,10 @@ def extensions(config): else: mathlib = ['m'] + if cython_linetrace: + extra_compile_args.append("-DCYTHON_TRACE_NOGIL") + cpp_extra_compile_args.append("-DCYTHON_TRACE_NOGIL") + libdcd = MDAExtension('MDAnalysis.lib.formats.libdcd', ['MDAnalysis/lib/formats/libdcd' + source_suffix], include_dirs=include_dirs + ['MDAnalysis/lib/formats/include'], @@ -416,7 +421,13 @@ def extensions(config): cython_generated = [] if use_cython: - extensions = cythonize(pre_exts) + extensions = cythonize( + pre_exts, + compiler_directives={'linetrace' : cython_linetrace, + 'embedsignature' : cython_linetrace}, + ) + if cython_linetrace: + print("Cython coverage will be enabled") for pre_ext, post_ext in zip(pre_exts, extensions): for source in post_ext.sources: if source not in pre_ext.sources: @@ -608,7 +619,7 @@ def dynamic_author_list(): ) # Releases keep their cythonized stuff for shipping. - if not config.get('keep_cythonized', default=is_release): + if not config.get('keep_cythonized', default=is_release) and not cython_linetrace: for cythonized in cythonfiles: try: os.unlink(cythonized) From e42aecfceac8f63aecec353071bbfe8d0351fc67 Mon Sep 17 00:00:00 2001 From: Fenil Suchak Date: Sat, 20 Apr 2019 10:36:48 +0530 Subject: [PATCH 2/4] editable install travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b35e7b427c3..d3f93b97953 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,7 @@ env: - PYTEST_LIST="testsuite/MDAnalysisTests" - MAIN_CMD="pytest ${PYTEST_LIST}" - SETUP_CMD="${PYTEST_FLAGS}" - - BUILD_CMD="pip install -v package/ && (cd testsuite/ && python setup.py build)" + - BUILD_CMD="pip install -e package/ && (cd testsuite/ && python setup.py build)" - CONDA_MIN_DEPENDENCIES="mmtf-python mock six biopython networkx cython joblib matplotlib scipy griddataformats hypothesis gsd codecov" - CONDA_DEPENDENCIES="${CONDA_MIN_DEPENDENCIES} seaborn>=0.7.0 clustalw=2.1 netcdf4 scikit-learn" - CONDA_CHANNELS='biobuilds conda-forge' From 3703089551694a338ff98552c665bcf74e081264 Mon Sep 17 00:00:00 2001 From: Fenil Suchak Date: Sat, 20 Apr 2019 19:34:44 +0530 Subject: [PATCH 3/4] embedseg=False --- package/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/setup.py b/package/setup.py index ebe6ca321d9..e567a38be74 100755 --- a/package/setup.py +++ b/package/setup.py @@ -424,7 +424,7 @@ def extensions(config): extensions = cythonize( pre_exts, compiler_directives={'linetrace' : cython_linetrace, - 'embedsignature' : cython_linetrace}, + 'embedsignature' : False}, ) if cython_linetrace: print("Cython coverage will be enabled") From a8d05b7d36f62a2df27a375a270c9ee5802372d8 Mon Sep 17 00:00:00 2001 From: Richard Gowers Date: Sun, 21 Apr 2019 10:01:53 +0100 Subject: [PATCH 4/4] Make cython linetrace off by default --- package/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/setup.py b/package/setup.py index e567a38be74..b1291d138db 100755 --- a/package/setup.py +++ b/package/setup.py @@ -94,7 +94,7 @@ "parallelization module".format( Cython.__version__, required_version)) cython_found = False - cython_linetrace = True + cython_linetrace = bool(os.environ.get('CYTHON_TRACE_NOGIL', False)) except ImportError: cython_found = False if not is_release: