Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
command: pip install --no-cache-dir -r docs/requirements.txt
- run:
name: Build only this commit
command: make -C docs SPHINXOPTS="-W" BUILDDIR="_build/no_version_html" html
command: make -C docs SPHINXOPTS="-W" BUILDDIR="_build/no_version_html" SPHINX_APIDOC_OPTIONS="members,undoc-members,show-inheritance,noindex" html
- store_artifacts:
path: ./docs/_build/no_version_html
- run:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ Like this:
```
<code>
```
-->
-->
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ Include the following:
------------------------
What are you trying to accomplish?
What have you tried?
-->
-->
8 changes: 4 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
- [ ] All tests passing
- [ ] I have added tests to cover my changes
- [ ] I have updated documentation (if necessary)
- [ ] My code follows the code style of this project
(we are using `black`: you can `pip install pre-commit`,
run `pre-commit install` in the `pydra` directory
- [ ] My code follows the code style of this project
(we are using `black`: you can `pip install pre-commit`,
run `pre-commit install` in the `pydra` directory
and `black` will be run automatically with each commit)

## Acknowledgment
- [ ] I acknowledge that this contribution will be available under the Apache 2 license.
- [ ] I acknowledge that this contribution will be available under the Apache 2 license.
1 change: 0 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
include versioneer.py
include pydra/_version.py
include pydra/schema/context.jsonld
include pydra/schema/context.jsonld
66 changes: 29 additions & 37 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@
import sys
from pathlib import Path
from packaging.version import Version

sys.path.insert(0, str(Path(__file__).parent.parent.absolute()))
sys.path.insert(1, str(Path(__file__).parent / 'sphinxext'))
sys.path.insert(1, str(Path(__file__).parent / "sphinxext"))
from pydra import __version__
from github_link import make_linkcode_resolve


# -- Project information -----------------------------------------------------

project = 'Pydra: A simple dataflow engine with scalable semantics'
copyright = '2019 - 2020, The Nipype Developers team'
author = 'The Nipype Developers team'
project = "Pydra: A simple dataflow engine with scalable semantics"
copyright = "2019 - 2020, The Nipype Developers team"
author = "The Nipype Developers team"

# The full version, including alpha/beta/rc tags
release = __version__
Expand All @@ -36,75 +37,66 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.ifconfig',
'sphinx.ext.linkcode',
'sphinx.ext.githubpages',
'sphinxcontrib.apidoc',
'sphinxcontrib.napoleon'
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.coverage",
"sphinx.ext.mathjax",
"sphinx.ext.ifconfig",
"sphinx.ext.linkcode",
"sphinx.ext.githubpages",
"sphinxcontrib.apidoc",
"sphinxcontrib.napoleon",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'api/pydra.rst']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "api/pydra.rst"]


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

# -- Options for extensions ---------------------------------------------------

# Autodoc
autodoc_mock_imports = [
'cloudpickle',
'matplotlib',
'numpy',
'psutil',
]
apidoc_module_dir = '../pydra'
apidoc_output_dir = 'api'
apidoc_excluded_paths = ['conftest.py', '*/tests/*', 'tests/*', 'data/*']
autodoc_mock_imports = ["cloudpickle", "matplotlib", "numpy", "psutil"]
apidoc_module_dir = "../pydra"
apidoc_output_dir = "api"
apidoc_excluded_paths = ["conftest.py", "*/tests/*", "tests/*", "data/*"]
apidoc_separate_modules = True
apidoc_extra_args = ['--module-first', '-d 1', '-T']
apidoc_extra_args = ["--module-first", "-d 1", "-T"]

# Napoleon
# Accept custom section names to be parsed for numpy-style docstrings
# of parameters.
# Requires pinning sphinxcontrib-napoleon to a specific commit while
# https://github.com/sphinx-contrib/napoleon/pull/10 is merged.
napoleon_use_param = False
napoleon_custom_sections = [
('Inputs', 'Parameters'),
('Outputs', 'Parameters'),
]
napoleon_custom_sections = [("Inputs", "Parameters"), ("Outputs", "Parameters")]

# Intersphinx
intersphinx_mapping = {
'https://docs.python.org/': None,
}
intersphinx_mapping = {"https://docs.python.org/": None}

# Linkcode
# The following is used by sphinx.ext.linkcode to provide links to github
linkcode_resolve = make_linkcode_resolve(
'pydra', 'https://github.com/nipype/pydra/blob/{revision}/'
'{package}/{path}#L{lineno}')
"pydra",
"https://github.com/nipype/pydra/blob/{revision}/" "{package}/{path}#L{lineno}",
)

# Sphinx-versioning
scv_show_banner = True
31 changes: 15 additions & 16 deletions docs/sphinxext/github_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
import sys
from functools import partial

REVISION_CMD = 'git rev-parse --short HEAD'
REVISION_CMD = "git rev-parse --short HEAD"


def _get_git_revision():
try:
revision = subprocess.check_output(REVISION_CMD.split()).strip()
except (subprocess.CalledProcessError, OSError):
print('Failed to execute git to get revision')
print("Failed to execute git to get revision")
return None
return revision.decode('utf-8')
return revision.decode("utf-8")


def _linkcode_resolve(domain, info, package, url_fmt, revision):
Expand All @@ -38,18 +38,18 @@ def _linkcode_resolve(domain, info, package, url_fmt, revision):

if revision is None:
return
if domain not in ('py', 'pyx'):
if domain not in ("py", "pyx"):
return
if not info.get('module') or not info.get('fullname'):
if not info.get("module") or not info.get("fullname"):
return

class_name = info['fullname'].split('.')[0]
class_name = info["fullname"].split(".")[0]
if type(class_name) != str:
# Python 2 only
class_name = class_name.encode('utf-8')
module = __import__(info['module'], fromlist=[class_name])
class_name = class_name.encode("utf-8")
module = __import__(info["module"], fromlist=[class_name])
try:
obj = attrgetter(info['fullname'])(module)
obj = attrgetter(info["fullname"])(module)
except AttributeError:
return

Expand All @@ -65,14 +65,12 @@ def _linkcode_resolve(domain, info, package, url_fmt, revision):
if not fn:
return

fn = os.path.relpath(fn,
start=os.path.dirname(__import__(package).__file__))
fn = os.path.relpath(fn, start=os.path.dirname(__import__(package).__file__))
try:
lineno = inspect.getsourcelines(obj)[1]
except Exception:
lineno = ''
return url_fmt.format(revision=revision, package=package,
path=fn, lineno=lineno)
lineno = ""
return url_fmt.format(revision=revision, package=package, path=fn, lineno=lineno)


def make_linkcode_resolve(package, url_fmt):
Expand All @@ -87,5 +85,6 @@ def make_linkcode_resolve(package, url_fmt):
'{path}#L{lineno}')
"""
revision = _get_git_revision()
return partial(_linkcode_resolve, revision=revision, package=package,
url_fmt=url_fmt)
return partial(
_linkcode_resolve, revision=revision, package=package, url_fmt=url_fmt
)
2 changes: 1 addition & 1 deletion min-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
attrs
cloudpickle == 0.8.0
filelock == 3.0.0
etelemetry
etelemetry == 0.2.0
51 changes: 5 additions & 46 deletions pydra/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
first-class operations. It forms the core of the Nipype 2.0 ecosystem.

"""
import logging

logger = logging.getLogger("pydra")
from ._version import get_versions

__version__ = get_versions()["version"]
Expand All @@ -14,54 +17,10 @@
from . import mark


def check_latest_version(raise_exception=False):
"""
Check for the latest version of the library.

Parameters
----------
raise_exception: :obj:`bool`
Raise a RuntimeError if a bad version is being used

"""
def check_latest_version():
import etelemetry
import logging
from pkg_resources import parse_version

logger = logging.getLogger("pydra")

INIT_MSG = "Running {packname} version {version} (latest: {latest})".format

latest = {"version": "Unknown", "bad_versions": []}
result = None
try:
result = etelemetry.get_project("nipype/pydra")
except Exception as e:
logger.warning("Could not check for version updates: \n%s", e)
finally:
if result:
latest.update(**result)
if parse_version(__version__) != parse_version(latest["version"]):
logger.info(
INIT_MSG(
packname="pydra", version=__version__, latest=latest["version"]
)
)
if latest["bad_versions"] and any(
[
parse_version(__version__) == parse_version(ver)
for ver in latest["bad_versions"]
]
):
message = (
"You are using a version of Pydra with a critical "
"bug. Please use a different version."
)
if raise_exception:
raise RuntimeError(message)
else:
logger.critical(message)
return latest
return etelemetry.check_available_version("nipype/pydra", __version__, lgr=logger)


# Run telemetry on import for interactive sessions, such as IPython, Jupyter notebooks, Python REPL
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ install_requires =
attrs
cloudpickle >= 0.8.0
filelock >= 3.0.0
etelemetry
etelemetry >= 0.2.0

test_requires =
pytest >= 4.4.0
Expand Down