From 57b503f31228772476066114543341efa2bcbc08 Mon Sep 17 00:00:00 2001 From: david <14880945+ddelange@users.noreply.github.com> Date: Thu, 19 Nov 2020 17:52:34 +0100 Subject: [PATCH] :bug: Fix error when zero chunks are passed, add intersphinx (#4) --- docs/source/conf.py | 17 ++++++++++++++--- setup.py | 3 +++ src/mapply/parallel.py | 4 ++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index e3ddb69..48a47fc 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -34,6 +34,7 @@ # -- Project information ----------------------------------------------------- project = "mapply" +project_url = "https://github.com/ddelange/mapply" author = "ddelange" copyright = "2020, ddelange" # noqa:A001 @@ -50,9 +51,9 @@ "recommonmark", "sphinx_rtd_theme", "sphinx.ext.autodoc", - "sphinx.ext.coverage", "sphinx.ext.napoleon", "sphinx.ext.linkcode", + "sphinx.ext.intersphinx", ] autodoc_typehints = "description" @@ -108,13 +109,13 @@ def setup(app): app.connect("builder-inited", run_apidoc) -# -- Options for sphinx.ext.linkcode ----------------------------------------- +# -- Options for sphinx.ext.linkcode: [source] links ------------------------- def linkcode_resolve( # noqa:CCR001 domain, info, - blob_url="https://github.com/ddelange/mapply/blob", + blob_url=f"{project_url.rstrip('/')}/blob", default_branch="master", # branch used for untagged 'latest' builds on readthedocs tag_prefix="", # could be for instance "v" depending on tagging convention ): @@ -173,3 +174,13 @@ def linkcode_resolve( # noqa:CCR001 return f"{blob_url}/{default_branch}/{relsourcefile}{linespec}" else: return f"{blob_url}/{tag_prefix}{release}/{relsourcefile}{linespec}" + + +# -- Options for sphinx.ext.intersphinx -------------------------------------- + +intersphinx_mapping = { + "python": ("https://docs.python.org/3", None), + "pandas": ("https://pandas.pydata.org/pandas-docs/stable", None), + "pathos": ("https://pathos.readthedocs.io/en/latest", None), + # "tqdm": ("https://tqdm.github.io/docs/tqdm", None), # mkdocs not working +} diff --git a/setup.py b/setup.py index 249beca..d6cb100 100644 --- a/setup.py +++ b/setup.py @@ -37,6 +37,9 @@ def read_readme(path): author="ddelange", author_email="david@delange.dev", url="https://github.com/ddelange/mapply", + project_urls={ + "Documentation": "https://mapply.readthedocs.io", + }, python_requires=">=3.6", classifiers=[ "Development Status :: 5 - Production/Stable", diff --git a/src/mapply/parallel.py b/src/mapply/parallel.py index 4381fa1..c09af86 100644 --- a/src/mapply/parallel.py +++ b/src/mapply/parallel.py @@ -1,4 +1,4 @@ -"""Submodule containing code to distribute computation over multiple processes using :meth:`pathos.multiprocessing.ProcessPool`. +"""Submodule containing code to distribute computation over multiple processes using :class:`pathos.multiprocessing.ProcessPool`. Standalone usage: :: @@ -80,7 +80,7 @@ def multiprocessing_imap( n_workers = _choose_n_workers(n_chunks, n_workers) - if n_chunks == 1 or n_workers == 1: + if n_workers <= 1: # no sense spawning pool pool = None stage = map(func, iterable)