Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into telemetry_client
Browse files Browse the repository at this point in the history
  • Loading branch information
kiendang committed May 3, 2021
2 parents c67401d + 678878f commit e15dd9b
Show file tree
Hide file tree
Showing 14 changed files with 236 additions and 485 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/check-release.yml
@@ -0,0 +1,47 @@
name: Check Release
on:
push:
branches: ["master"]
pull_request:
branches: ["*"]

jobs:
check_release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: 3.9
architecture: "x64"
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache pip
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-pip-
- name: Cache checked links
uses: actions/cache@v2
with:
path: ~/.cache/pytest-link-check
key: ${{ runner.os }}-linkcheck-${{ hashFiles('**/.md') }}-md-links
restore-keys: |
${{ runner.os }}-linkcheck-
- name: Upgrade packaging dependencies
run: |
pip install --upgrade pip setuptools wheel --user
- name: Install Dependencies
run: |
pip install -e .
- name: Check Release
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
10 changes: 0 additions & 10 deletions .github/workflows/python-linux.yml
Expand Up @@ -74,13 +74,3 @@ jobs:
pushd test_install
./bin/pytest --pyargs jupyter_server
popd
- name: Check the Manifest
run: |
pip install check-manifest
git clean -dfx
check-manifest -v
- name: Check Version Bump
run: |
pip install tbump
tbump --non-interactive --only-patch 100.1.1
git checkout .
33 changes: 32 additions & 1 deletion CHANGELOG.md
Expand Up @@ -2,6 +2,38 @@

All notable changes to this project will be documented in this file.

<!-- <START NEW CHANGELOG ENTRY> -->

## 1.7.0a0

([Full Changelog](https://github.com/jupyter-server/jupyter_server/compare/v1.6.4...afae85a7bb8c45f7610cd38b60d6075bb623490b))

### Bugs fixed

- Fix for recursive symlink - (port Notebook 4670) [#497](https://github.com/jupyter-server/jupyter_server/pull/497) ([@kevin-bates](https://github.com/kevin-bates))

### Maintenance and upkeep improvements

- Prep for Release Helper Usage [#494](https://github.com/jupyter-server/jupyter_server/pull/494) ([@jtpio](https://github.com/jtpio))
- Typo in shutdown with answer_yes [#491](https://github.com/jupyter-server/jupyter_server/pull/491) ([@kiendang](https://github.com/kiendang))
- Remove some of ipython_genutils no-op. [#440](https://github.com/jupyter-server/jupyter_server/pull/440) ([@Carreau](https://github.com/Carreau))

### Documentation improvements

- DOC: Autoreformat docstrings. [#493](https://github.com/jupyter-server/jupyter_server/pull/493) ([@Carreau](https://github.com/Carreau))

### Other merged PRs

- Add Appropriate Token Permission for CodeQL Workflow [#489](https://github.com/jupyter-server/jupyter_server/pull/489) ([@afshin](https://github.com/afshin))

### Contributors to this release

([GitHub contributors page for this release](https://github.com/jupyter-server/jupyter_server/graphs/contributors?from=2021-04-21&to=2021-05-01&type=c))

[@afshin](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Aafshin+updated%3A2021-04-21..2021-05-01&type=Issues) | [@blink1073](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Ablink1073+updated%3A2021-04-21..2021-05-01&type=Issues) | [@Carreau](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3ACarreau+updated%3A2021-04-21..2021-05-01&type=Issues) | [@codecov-commenter](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Acodecov-commenter+updated%3A2021-04-21..2021-05-01&type=Issues) | [@jtpio](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Ajtpio+updated%3A2021-04-21..2021-05-01&type=Issues) | [@kevin-bates](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Akevin-bates+updated%3A2021-04-21..2021-05-01&type=Issues) | [@kiendang](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Akiendang+updated%3A2021-04-21..2021-05-01&type=Issues)

<!-- <END NEW CHANGELOG ENTRY> -->

## 1.6.4

([Full Changelog](https://github.com/jupyter-server/jupyter_server/compare/v1.6.3...68a64ea13be5d0d86460f04e0c47eb0b6662a0af))
Expand Down Expand Up @@ -31,7 +63,6 @@ All notable changes to this project will be documented in this file.

[@kevin-bates](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Akevin-bates+updated%3A2021-04-16..2021-04-21&type=Issues)


## 1.6.2

### Enhancements made
Expand Down
9 changes: 5 additions & 4 deletions MANIFEST.in
Expand Up @@ -28,7 +28,8 @@ prune docs/dist
global-exclude *~
global-exclude *.pyc
global-exclude *.pyo
global-exclude .git
global-exclude .ipynb_checkpoints
global-exclude .pytest_cache
global-exclude .coverage
prune .git
prune **/.ipynb_checkpoints
prune **/.pytest_cache
prune **/.coverage
prune **/.pytest_cache
34 changes: 23 additions & 11 deletions RELEASE.md
@@ -1,36 +1,48 @@
# Making a Jupyter Server Release
To create a release, perform the following steps...

## Set up
```
## Using `jupyter_releaser`

The recommended way to make a release is to use [`jupyter_releaser`](https://github.com/jupyter-server/jupyter_releaser#checklist-for-adoption).

## Manual Release

To create a manual release, perform the following steps:

### Set up

```bash
pip install tbump twine build
git pull origin $(git branch --show-current)
git clean -dffx
```

## Update the version and apply the tag
```
### Update the version and apply the tag

```bash
echo "Enter new version"
read script_version
tbump ${script_version}
```

## Build the artifacts
```
### Build the artifacts

```bash
rm -rf dist
python -m build .
```

## Update the version back to dev
```
### Update the version back to dev

```bash
echo "Enter dev version"
read dev_version
tbump ${dev_version} --no-tag
git push origin $(git branch --show-current)
```

## Publish the artifacts to pypi
```
### Publish the artifacts to pypi

```bash
twine check dist/*
twine upload dist/*
```
2 changes: 1 addition & 1 deletion jupyter_server/_version.py
Expand Up @@ -5,5 +5,5 @@
from jupyter_packaging import get_version_info

# Version string must appear intact for tbump versioning
__version__ = '1.7.0.dev0'
__version__ = '1.8.0.dev0'
version_info = get_version_info(__version__)
13 changes: 9 additions & 4 deletions jupyter_server/services/contents/filecheckpoints.py
Expand Up @@ -14,7 +14,12 @@
)
from .fileio import AsyncFileManagerMixin, FileManagerMixin

from anyio import run_sync_in_worker_thread
try:
from anyio.to_thread import run_sync
except ImportError:
# fallback on anyio v2 for python version < 3.7
from anyio import run_sync_in_worker_thread as run_sync

from jupyter_core.utils import ensure_dir_exists
from traitlets import Unicode

Expand Down Expand Up @@ -156,7 +161,7 @@ async def restore_checkpoint(self, contents_mgr, checkpoint_id, path):

async def checkpoint_model(self, checkpoint_id, os_path):
"""construct the info dict for a given checkpoint"""
stats = await run_sync_in_worker_thread(os.stat, os_path)
stats = await run_sync(os.stat, os_path)
last_modified = tz.utcfromtimestamp(stats.st_mtime)
info = dict(
id=checkpoint_id,
Expand All @@ -176,7 +181,7 @@ async def rename_checkpoint(self, checkpoint_id, old_path, new_path):
new_cp_path,
)
with self.perm_to_403():
await run_sync_in_worker_thread(shutil.move, old_cp_path, new_cp_path)
await run_sync(shutil.move, old_cp_path, new_cp_path)

async def delete_checkpoint(self, checkpoint_id, path):
"""delete a file's checkpoint"""
Expand All @@ -187,7 +192,7 @@ async def delete_checkpoint(self, checkpoint_id, path):

self.log.debug("unlinking %s", cp_path)
with self.perm_to_403():
await run_sync_in_worker_thread(os.unlink, cp_path)
await run_sync(os.unlink, cp_path)

async def list_checkpoints(self, path):
"""list the checkpoints for a given file
Expand Down
21 changes: 13 additions & 8 deletions jupyter_server/services/contents/fileio.py
Expand Up @@ -12,7 +12,12 @@
import os
import shutil

from anyio import run_sync_in_worker_thread
try:
from anyio.to_thread import run_sync
except ImportError:
# fallback on anyio v2 for python version < 3.7
from anyio import run_sync_in_worker_thread as run_sync

from tornado.web import HTTPError

from jupyter_server.utils import (
Expand All @@ -36,7 +41,7 @@ def replace_file(src, dst):
async def async_replace_file(src, dst):
""" replace dst with src asynchronously
"""
await run_sync_in_worker_thread(os.replace, src, dst)
await run_sync(os.replace, src, dst)

def copy2_safe(src, dst, log=None):
"""copy src to dst
Expand All @@ -55,9 +60,9 @@ async def async_copy2_safe(src, dst, log=None):
like shutil.copy2, but log errors in copystat instead of raising
"""
await run_sync_in_worker_thread(shutil.copyfile, src, dst)
await run_sync(shutil.copyfile, src, dst)
try:
await run_sync_in_worker_thread(shutil.copystat, src, dst)
await run_sync(shutil.copystat, src, dst)
except OSError:
if log:
log.debug("copystat on %s failed", dst, exc_info=True)
Expand Down Expand Up @@ -355,7 +360,7 @@ async def _read_notebook(self, os_path, as_version=4):
"""Read a notebook from an os path."""
with self.open(os_path, 'r', encoding='utf-8') as f:
try:
return await run_sync_in_worker_thread(partial(nbformat.read, as_version=as_version), f)
return await run_sync(partial(nbformat.read, as_version=as_version), f)
except Exception as e:
e_orig = e

Expand All @@ -379,7 +384,7 @@ async def _read_notebook(self, os_path, as_version=4):
async def _save_notebook(self, os_path, nb):
"""Save a notebook to an os_path."""
with self.atomic_writing(os_path, encoding='utf-8') as f:
await run_sync_in_worker_thread(partial(nbformat.write, version=nbformat.NO_CONVERT), nb, f)
await run_sync(partial(nbformat.write, version=nbformat.NO_CONVERT), nb, f)

async def _read_file(self, os_path, format):
"""Read a non-notebook file.
Expand All @@ -394,7 +399,7 @@ async def _read_file(self, os_path, format):
raise HTTPError(400, "Cannot read non-file %s" % os_path)

with self.open(os_path, 'rb') as f:
bcontent = await run_sync_in_worker_thread(f.read)
bcontent = await run_sync(f.read)

if format is None or format == 'text':
# Try to interpret as unicode if format is unknown or if unicode
Expand Down Expand Up @@ -429,4 +434,4 @@ async def _save_file(self, os_path, content, format):
) from e

with self.atomic_writing(os_path, text=False) as f:
await run_sync_in_worker_thread(f.write, bcontent)
await run_sync(f.write, bcontent)

0 comments on commit e15dd9b

Please sign in to comment.