diff --git a/.circleci/config.yml b/.circleci/config.yml index 24a8b0bf56..2e679bfd49 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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: diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 35815363b9..0601678af5 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -24,4 +24,4 @@ Like this: ``` ``` ---> \ No newline at end of file +--> diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md index be7a18089d..684dc972f8 100644 --- a/.github/ISSUE_TEMPLATE/question.md +++ b/.github/ISSUE_TEMPLATE/question.md @@ -12,4 +12,4 @@ Include the following: ------------------------ What are you trying to accomplish? What have you tried? ---> \ No newline at end of file +--> diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 1ecbe1cf19..b2cb3a760e 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -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. \ No newline at end of file +- [ ] I acknowledge that this contribution will be available under the Apache 2 license. diff --git a/LICENSE b/LICENSE index 28bfe8e4c6..ed4d8faa5e 100644 --- a/LICENSE +++ b/LICENSE @@ -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. - diff --git a/MANIFEST.in b/MANIFEST.in index 0e3be1c3f1..01c2de4725 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,3 @@ include versioneer.py include pydra/_version.py -include pydra/schema/context.jsonld \ No newline at end of file +include pydra/schema/context.jsonld diff --git a/docs/conf.py b/docs/conf.py index 9e3145f275..c155320f0f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -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__ @@ -36,25 +37,25 @@ # 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 ------------------------------------------------- @@ -62,27 +63,22 @@ # 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 @@ -90,21 +86,17 @@ # 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 diff --git a/docs/sphinxext/github_link.py b/docs/sphinxext/github_link.py index 84f4b90b6d..d30186c70c 100644 --- a/docs/sphinxext/github_link.py +++ b/docs/sphinxext/github_link.py @@ -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): @@ -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 @@ -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): @@ -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 + ) diff --git a/min-requirements.txt b/min-requirements.txt index babf634dce..d3dfcc4bb1 100644 --- a/min-requirements.txt +++ b/min-requirements.txt @@ -2,4 +2,4 @@ attrs cloudpickle == 0.8.0 filelock == 3.0.0 -etelemetry +etelemetry == 0.2.0 diff --git a/pydra/__init__.py b/pydra/__init__.py index 4c3618be98..24f74377af 100644 --- a/pydra/__init__.py +++ b/pydra/__init__.py @@ -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"] @@ -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 diff --git a/setup.cfg b/setup.cfg index ab4f861afb..88cff46654 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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