Skip to content

Commit 0cd322f

Browse files
committed
Merge pull request #167 from Zsailer/0.2.1
[WIP] Release 0.2.1 with backports.
2 parents 5502b66 + 5df6742 commit 0cd322f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+4262
-4775
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010

11+
## [0.2.1] - 2020-1-10
12+
13+
### Added
14+
15+
- **pytest-plugin** for Jupyter Server.
16+
- Allows one to write async/await syntax in tests functions.
17+
- Some particularly useful fixtures include:
18+
- `serverapp`: a default ServerApp instance that handles setup+teardown.
19+
- `configurable_serverapp`: a function that returns a ServerApp instance.
20+
- `fetch`: an awaitable function that tests makes requests to the server API
21+
- `create_notebook`: a function that writes a notebook to a given temporary file path.
22+
1123
## [0.2.0] - 2019-12-19
1224

1325
### Added

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,23 @@ You can find the installation documentation for the
2121
The documentation for advanced usage of Jupyter notebook can be found
2222
[here](https://jupyter-server.readthedocs.io/en/latest/).
2323

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

2727
$ pip install jupyter_server
2828

29+
### Versioning and Branches
30+
31+
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.
32+
33+
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.
34+
35+
To see the changes between releases, checkout the [CHANGELOG](https://github.com/jupyter/jupyter_server/blob/master/CHANGELOG.md).
36+
37+
To install the latest patch of a given version:
38+
39+
$ pip install jupyter_server>=0.2
40+
2941
## Usage - Running Jupyter Server
3042

3143
### Running in a local installation

appveyor.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ environment:
2121
platform:
2222
- x64
2323

24-
build: off
24+
build: false
2525

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

4040
test_script:
41-
- pytest
41+
- pytest -s -v

jupyter_server/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
"""The Jupyter Server"""
22

3-
from ._version import version_info, __version__
43
import os
54

65
DEFAULT_STATIC_FILES_PATH = os.path.join(os.path.dirname(__file__), "static")
76
DEFAULT_TEMPLATE_PATH_LIST = [
87
os.path.dirname(__file__),
9-
os.path.join(os.path.dirname(__file__), "templates"),
8+
os.path.join(os.path.dirname(__file__), 'templates'),
109
]
1110

1211
del os
12+
13+
from ._version import version_info, __version__

jupyter_server/__main__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import absolute_import
22

3-
if __name__ == "__main__":
3+
if __name__ == '__main__':
44
from jupyter_server import serverapp as app
5-
65
app.launch_new_instance()

jupyter_server/_sysinfo.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import jupyter_server
2020

21-
2221
def pkg_commit_hash(pkg_path):
2322
"""Get short form of commit hash given directory `pkg_path`
2423
@@ -46,25 +45,23 @@ def pkg_commit_hash(pkg_path):
4645
par_path = pkg_path
4746
while cur_path != par_path:
4847
cur_path = par_path
49-
if p.exists(p.join(cur_path, ".git")):
48+
if p.exists(p.join(cur_path, '.git')):
5049
try:
51-
proc = subprocess.Popen(
52-
["git", "rev-parse", "--short", "HEAD"],
53-
stdout=subprocess.PIPE,
54-
stderr=subprocess.PIPE,
55-
cwd=pkg_path,
56-
)
50+
proc = subprocess.Popen(['git', 'rev-parse', '--short', 'HEAD'],
51+
stdout=subprocess.PIPE,
52+
stderr=subprocess.PIPE,
53+
cwd=pkg_path)
5754
repo_commit, _ = proc.communicate()
5855
except OSError:
5956
repo_commit = None
6057

6158
if repo_commit:
62-
return "repository", repo_commit.strip().decode("ascii")
59+
return 'repository', repo_commit.strip().decode('ascii')
6360
else:
64-
return u"", u""
61+
return u'', u''
6562
par_path = p.dirname(par_path)
66-
67-
return u"", u""
63+
64+
return u'', u''
6865

6966

7067
def pkg_info(pkg_path):
@@ -92,11 +89,11 @@ def pkg_info(pkg_path):
9289
platform=platform.platform(),
9390
os_name=os.name,
9491
default_encoding=encoding.DEFAULT_ENCODING,
95-
)
96-
92+
)
9793

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

jupyter_server/_tz.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# constant for zero offset
1414
ZERO = timedelta(0)
1515

16-
1716
class tzUTC(tzinfo):
1817
"""tzinfo object for UTC (zero offset)"""
1918

@@ -23,27 +22,21 @@ def utcoffset(self, d):
2322
def dst(self, d):
2423
return ZERO
2524

26-
2725
UTC = tzUTC()
2826

29-
3027
def utc_aware(unaware):
3128
"""decorator for adding UTC tzinfo to datetime's utcfoo methods"""
32-
3329
def utc_method(*args, **kwargs):
3430
dt = unaware(*args, **kwargs)
3531
return dt.replace(tzinfo=UTC)
36-
3732
return utc_method
3833

39-
4034
utcfromtimestamp = utc_aware(datetime.utcfromtimestamp)
4135
utcnow = utc_aware(datetime.utcnow)
4236

43-
4437
def isoformat(dt):
4538
"""Return iso-formatted timestamp
46-
39+
4740
Like .isoformat(), but uses Z for UTC instead of +00:00
4841
"""
49-
return dt.isoformat().replace("+00:00", "Z")
42+
return dt.isoformat().replace('+00:00', 'Z')

jupyter_server/_version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99

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

12-
version_info = (0, 2, 0, "")
13-
__version__ = ".".join(map(str, version_info[:3])) + "".join(version_info[3:])
12+
version_info = (0, 2, 1, '')
13+
__version__ = '.'.join(map(str, version_info[:3])) + ''.join(version_info[3:])

jupyter_server/auth/__main__.py

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,38 @@
55
import argparse
66
import sys
77

8-
98
def set_password(args):
10-
password = args.password
11-
while not password:
12-
password1 = getpass("" if args.quiet else "Provide password: ")
13-
password_repeat = getpass("" if args.quiet else "Repeat password: ")
14-
if password1 != password_repeat:
15-
print("Passwords do not match, try again")
16-
elif len(password1) < 4:
17-
print("Please provide at least 4 characters")
18-
else:
19-
password = password1
20-
21-
password_hash = passwd(password)
22-
cfg = BaseJSONConfigManager(config_dir=jupyter_config_dir())
23-
cfg.update("jupyter_server_config", {"ServerApp": {"password": password_hash,}})
24-
if not args.quiet:
25-
print("password stored in config dir: %s" % jupyter_config_dir())
9+
password = args.password
10+
while not password :
11+
password1 = getpass("" if args.quiet else "Provide password: ")
12+
password_repeat = getpass("" if args.quiet else "Repeat password: ")
13+
if password1 != password_repeat:
14+
print("Passwords do not match, try again")
15+
elif len(password1) < 4:
16+
print("Please provide at least 4 characters")
17+
else:
18+
password = password1
2619

20+
password_hash = passwd(password)
21+
cfg = BaseJSONConfigManager(config_dir=jupyter_config_dir())
22+
cfg.update('jupyter_server_config', {
23+
'ServerApp': {
24+
'password': password_hash,
25+
}
26+
})
27+
if not args.quiet:
28+
print("password stored in config dir: %s" % jupyter_config_dir())
2729

2830
def main(argv):
29-
parser = argparse.ArgumentParser(argv[0])
30-
subparsers = parser.add_subparsers()
31-
parser_password = subparsers.add_parser(
32-
"password", help="sets a password for your jupyter server"
33-
)
34-
parser_password.add_argument(
35-
"password",
36-
help="password to set, if not given, a password will be queried for (NOTE: this may not be safe)",
37-
nargs="?",
38-
)
39-
parser_password.add_argument(
40-
"--quiet", help="suppress messages", action="store_true"
41-
)
42-
parser_password.set_defaults(function=set_password)
43-
args = parser.parse_args(argv[1:])
44-
args.function(args)
45-
46-
31+
parser = argparse.ArgumentParser(argv[0])
32+
subparsers = parser.add_subparsers()
33+
parser_password = subparsers.add_parser('password', help='sets a password for your jupyter server')
34+
parser_password.add_argument("password", help="password to set, if not given, a password will be queried for (NOTE: this may not be safe)",
35+
nargs="?")
36+
parser_password.add_argument("--quiet", help="suppress messages", action="store_true")
37+
parser_password.set_defaults(function=set_password)
38+
args = parser.parse_args(argv[1:])
39+
args.function(args)
40+
4741
if __name__ == "__main__":
48-
main(sys.argv)
42+
main(sys.argv)

0 commit comments

Comments
 (0)