Skip to content

[WIP] Release 0.2.1 with backports. #167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 10, 2020
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
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]


## [0.2.0] - 2019-12-19

### Added

- **pytest-plugin** for Jupyter Server.
- Allows one to write async/await syntax in tests functions.
- Some particularly useful fixtures include:
- `serverapp`: a default ServerApp instance that handles setup+teardown.
- `configurable_serverapp`: a function that returns a ServerApp instance.
- `fetch`: an awaitable function that tests makes requests to the server API
- `create_notebook`: a function that writes a notebook to a given temporary file path.

## [0.2.0] - 2019-12-19

### Added
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,23 @@ You can find the installation documentation for the
The documentation for advanced usage of Jupyter notebook can be found
[here](https://jupyter-server.readthedocs.io/en/latest/).

For a local installation, make sure you have
To install the latest release locally, make sure you have
[pip installed](https://pip.readthedocs.io/en/stable/installing/) and run:

$ pip install jupyter_server

### Versioning and Branches

If Jupyter Server is a dependency of your project/application, it is important that you pin it to a version that works for your application. Currently, Jupyter Server only has minor and patch versions. Different minor versions likely include API-changes while patch versions do not change API.

When a new minor version in released on PyPI, a branch for that version will be created in this repository, and the version of the master branch will be bumped to the next minor version number. That way, the master branch always reflects the latest un-released version.

To see the changes between releases, checkout the [CHANGELOG](https://github.com/jupyter/jupyter_server/blob/master/CHANGELOG.md).

To install the latest patch of a given version:

$ pip install jupyter_server>=0.2

## Usage - Running Jupyter Server

### Running in a local installation
Expand Down
8 changes: 4 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ environment:
platform:
- x64

build: off
build: false

install:
- cmd: call %CONDA_INSTALL_LOCN%\Scripts\activate.bat
Expand All @@ -31,11 +31,11 @@ install:
- cmd: conda config --add channels conda-forge
- cmd: conda update --yes --quiet conda
- cmd: conda info -a
- cmd: conda create -y -q -n test-env-%CONDA_PY% python=%CONDA_PY_SPEC% pyzmq tornado jupyter_client nbformat nbconvert ipykernel pip nose
- cmd: conda create -y -q -n test-env-%CONDA_PY% python=%CONDA_PY_SPEC% pip pyzmq tornado jupyter_client nbformat nbconvert nose
- cmd: conda activate test-env-%CONDA_PY%
- cmd: pip install .[test]
- cmd: pip install -e .[test]
# FIXME: Use patch for python 3.8, windows issues (https://github.com/ipython/ipykernel/pull/456) - remove once released
- IF %CONDA_PY% == 38 pip install --upgrade git+https://github.com/ipython/ipykernel.git

test_script:
- pytest
- pytest -s -v
5 changes: 3 additions & 2 deletions jupyter_server/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
"""The Jupyter Server"""

from ._version import version_info, __version__
import os

DEFAULT_STATIC_FILES_PATH = os.path.join(os.path.dirname(__file__), "static")
DEFAULT_TEMPLATE_PATH_LIST = [
os.path.dirname(__file__),
os.path.join(os.path.dirname(__file__), "templates"),
os.path.join(os.path.dirname(__file__), 'templates'),
]

del os

from ._version import version_info, __version__
3 changes: 1 addition & 2 deletions jupyter_server/__main__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import absolute_import

if __name__ == "__main__":
if __name__ == '__main__':
from jupyter_server import serverapp as app

app.launch_new_instance()
25 changes: 11 additions & 14 deletions jupyter_server/_sysinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import jupyter_server


def pkg_commit_hash(pkg_path):
"""Get short form of commit hash given directory `pkg_path`

Expand Down Expand Up @@ -46,25 +45,23 @@ def pkg_commit_hash(pkg_path):
par_path = pkg_path
while cur_path != par_path:
cur_path = par_path
if p.exists(p.join(cur_path, ".git")):
if p.exists(p.join(cur_path, '.git')):
try:
proc = subprocess.Popen(
["git", "rev-parse", "--short", "HEAD"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
cwd=pkg_path,
)
proc = subprocess.Popen(['git', 'rev-parse', '--short', 'HEAD'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
cwd=pkg_path)
repo_commit, _ = proc.communicate()
except OSError:
repo_commit = None

if repo_commit:
return "repository", repo_commit.strip().decode("ascii")
return 'repository', repo_commit.strip().decode('ascii')
else:
return u"", u""
return u'', u''
par_path = p.dirname(par_path)

return u"", u""
return u'', u''


def pkg_info(pkg_path):
Expand Down Expand Up @@ -92,11 +89,11 @@ def pkg_info(pkg_path):
platform=platform.platform(),
os_name=os.name,
default_encoding=encoding.DEFAULT_ENCODING,
)

)

def get_sys_info():
"""Return useful information about the system as a dict."""
p = os.path
path = p.realpath(p.dirname(p.abspath(p.join(jupyter_server.__file__))))
return pkg_info(path)

11 changes: 2 additions & 9 deletions jupyter_server/_tz.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# constant for zero offset
ZERO = timedelta(0)


class tzUTC(tzinfo):
"""tzinfo object for UTC (zero offset)"""

Expand All @@ -23,27 +22,21 @@ def utcoffset(self, d):
def dst(self, d):
return ZERO


UTC = tzUTC()


def utc_aware(unaware):
"""decorator for adding UTC tzinfo to datetime's utcfoo methods"""

def utc_method(*args, **kwargs):
dt = unaware(*args, **kwargs)
return dt.replace(tzinfo=UTC)

return utc_method


utcfromtimestamp = utc_aware(datetime.utcfromtimestamp)
utcnow = utc_aware(datetime.utcnow)


def isoformat(dt):
"""Return iso-formatted timestamp

Like .isoformat(), but uses Z for UTC instead of +00:00
"""
return dt.isoformat().replace("+00:00", "Z")
return dt.isoformat().replace('+00:00', 'Z')
4 changes: 2 additions & 2 deletions jupyter_server/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@

# Next beta/alpha/rc release: The version number for beta is X.Y.ZbN **without dots**.

version_info = (0, 2, 0, "")
__version__ = ".".join(map(str, version_info[:3])) + "".join(version_info[3:])
version_info = (0, 2, 1, '')
__version__ = '.'.join(map(str, version_info[:3])) + ''.join(version_info[3:])
66 changes: 30 additions & 36 deletions jupyter_server/auth/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,38 @@
import argparse
import sys


def set_password(args):
password = args.password
while not password:
password1 = getpass("" if args.quiet else "Provide password: ")
password_repeat = getpass("" if args.quiet else "Repeat password: ")
if password1 != password_repeat:
print("Passwords do not match, try again")
elif len(password1) < 4:
print("Please provide at least 4 characters")
else:
password = password1

password_hash = passwd(password)
cfg = BaseJSONConfigManager(config_dir=jupyter_config_dir())
cfg.update("jupyter_server_config", {"ServerApp": {"password": password_hash,}})
if not args.quiet:
print("password stored in config dir: %s" % jupyter_config_dir())
password = args.password
while not password :
password1 = getpass("" if args.quiet else "Provide password: ")
password_repeat = getpass("" if args.quiet else "Repeat password: ")
if password1 != password_repeat:
print("Passwords do not match, try again")
elif len(password1) < 4:
print("Please provide at least 4 characters")
else:
password = password1

password_hash = passwd(password)
cfg = BaseJSONConfigManager(config_dir=jupyter_config_dir())
cfg.update('jupyter_server_config', {
'ServerApp': {
'password': password_hash,
}
})
if not args.quiet:
print("password stored in config dir: %s" % jupyter_config_dir())

def main(argv):
parser = argparse.ArgumentParser(argv[0])
subparsers = parser.add_subparsers()
parser_password = subparsers.add_parser(
"password", help="sets a password for your jupyter server"
)
parser_password.add_argument(
"password",
help="password to set, if not given, a password will be queried for (NOTE: this may not be safe)",
nargs="?",
)
parser_password.add_argument(
"--quiet", help="suppress messages", action="store_true"
)
parser_password.set_defaults(function=set_password)
args = parser.parse_args(argv[1:])
args.function(args)


parser = argparse.ArgumentParser(argv[0])
subparsers = parser.add_subparsers()
parser_password = subparsers.add_parser('password', help='sets a password for your jupyter server')
parser_password.add_argument("password", help="password to set, if not given, a password will be queried for (NOTE: this may not be safe)",
nargs="?")
parser_password.add_argument("--quiet", help="suppress messages", action="store_true")
parser_password.set_defaults(function=set_password)
args = parser.parse_args(argv[1:])
args.function(args)

if __name__ == "__main__":
main(sys.argv)
main(sys.argv)
Loading