Skip to content

Commit

Permalink
🐛 Fix error when zero chunks are passed, add intersphinx (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddelange authored Nov 19, 2020
1 parent 5164a32 commit 57b503f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
17 changes: 14 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
# -- Project information -----------------------------------------------------

project = "mapply"
project_url = "https://github.com/ddelange/mapply"
author = "ddelange"
copyright = "2020, ddelange" # noqa:A001

Expand All @@ -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"

Expand Down Expand Up @@ -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
):
Expand Down Expand Up @@ -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
}
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ def read_readme(path):
author="ddelange",
author_email="[email protected]",
url="https://github.com/ddelange/mapply",
project_urls={
"Documentation": "https://mapply.readthedocs.io",
},
python_requires=">=3.6",
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down
4 changes: 2 additions & 2 deletions src/mapply/parallel.py
Original file line number Diff line number Diff line change
@@ -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:
::
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 57b503f

Please sign in to comment.