[Python-modules-commits] [jupyter-core] 01/10: Import jupyter-core_4.4.0.orig.tar.gz

Gordon Ball chronitis-guest at moszumanska.debian.org
Thu Nov 2 11:08:25 UTC 2017


This is an automated email from the git hooks/post-receive script.

chronitis-guest pushed a commit to branch master
in repository jupyter-core.

commit 0a51b77abfb635f7e6ed76c012e80d094854ba08
Author: Gordon Ball <gordon at chronitis.net>
Date:   Thu Nov 2 10:40:31 2017 +0000

    Import jupyter-core_4.4.0.orig.tar.gz
---
 .travis.yml                        | 19 ++++++++-----
 CONTRIBUTING.md                    |  2 ++
 README.md                          | 34 ++++++++++++++++++++++
 dev-requirements.txt               |  2 +-
 docs/changelog.rst                 | 23 ++++++++++++++-
 docs/conf.py                       |  5 +++-
 docs/requirements.txt              |  1 +
 examples/completions-zsh           |  2 +-
 jupyter_core/application.py        |  7 ++---
 jupyter_core/migrate.py            | 26 ++++++++++-------
 jupyter_core/tests/test_command.py | 58 +++++++++++++++++++++++++++-----------
 jupyter_core/tests/test_migrate.py |  6 +---
 jupyter_core/troubleshoot.py       |  2 +-
 jupyter_core/utils/__init__.py     | 18 ++++++++++++
 jupyter_core/version.py            |  2 +-
 setup.py                           |  2 +-
 16 files changed, 160 insertions(+), 49 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index b4c79db..075ac48 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,13 +2,18 @@
 language: python
 sudo: false
 python:
-    - 3.5
-    - 3.4
-    - 3.3
-    - 2.7
+  - nightly
+  - 3.6
+  - 3.5
+  - 3.4
+  - 3.3
+  - 2.7
 before_install:
-    - git clone --quiet --depth 1 https://github.com/minrk/travis-wheels travis-wheels
+  - pip install --upgrade setuptools pip
 install:
-    - pip install -f travis-wheels/wheelhouse -r dev-requirements.txt .
+  - pip install -r dev-requirements.txt .
 script:
-    - py.test jupyter_core
+  - py.test jupyter_core
+matrix:
+  allow_failures:
+    - python: nightly
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 6b73dbf..4aa1aac 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,3 +1,5 @@
 # Contributing
 
 We follow the [IPython Contributing Guide](https://github.com/ipython/ipython/blob/master/CONTRIBUTING.md).
+
+See the [README](https://github.com/jupyter/jupyter_core/blob/master/README.md) on how to set up a development environment.
diff --git a/README.md b/README.md
index c1bcbe2..b985452 100644
--- a/README.md
+++ b/README.md
@@ -5,3 +5,37 @@ Core common functionality of Jupyter projects.
 This package contains base application classes and configuration inherited by other projects.
 It doesn't do much on its own.
 
+
+# Development Setup
+
+The [Jupyter Contributor Guides](http://jupyter.readthedocs.io/en/latest/contributor/content-contributor.html) provide extensive information on contributing code or documentation to Jupyter projects. The limited instructions below for setting up a development environment are for your convenience.
+
+## Coding
+
+You'll need Python and `pip` on the search path. Clone the Jupyter Core git repository to your computer, for example in `/my/projects/jupyter_core`.
+Now create an [editable install](https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs)
+and download the dependencies of code and test suite by executing:
+
+    cd /my/projects/jupyter_core/
+    pip install -e .
+    pip install -r dev-requirements.txt
+    py.test
+
+The last command runs the test suite to verify the setup. During development, you can pass filenames to `py.test`, and it will execute only those tests.
+
+## Documentation
+
+The documentation of Jupyter Core is generated from the files in `docs/` using Sphinx. Instructions for setting up Sphinx with a selection of optional modules are in the [Documentation Guide](http://jupyter.readthedocs.io/en/latest/contrib_docs/index.html). You'll also need the `make` command.
+For a minimal Sphinx installation to process the Jupyter Core docs, execute:
+
+    pip install sphinx
+
+The following commands build the documentation in HTML format and check for broken links:
+
+    cd /my/projects/jupyter_core/docs/
+    make html linkcheck
+
+Point your browser to the following URL to access the generated documentation:
+
+_file:///my/projects/jupyter\_core/docs/\_build/html/index.html_
+
diff --git a/dev-requirements.txt b/dev-requirements.txt
index 2076845..5712bc3 100644
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -1,3 +1,3 @@
 pytest
 mock
-ipython
+ipykernel
diff --git a/docs/changelog.rst b/docs/changelog.rst
index 27fe993..d73e1dd 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -1,6 +1,27 @@
 Changes in jupyter-core
 =======================
 
+4.4
+---
+
+4.4.0
+~~~~~
+
+`on
+GitHub <https://github.com/jupyter/jupyter_core/releases/tag/4.4.0>`__
+
+- ``jupyter troubleshoot`` gets the list of packages from the Python environment
+  it's in, by using ``sys.executable`` to call ``pip list`` (:ghpull:`104`).
+- Added utility function ``ensure_dir_exists``, and switched to using it over
+  the one from ipython_genutils, which does permissions wrong (:ghpull:`113`).
+- Avoid creating the ``~/.ipython`` directory when checking if it exists for
+  config migration (:ghpull:`118`).
+- Fix mistaken description in zsh completions (:ghpull:`98`).
+- Fix subcommand tests on Windows (:ghpull:`103`).
+- The README now describes how to work on ``jupyter_core`` and build the docs
+  (:ghpull:`110`).
+- Fix a broken link to a release in the docs (:ghpull:`109`).
+
 4.3
 ---
 
@@ -52,7 +73,7 @@ GitHub <https://github.com/jupyter/jupyter_core/releases/tag/4.1.1>`__
 ~~~~~
 
 `on
-GitHub <https://github.com/jupyter/jupyter_core/releases/tag/4.1>`__
+GitHub <https://github.com/jupyter/jupyter_core/releases/tag/4.1.0>`__
 
 - Add ``jupyter.py`` module, so that :command:`python -m jupyter` always works.
 - Add prototype ``jupyter troubleshoot`` command for displaying environment info.
diff --git a/docs/conf.py b/docs/conf.py
index b421cd8..6fa60ea 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -33,8 +33,11 @@ import shlex
 extensions = [
     'sphinx.ext.autodoc',
     'sphinx.ext.intersphinx',
+    'sphinxcontrib_github_alt',
 ]
 
+github_project_url = "https://github.com/jupyter/jupyter_core"
+
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
 
@@ -291,4 +294,4 @@ texinfo_documents = [
 
 
 # Example configuration for intersphinx: refer to the Python standard library.
-intersphinx_mapping = {'https://docs.python.org/': None}
+intersphinx_mapping = {'https://docs.python.org/3/': None}
diff --git a/docs/requirements.txt b/docs/requirements.txt
index aaad383..a8d7a62 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -1 +1,2 @@
 traitlets>=4.0
+sphinxcontrib_github_alt
diff --git a/examples/completions-zsh b/examples/completions-zsh
index f8476df..bbfeb78 100644
--- a/examples/completions-zsh
+++ b/examples/completions-zsh
@@ -186,7 +186,7 @@ _notebook_cmds() {
     'help:Print help about subcommand.'
     'list:List currently running notebook servers in this profile.'
   )
-  _describe -t commands 'nbextension command' commands "$@"
+  _describe -t commands 'notebook command' commands "$@"
 }
 
 _jupyter "$@"
diff --git a/jupyter_core/application.py b/jupyter_core/application.py
index f5d3dfb..e3fcef7 100644
--- a/jupyter_core/application.py
+++ b/jupyter_core/application.py
@@ -31,7 +31,7 @@ from traitlets.config.application import Application, catch_config_error
 from traitlets.config.loader import ConfigFileNotFound
 from traitlets import Unicode, Bool, List
 
-from ipython_genutils.path import ensure_dir_exists
+from .utils import ensure_dir_exists
 from ipython_genutils import py3compat
 
 from .paths import (
@@ -160,10 +160,9 @@ class JupyterApp(Application):
             return
 
         from .migrate import get_ipython_dir, migrate
-        
-        ipdir = get_ipython_dir()
+
         # No IPython dir, nothing to migrate
-        if not os.path.exists(ipdir):
+        if not os.path.exists(get_ipython_dir()):
             return
 
         migrate()
diff --git a/jupyter_core/migrate.py b/jupyter_core/migrate.py
index 302f4a5..d8f9f4a 100644
--- a/jupyter_core/migrate.py
+++ b/jupyter_core/migrate.py
@@ -30,16 +30,7 @@ from datetime import datetime
 from traitlets.config import PyFileConfigLoader, JSONFileConfigLoader
 from traitlets.log import get_logger
 
-from ipython_genutils.path import ensure_dir_exists
-try:
-    from IPython.paths import get_ipython_dir
-except ImportError:
-    # IPython < 4
-    try:
-        from IPython.utils.path import get_ipython_dir
-    except ImportError:
-        def get_ipython_dir():
-            return os.environ.get('IPYTHONDIR', os.path.expanduser('~/.ipython'))
+from .utils import ensure_dir_exists
 
 from .paths import jupyter_config_dir, jupyter_data_dir
 from .application import JupyterApp
@@ -72,6 +63,21 @@ config_substitutions = {
     regex(r'\bIPython\.nbconvert\b'): 'nbconvert',
 }
 
+
+def get_ipython_dir():
+    """Return the IPython directory location.
+
+    Not imported from IPython because the IPython implementation
+    ensures that a writable directory exists,
+    creating a temporary directory if not.
+    We don't want to trigger that when checking if migration should happen.
+
+    We only need to support the IPython < 4 behavior for migration,
+    so importing for forward-compatibility and edge cases is not important.
+    """
+    return os.environ.get('IPYTHONDIR', os.path.expanduser('~/.ipython'))
+
+
 def migrate_dir(src, dst):
     """Migrate a directory from src to dst"""
     log = get_logger()
diff --git a/jupyter_core/tests/test_command.py b/jupyter_core/tests/test_command.py
index f99d96b..dc29adf 100644
--- a/jupyter_core/tests/test_command.py
+++ b/jupyter_core/tests/test_command.py
@@ -27,6 +27,26 @@ def get_jupyter_output(cmd):
     return check_output([sys.executable, '-m', 'jupyter_core'] + cmd).decode('utf8').strip()
 
 
+def write_executable(path, source):
+    if sys.platform == 'win32':
+        script = path.dirpath() / path.purebasename + '-script.py'
+        exe = path.dirpath() / path.purebasename + '.exe'
+    else:
+        script = path
+
+    script.write(source)
+    script.chmod(0o700)
+
+    if sys.platform == 'win32':
+        try:
+            import pkg_resources
+            w = pkg_resources.resource_string('setuptools', 'cli-32.exe')
+        except (ImportError, FileNotFoundError):
+            pytest.skip('Need pkg_resources/setuptools to make scripts executable on Windows')
+        exe.write(w, 'wb')
+        exe.chmod(0o700)
+
+
 def assert_output(cmd, expected):
     assert get_jupyter_output(cmd) == expected
 
@@ -107,13 +127,17 @@ def test_not_on_path(tmpdir):
         'from jupyter_core import command; command.main()'
     )
     jupyter.chmod(0o700)
-    witness_cmd = 'jupyter-witness'
+    witness = a.join('jupyter-witness')
+    witness_src = '#!%s\n%s\n' % (sys.executable, 'print("WITNESS ME")')
+    write_executable(witness, witness_src)
+
+    env = {'PATH': ''}
+    if 'SYSTEMROOT' in os.environ:  # Windows http://bugs.python.org/issue20614
+        env[str('SYSTEMROOT')] = os.environ['SYSTEMROOT']
     if sys.platform == 'win32':
-        witness_cmd += '.py'
-    witness = a.join(witness_cmd)
-    witness.write('#!%s\n%s\n' % (sys.executable, 'print("WITNESS ME")'))
-    witness.chmod(0o700)
-    out = check_output([sys.executable, str(jupyter), 'witness'], env={'PATH': ''})
+        env[str('PATHEXT')] = '.EXE'
+    # This won't work on windows unless
+    out = check_output([sys.executable, str(jupyter), 'witness'], env=env)
     assert b'WITNESS' in out
 
 
@@ -124,17 +148,19 @@ def test_path_priority(tmpdir):
         'from jupyter_core import command; command.main()'
     )
     jupyter.chmod(0o700)
-    witness_cmd = 'jupyter-witness'
-    if sys.platform == 'win32':
-        witness_cmd += '.py'
-    witness_a = a.join(witness_cmd)
-    witness_a.write('#!%s\n%s\n' % (sys.executable, 'print("WITNESS A")'))
-    witness_a.chmod(0o700)
+    witness_a = a.join('jupyter-witness')
+    witness_a_src = '#!%s\n%s\n' % (sys.executable, 'print("WITNESS A")')
+    write_executable(witness_a, witness_a_src)
 
     b = tmpdir.mkdir("b")
-    witness_b = b.join(witness_cmd)
-    witness_b.write('#!%s\n%s\n' % (sys.executable, 'print("WITNESS B")'))
-    witness_b.chmod(0o700)
+    witness_b = b.join('jupyter-witness')
+    witness_b_src = '#!%s\n%s\n' % (sys.executable, 'print("WITNESS B")')
+    write_executable(witness_b, witness_b_src)
 
-    out = check_output([sys.executable, str(jupyter), 'witness'], env={'PATH': str(b)})
+    env = {'PATH':  str(b)}
+    if 'SYSTEMROOT' in os.environ:  # Windows http://bugs.python.org/issue20614
+        env[str('SYSTEMROOT')] = os.environ['SYSTEMROOT']
+    if sys.platform == 'win32':
+        env[str('PATHEXT')] = '.EXE'
+    out = check_output([sys.executable, str(jupyter), 'witness'], env=env)
     assert b'WITNESS A' in out
diff --git a/jupyter_core/tests/test_migrate.py b/jupyter_core/tests/test_migrate.py
index dab55d3..5c565b6 100644
--- a/jupyter_core/tests/test_migrate.py
+++ b/jupyter_core/tests/test_migrate.py
@@ -15,11 +15,7 @@ except ImportError:
 
 import pytest
 
-from ipython_genutils.path import ensure_dir_exists
-try:
-    from IPython.paths import locate_profile
-except ImportError:
-    from IPython.utils.path import locate_profile
+from jupyter_core.utils import ensure_dir_exists
 
 from jupyter_core.paths import jupyter_data_dir
 from jupyter_core.migrate import (
diff --git a/jupyter_core/troubleshoot.py b/jupyter_core/troubleshoot.py
index 6e909a6..6bd9810 100755
--- a/jupyter_core/troubleshoot.py
+++ b/jupyter_core/troubleshoot.py
@@ -45,7 +45,7 @@ def get_data():
     else:
         env['which'] = subs(['which', '-a', 'jupyter'])
         env['where'] = None
-    env['pip'] = subs(['pip', 'list'])
+    env['pip'] = subs([sys.executable, '-m', 'pip', 'list'])
     env['conda'] = subs(['conda', 'list'])
     return env
 
diff --git a/jupyter_core/utils/__init__.py b/jupyter_core/utils/__init__.py
index e69de29..353aaff 100644
--- a/jupyter_core/utils/__init__.py
+++ b/jupyter_core/utils/__init__.py
@@ -0,0 +1,18 @@
+import errno
+import os
+
+def ensure_dir_exists(path, mode=0o777):
+    """ensure that a directory exists
+
+    If it doesn't exist, try to create it, protecting against a race condition
+    if another process is doing the same.
+
+    The default permissions are determined by the current umask.
+    """
+    try:
+        os.makedirs(path, mode=mode)
+    except OSError as e:
+        if e.errno != errno.EEXIST:
+            raise
+    if not os.path.isdir(path):
+        raise IOError("%r exists but is not a directory" % path)
diff --git a/jupyter_core/version.py b/jupyter_core/version.py
index 9885d6a..4125b17 100644
--- a/jupyter_core/version.py
+++ b/jupyter_core/version.py
@@ -1,6 +1,6 @@
 # Copyright (c) Jupyter Development Team.
 # Distributed under the terms of the Modified BSD License.
 
-version_info = (4, 3, 0)
+version_info = (4, 4, 0)
 
 __version__ = '.'.join(map(str, version_info))
diff --git a/setup.py b/setup.py
index f041234..5015fe2 100644
--- a/setup.py
+++ b/setup.py
@@ -58,7 +58,7 @@ setup_args = dict(
     long_description    = """There is no reason to install this package on its own.""",
     author              = "Jupyter Development Team",
     author_email        = "jupyter at googlegroups.org",
-    url                 = "http://jupyter.org",
+    url                 = "https://jupyter.org",
     license             = "BSD",
     classifiers         = [
         'Intended Audience :: Developers',

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/jupyter-core.git



More information about the Python-modules-commits mailing list