From 15333f1c56fc0a2f7cfb715eee47a7844d6430c3 Mon Sep 17 00:00:00 2001 From: Simon Li Date: Mon, 3 Jan 2022 12:59:08 +0000 Subject: [PATCH 01/63] Depend on jupyter-server only --- nbgitpuller/__init__.py | 2 +- nbgitpuller/handlers.py | 10 +++++----- setup.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/nbgitpuller/__init__.py b/nbgitpuller/__init__.py index b5941286..03900ff6 100644 --- a/nbgitpuller/__init__.py +++ b/nbgitpuller/__init__.py @@ -1,7 +1,7 @@ from .version import __version__ # noqa from .handlers import SyncHandler, UIHandler, LegacyInteractRedirectHandler, LegacyGitSyncRedirectHandler from .pull import GitPuller # noqa -from notebook.utils import url_path_join +from jupyter_server.utils import url_path_join from tornado.web import StaticFileHandler import os diff --git a/nbgitpuller/handlers.py b/nbgitpuller/handlers.py index f83ad7d5..611ce757 100644 --- a/nbgitpuller/handlers.py +++ b/nbgitpuller/handlers.py @@ -2,7 +2,7 @@ import traceback import urllib.parse -from notebook.base.handlers import IPythonHandler +from jupyter_server.base.handlers import JupyterHandler import threading import json import os @@ -13,7 +13,7 @@ from .version import __version__ -class SyncHandler(IPythonHandler): +class SyncHandler(JupyterHandler): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -129,7 +129,7 @@ def pull(): self.git_lock.release() -class UIHandler(IPythonHandler): +class UIHandler(JupyterHandler): def initialize(self): super().initialize() # FIXME: Is this really the best way to use jinja2 here? @@ -179,7 +179,7 @@ def get(self): self.flush() -class LegacyGitSyncRedirectHandler(IPythonHandler): +class LegacyGitSyncRedirectHandler(JupyterHandler): @web.authenticated @gen.coroutine def get(self): @@ -190,7 +190,7 @@ def get(self): self.redirect(new_url) -class LegacyInteractRedirectHandler(IPythonHandler): +class LegacyInteractRedirectHandler(JupyterHandler): @web.authenticated @gen.coroutine def get(self): diff --git a/setup.py b/setup.py index 3efef420..c7bad826 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ packages=find_packages(), include_package_data=True, platforms='any', - install_requires=['notebook>=5.5.0', 'jupyter_server>=1.10.1', 'tornado'], + install_requires=['jupyter_server>=1.10.1', 'tornado'], data_files=[ ('etc/jupyter/jupyter_server_config.d', ['nbgitpuller/etc/jupyter_server_config.d/nbgitpuller.json']), ('etc/jupyter/jupyter_notebook_config.d', ['nbgitpuller/etc/jupyter_notebook_config.d/nbgitpuller.json']) From 626eb5414850a7587fcfa06ef550019966695b96 Mon Sep 17 00:00:00 2001 From: Simon Li Date: Mon, 3 Jan 2022 13:11:12 +0000 Subject: [PATCH 02/63] Change Description to Jupyter instead of Notebook --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c7bad826..32fb0347 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ author='Peter Veerman, YuviPanda', author_email='peterkangveerman@gmail.com', cmdclass=cmdclass, - description='Notebook Extension to do one-way synchronization of git repositories', + description='Jupyter Extension to do one-way synchronization of git repositories', long_description=open('README.md').read(), long_description_content_type='text/markdown', packages=find_packages(), From da51f9887280395d804f9ad6c1a0724f5c1157f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=B0=BD=ED=99=98?= Date: Wed, 4 Jan 2023 22:27:24 +0900 Subject: [PATCH 03/63] Fix test exception branch exists --- tests/test_gitpuller.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_gitpuller.py b/tests/test_gitpuller.py index b4d742aa..4da2505d 100644 --- a/tests/test_gitpuller.py +++ b/tests/test_gitpuller.py @@ -88,11 +88,15 @@ def test_exception_branch_exists(): with Remote() as remote, Pusher(remote) as pusher: pusher.push_file('README.md', '1') with Puller(remote) as puller: + exception_raised = False orig_url = puller.gp.git_url + puller.gp.git_url = "" try: puller.gp.branch_exists("wrong") except Exception as e: + exception_raised = True assert type(e) == ValueError + assert exception_raised puller.gp.git_url = orig_url From cfb19d7c3680582975660e446caeedd14078e9f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=B0=BD=ED=99=98?= Date: Thu, 5 Jan 2023 09:06:43 +0900 Subject: [PATCH 04/63] Introduce pytest.raises for test_exception_branch_exists --- tests/test_gitpuller.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/tests/test_gitpuller.py b/tests/test_gitpuller.py index 4da2505d..11c0e2f7 100644 --- a/tests/test_gitpuller.py +++ b/tests/test_gitpuller.py @@ -88,17 +88,11 @@ def test_exception_branch_exists(): with Remote() as remote, Pusher(remote) as pusher: pusher.push_file('README.md', '1') with Puller(remote) as puller: - exception_raised = False - orig_url = puller.gp.git_url - puller.gp.git_url = "" - try: + with pytest.raises(ValueError): + orig_url = puller.gp.git_url + puller.gp.git_url = "" puller.gp.branch_exists("wrong") - except Exception as e: - exception_raised = True - assert type(e) == ValueError - assert exception_raised - puller.gp.git_url = orig_url - + puller.gp.git_url = orig_url def test_resolve_default_branch(): with Remote() as remote, Pusher(remote) as pusher: From 1d513d47be6248867940af11535ddcddf698b1eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=B0=BD=ED=99=98?= Date: Thu, 5 Jan 2023 13:35:42 +0900 Subject: [PATCH 05/63] Change ValueError to sp.CalledProcessError --- tests/test_gitpuller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_gitpuller.py b/tests/test_gitpuller.py index 11c0e2f7..02f7c2cc 100644 --- a/tests/test_gitpuller.py +++ b/tests/test_gitpuller.py @@ -88,7 +88,7 @@ def test_exception_branch_exists(): with Remote() as remote, Pusher(remote) as pusher: pusher.push_file('README.md', '1') with Puller(remote) as puller: - with pytest.raises(ValueError): + with pytest.raises(sp.CalledProcessError): orig_url = puller.gp.git_url puller.gp.git_url = "" puller.gp.branch_exists("wrong") From 0a8b8c8dc094aefd75e0513768502c086952f2c6 Mon Sep 17 00:00:00 2001 From: Min RK Date: Tue, 4 Apr 2023 10:46:18 +0200 Subject: [PATCH 06/63] migrate docs to RTD --- .github/workflows/docs.yml | 28 ---------------------------- .readthedocs.yaml | 17 +++++++++++++++++ README.md | 12 +++++++----- 3 files changed, 24 insertions(+), 33 deletions(-) create mode 100644 .readthedocs.yaml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 287696db..d005fff1 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -39,31 +39,3 @@ jobs: run: | cd docs make linkcheck - - build-and-publish: - runs-on: ubuntu-22.04 - - permissions: - # required to push to the gh-pages branch - contents: write - - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: "3.11" - - - name: Install dependencies - run: | - pip install -r docs/doc-requirements.txt - - - name: make html (Builds documentation) - run: | - cd docs - make html - - - name: Publish to GitHub Pages - if: github.ref == 'refs/heads/main' - run: | - pip install ghp-import - ghp-import --no-jekyll --push --message "Update documentation [skip ci]" docs/_build/html diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 00000000..b165d7e5 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,17 @@ +# Configuration on how ReadTheDocs (RTD) builds our documentation +# ref: https://readthedocs.org/projects/nbgitpuller/ +# ref: https://docs.readthedocs.io/en/stable/config-file/v2.html +# +version: 2 + +sphinx: + configuration: docs/conf.py + +build: + os: ubuntu-20.04 + tools: + python: "3.10" + +python: + install: + - requirements: docs/doc-requirements.txt diff --git a/README.md b/README.md index da2a2575..f112fde2 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # [nbgitpuller](https://github.com/jupyterhub/nbgitpuller) [![GitHub Workflow Status - Test](https://img.shields.io/github/workflow/status/jupyterhub/nbgitpuller/Tests?logo=github&label=tests)](https://github.com/jupyterhub/nbgitpuller/actions) -[![CircleCI build status](https://img.shields.io/circleci/build/github/jupyterhub/nbgitpuller?logo=circleci&label=docs)](https://circleci.com/gh/jupyterhub/nbgitpuller) +[![Documentation Status](https://readthedocs.org/projects/nbgitpuller/badge/?version=latest)](https://nbgitpuller.readthedocs.io/en/latest/?badge=latest) [![](https://img.shields.io/pypi/v/nbgitpuller.svg?logo=pypi)](https://pypi.python.org/pypi/nbgitpuller) [![GitHub](https://img.shields.io/badge/issue_tracking-github-blue?logo=github)](https://github.com/jupyterhub/nbgitpuller/issues) [![Discourse](https://img.shields.io/badge/help_forum-discourse-blue?logo=discourse)](https://discourse.jupyter.org/c/jupyterhub) @@ -9,11 +9,11 @@ `nbgitpuller` lets you distribute content in a git repository to your students by having them click a simple link. [Automatic -merging](https://jupyterhub.github.io/nbgitpuller/topic/automatic-merging.html) +merging](https://nbgitpuller.readthedocs.io/topic/automatic-merging.html) ensures that your students are never exposed to `git` directly. It is primarily used with a JupyterHub, but can also work on students' local computers. -See [the documentation](https://jupyterhub.github.io/nbgitpuller) for more +See [the documentation](https://nbgitpuller.readthedocs.io) for more information. ## Installation @@ -24,10 +24,12 @@ pip install nbgitpuller ## Example -This example shows how to use the [nbgitpuller link generator](https://jupyterhub.github.io/nbgitpuller/link) +This example shows how to use the [nbgitpuller link generator] to create an nbgitpuller link, which a user then clicks. -1. The [nbgitpuller link generator GUI](https://jupyterhub.github.io/nbgitpuller/link) is used to create a +[nbgitpuller link generator]: https://nbgitpuller.readthedocs.io/link + +1. The nbgitpuller link generator GUI is used to create a link. ![](https://raw.githubusercontent.com/jupyterhub/nbgitpuller/9f380a933335f0f069b6e2f9965ed78c3abcce7a/docs/_static/nbgitpuller-link-generator.png) From eb431bb4ac93f091de3f649b2b7357cc212fedc3 Mon Sep 17 00:00:00 2001 From: Min RK Date: Tue, 4 Apr 2023 14:44:54 +0200 Subject: [PATCH 07/63] fix link generator for latest bootstrap updates HTML a bit, only loads main on the link page --- docs/_static/link_gen/link.js | 19 +++++++++--------- docs/conf.py | 2 +- docs/link.rst | 38 ++++++++++++++++++++--------------- 3 files changed, 32 insertions(+), 27 deletions(-) diff --git a/docs/_static/link_gen/link.js b/docs/_static/link_gen/link.js index f5e11e2d..ef67e1c4 100644 --- a/docs/_static/link_gen/link.js +++ b/docs/_static/link_gen/link.js @@ -185,7 +185,7 @@ function displayLink() { hubUrl, urlPath, repoUrl, branch ); } else if (activeTab === "tab-auth-binder"){ - // FIXME: userName parsing using new URL(...) assumes a + // FIXME: userName parsing using new URL(...) assumes a // HTTP based repoUrl. Does it make sense to create a // BinderHub link for SSH URLs? Then let's fix this parsing. var userName = new URL(repoUrl).pathname.split('/')[1]; @@ -248,7 +248,7 @@ function render() { /** * Entry point */ -function main() { +function linkMain() { // Hook up any changes in form elements to call render() document.querySelectorAll('#linkgenerator input[type="radio"]').forEach( function (element) { @@ -265,16 +265,15 @@ function main() { // Activate tabs based on search parameters var params = new URL(window.location).searchParams; - if (params.get("tab")) { - if (params.get("tab") === "binder") { - $("#tab-auth-binder").click() - } else if (params.get("tab") === "canvas") { - $("#tab-auth-canvas").click() - } + switch(params.get("tab")) { + case "binder": + $("#tab-auth-binder").click(); + break; + case "canvas": + $("#tab-auth-canvas").click(); + break; } // Do an initial render, to make sure our disabled / enabled properties are correctly set render(); } - -window.onload = main; diff --git a/docs/conf.py b/docs/conf.py index baa0be9a..c21428a1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -53,7 +53,7 @@ def setup(app): # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = "en" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. diff --git a/docs/link.rst b/docs/link.rst index c7516897..6d33806f 100644 --- a/docs/link.rst +++ b/docs/link.rst @@ -18,35 +18,36 @@ Use the following form to create your own ``nbgitpuller`` links.
-
+
-
+
-
+
-
@@ -175,6 +176,11 @@ Use the following form to create your own ``nbgitpuller`` links.



+ + **Pre-populating some fields in the link generator** @@ -183,7 +189,7 @@ users to create their own links. To do so, use the following URL parameters **when accessing this page**: * ``hub`` is the URL of a JupyterHub -* ``repo`` is the URL of a github repository to which you're linking +* ``repo`` is the URL of a GitHub repository to which you're linking * ``branch`` is the branch you wish to pull from the Repository For example, the following URL will pre-populate the form with the @@ -195,7 +201,7 @@ UC Berkeley DataHub as the JupyterHub:: **Activating a tab when someone lands on this page** You can also activate one of the tabs in the form above by default when a user lands -on this page. To do so, use the ``tab=`` REST parameter. Here are the possible values: +on this page. To do so, use the ``tab=`` query parameter. Here are the possible values: * ``?tab=binder`` - activates the Binder tab -* ``?tab=canvas`` - activates the Canvas tab. +* ``?tab=canvas`` - activates the Canvas tab From 75853ac0dc1e2084e9bf8c6b21048b385dae8f81 Mon Sep 17 00:00:00 2001 From: Min RK Date: Tue, 4 Apr 2023 14:52:05 +0200 Subject: [PATCH 08/63] update internal links to link generator rather than using absolute URLs for an internal page --- docs/index.md | 4 +--- docs/link.rst | 2 +- docs/topic/url-options.rst | 6 +++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/docs/index.md b/docs/index.md index 799a7bab..e52903be 100644 --- a/docs/index.md +++ b/docs/index.md @@ -10,9 +10,7 @@ It is commonly used to distribute content to multiple users of a JupyterHub, tho Here's an example of `nbgitpuller` in action: -1. The [nbgitpuller link - generator](https://jupyterhub.github.io/nbgitpuller/link) is used to create a - link. +1. The [nbgitpuller link generator](link) is used to create a link. ```{image} _static/nbgitpuller-link-generator.png diff --git a/docs/link.rst b/docs/link.rst index 6d33806f..4252ab79 100644 --- a/docs/link.rst +++ b/docs/link.rst @@ -195,7 +195,7 @@ parameters **when accessing this page**: For example, the following URL will pre-populate the form with the UC Berkeley DataHub as the JupyterHub:: - https://jupyterhub.github.io/nbgitpuller/link?hub=https://datahub.berkeley.edu + https://nbgitpuller.readthedocs.io/link.html?hub=https://datahub.berkeley.edu **Activating a tab when someone lands on this page** diff --git a/docs/topic/url-options.rst b/docs/topic/url-options.rst index 200d3be1..7a6a0f5b 100644 --- a/docs/topic/url-options.rst +++ b/docs/topic/url-options.rst @@ -7,7 +7,7 @@ Options in an nbgitpuller URL .. note:: If you just want to generate an nbgitpuller link, we highly - recommend just using the `link generator `_ + recommend just using the :doc:`link generator <../link>` Most aspects of the nbgitpuller student experience can be configured with various options in the nbgitpuller URL. This page documents @@ -41,12 +41,12 @@ the file to be opened in. the local repository directory too, otherwise nbgitpuller can not find the file. - For example, if the repository you are cloning is + For example, if the repository you are cloning is ``https://github.com/my-user/my-repository``, and the file you want your students to see is ``index.ipynb``, then ```` should be ``my-repository/index.ipynb``, **not** ``index.ipynb``. - The `link generator `_ + The :doc:`link generator <../link>` takes care of all of this for you, so it is recommended to use that. From 92fc28a9c0192f6ae47fbba0093b9e363f7adca7 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Tue, 4 Apr 2023 22:55:50 +0200 Subject: [PATCH 09/63] dependabot: monthly updates of github actions --- .github/dependabot.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index 731b0aa6..c3ea9a00 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -8,8 +8,9 @@ version: 2 updates: # Maintain dependencies in our GitHub Workflows - package-ecosystem: github-actions - directory: "/" + directory: / + labels: [ci] schedule: interval: monthly time: "05:00" - timezone: "Etc/UTC" + timezone: Etc/UTC From d2cadc99b0875a74ec510d244056a3b7ee678bfa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Apr 2023 13:58:10 +0000 Subject: [PATCH 10/63] Bump pypa/gh-action-pypi-publish from 1.8.1 to 1.8.5 Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.8.1 to 1.8.5. - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.8.1...v1.8.5) --- updated-dependencies: - dependency-name: pypa/gh-action-pypi-publish dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 04485db9..5d693a9a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -43,7 +43,7 @@ jobs: ls -l dist - name: publish to pypi - uses: pypa/gh-action-pypi-publish@v1.8.1 + uses: pypa/gh-action-pypi-publish@v1.8.5 if: startsWith(github.ref, 'refs/tags/') with: user: __token__ From 577ed99a8f8d323c563b2d0eae947815436bed9b Mon Sep 17 00:00:00 2001 From: Min RK Date: Tue, 11 Apr 2023 10:24:56 +0200 Subject: [PATCH 11/63] avoid deprecation warnings in test_api teardown replaces nose-style teardown with a fixture --- pyproject.toml | 5 + tests/test_api.py | 261 +++++++++++++++++++++++++--------------------- 2 files changed, 148 insertions(+), 118 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3c871fce..e7467386 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,3 +41,8 @@ target_version = [ "py310", "py311", ] + +[tool.pytest.ini_options] +markers = [ + "jupyter_server: configure the jupyter_server fixture" +] diff --git a/tests/test_api.py b/tests/test_api.py index 3622bb6c..2cda6330 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -1,8 +1,8 @@ import os from http.client import HTTPConnection import subprocess -from time import sleep -from urllib.parse import quote +import time +from urllib.parse import urlencode from uuid import uuid4 import pytest @@ -12,127 +12,152 @@ def request_api(params, host='localhost'): + query_args = {"token": "secret"} + query_args.update(params) + query = urlencode(query_args) + url = f'/git-pull/api?{query}' h = HTTPConnection(host, PORT, 10) - query = '&'.join('{}={}'.format(k, quote(v)) for (k, v) in params.items()) - url = '/git-pull/api?token=secret&{}'.format(query) h.request('GET', url) return h.getresponse() +def wait_for_server(host='localhost', port=PORT, timeout=10): + """Wait for an HTTP server to be responsive""" + t = 0.1 + deadline = time.monotonic() + timeout + while time.monotonic() < deadline: + try: + h = HTTPConnection(host, port, 10) + h.request("GET", "/") + r = h.getresponse() + except Exception as e: + print(f"Server not ready: {e}") + time.sleep(t) + t *= 2 + t = min(t, 1) + else: + # success + return + assert False, f"Server never showed up at http://{host}:{port}" -class TestNbGitPullerApi: - def setup(self): - self.jupyter_proc = None +@pytest.fixture +def jupyterdir(tmpdir): + path = tmpdir.join("jupyter") + path.mkdir() + return str(path) - def teardown(self): - if self.jupyter_proc: - self.jupyter_proc.kill() - def start_jupyter(self, jupyterdir, extraenv, backend_type): - env = os.environ.copy() - env.update(extraenv) - if "server" in backend_type: - command = [ - 'jupyter-server', - '--NotebookApp.token=secret', - '--port={}'.format(PORT), - ] - else: - command = [ - 'jupyter-notebook', - '--no-browser', - '--NotebookApp.token=secret', - '--port={}'.format(PORT), - ] - self.jupyter_proc = subprocess.Popen(command, cwd=jupyterdir, env=env) - sleep(2) - - @pytest.mark.parametrize( - "backend_type", - [ - ("jupyter-server"), - ("jupyter-notebook"), - ], - ) - def test_clone_default(self, tmpdir, backend_type): - """ - Tests use of 'repo' and 'branch' parameters. - """ - jupyterdir = str(tmpdir) - self.start_jupyter(jupyterdir, {}, backend_type) - - with Remote() as remote, Pusher(remote) as pusher: - pusher.push_file('README.md', 'Testing some content') - print(f'path: {remote.path}') - params = { - 'repo': remote.path, - 'branch': 'master', - } - r = request_api(params) - assert r.code == 200 - s = r.read().decode() - print(s) - target_path = os.path.join(jupyterdir, os.path.basename(remote.path)) - assert '--branch master' in s - assert f"Cloning into '{target_path}" in s - assert os.path.isdir(os.path.join(target_path, '.git')) - - @pytest.mark.parametrize( - "backend_type", - [ - ("jupyter-server"), - ("jupyter-notebook"), - ], - ) - def test_clone_targetpath(self, tmpdir, backend_type): - """ - Tests use of 'targetpath' parameter. - """ - jupyterdir = str(tmpdir) - target = str(uuid4()) - self.start_jupyter(jupyterdir, {}, backend_type) - with Remote() as remote, Pusher(remote) as pusher: - pusher.push_file('README.md', 'Testing some content') - params = { - 'repo': remote.path, - 'branch': 'master', - 'targetpath': target, - } - r = request_api(params) - assert r.code == 200 - s = r.read().decode() - print(s) - target_path = os.path.join(jupyterdir, target) - assert f"Cloning into '{target_path}" in s - assert os.path.isdir(os.path.join(target_path, '.git')) - - @pytest.mark.parametrize( - "backend_type", - [ - ("jupyter-server"), - ("jupyter-notebook"), - ], - ) - def test_clone_parenttargetpath(self, tmpdir, backend_type): - """ - Tests use of the NBGITPULLER_PARENTPATH environment variable. - """ - jupyterdir = str(tmpdir) - parent = str(uuid4()) - target = str(uuid4()) - self.start_jupyter(jupyterdir, {'NBGITPULLER_PARENTPATH': parent}, backend_type) - - with Remote() as remote, Pusher(remote) as pusher: - pusher.push_file('README.md', 'Testing some content') - params = { - 'repo': remote.path, - 'branch': 'master', - 'targetpath': target, - } - r = request_api(params) - assert r.code == 200 - s = r.read().decode() - print(s) - target_path = os.path.join(jupyterdir, parent, target) - assert f"Cloning into '{target_path}" in s - assert os.path.isdir(os.path.join(target_path, '.git')) +@pytest.fixture(params=["jupyter-server", "jupyter-notebook"]) +def jupyter_server(request, tmpdir, jupyterdir): + # allow passing extra_env via @pytest.mark.jupyter_server(extra_env={"key": "value"}) + if "jupyter_server" in request.keywords: + extra_env = request.keywords["jupyter_server"].kwargs.get("extra_env") + else: + extra_env = None + + backend_type = request.param + + env = os.environ.copy() + # avoid interacting with user configuration, state + env["JUPYTER_CONFIG_DIR"] = str(tmpdir / "dotjupyter") + env["JUPYTER_RUNTIME_DIR"] = str(tmpdir / "runjupyter") + + if extra_env: + env.update(extra_env) + + if backend_type == "jupyter-server": + command = [ + 'jupyter-server', + '--ServerApp.token=secret', + '--port={}'.format(PORT), + ] + extension_command = ["jupyter", "server", "extension"] + elif backend_type == "jupyter-notebook": + command = [ + 'jupyter-notebook', + '--no-browser', + '--NotebookApp.token=secret', + '--port={}'.format(PORT), + ] + extension_command = ["jupyter", "serverextension"] + else: + raise ValueError( + f"backend_type must be 'jupyter-server' or 'jupyter-notebook' not {backend_type!r}" + ) + + # enable the extension + subprocess.check_call(extension_command + ["enable", "nbgitpuller"], env=env) + + # launch the server + jupyter_proc = subprocess.Popen(command, cwd=jupyterdir, env=env) + wait_for_server() + + with jupyter_proc: + yield jupyter_proc + jupyter_proc.terminate() + + +def test_clone_default(jupyterdir, jupyter_server): + """ + Tests use of 'repo' and 'branch' parameters. + """ + with Remote() as remote, Pusher(remote) as pusher: + pusher.push_file('README.md', 'Testing some content') + print(f'path: {remote.path}') + params = { + 'repo': remote.path, + 'branch': 'master', + } + r = request_api(params) + assert r.code == 200 + s = r.read().decode() + print(s) + target_path = os.path.join(jupyterdir, os.path.basename(remote.path)) + assert '--branch master' in s + assert f"Cloning into '{target_path}" in s + assert os.path.isdir(os.path.join(target_path, '.git')) + + +def test_clone_targetpath(jupyterdir, jupyter_server): + """ + Tests use of 'targetpath' parameter. + """ + target = str(uuid4()) + with Remote() as remote, Pusher(remote) as pusher: + pusher.push_file('README.md', 'Testing some content') + params = { + 'repo': remote.path, + 'branch': 'master', + 'targetpath': target, + } + r = request_api(params) + assert r.code == 200 + s = r.read().decode() + print(s) + target_path = os.path.join(jupyterdir, target) + assert f"Cloning into '{target_path}" in s + assert os.path.isdir(os.path.join(target_path, '.git')) + + +@pytest.mark.jupyter_server(extra_env={'NBGITPULLER_PARENTPATH': "parent"}) +def test_clone_parenttargetpath(jupyterdir, start_jupyter): + """ + Tests use of the NBGITPULLER_PARENTPATH environment variable. + """ + parent = "parent" + target = str(uuid4()) + + with Remote() as remote, Pusher(remote) as pusher: + pusher.push_file('README.md', 'Testing some content') + params = { + 'repo': remote.path, + 'branch': 'master', + 'targetpath': target, + } + r = request_api(params) + assert r.code == 200 + s = r.read().decode() + print(s) + target_path = os.path.join(jupyterdir, parent, target) + assert f"Cloning into '{target_path}" in s + assert os.path.isdir(os.path.join(target_path, '.git')) From 10bc7535bfd6e5fb0323fd2ae55efc1deac066a7 Mon Sep 17 00:00:00 2001 From: Min RK Date: Tue, 11 Apr 2023 11:24:15 +0200 Subject: [PATCH 12/63] use new fixture in test_clone_parenttargetpath --- tests/test_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_api.py b/tests/test_api.py index 2cda6330..55172ca9 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -140,7 +140,7 @@ def test_clone_targetpath(jupyterdir, jupyter_server): @pytest.mark.jupyter_server(extra_env={'NBGITPULLER_PARENTPATH': "parent"}) -def test_clone_parenttargetpath(jupyterdir, start_jupyter): +def test_clone_parenttargetpath(jupyterdir, jupyter_server): """ Tests use of the NBGITPULLER_PARENTPATH environment variable. """ From 0d2a512d37dd6c0976ec45d554a20136c56c1633 Mon Sep 17 00:00:00 2001 From: Min RK Date: Tue, 11 Apr 2023 11:26:57 +0200 Subject: [PATCH 13/63] show git version in tests helps debug possible changes in behavior --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d8112c7b..d821e236 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,6 +38,9 @@ jobs: with: node-version: "${{ matrix.node-version }}" + - name: git version + run: git --version + - name: Run webpack to build static assets run: | npm install From f8ebaf79f488359d3c8c32e8b0d39c1e5f27e56f Mon Sep 17 00:00:00 2001 From: Min RK Date: Tue, 11 Apr 2023 11:53:21 +0200 Subject: [PATCH 14/63] fix handling of deleted-but-not-staged files with git 2.40 --- nbgitpuller/pull.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/nbgitpuller/pull.py b/nbgitpuller/pull.py index dd085e64..f5a7dab1 100644 --- a/nbgitpuller/pull.py +++ b/nbgitpuller/pull.py @@ -170,8 +170,18 @@ def reset_deleted_files(self): upstream_deleted = self.find_upstream_changed('D') for filename in deleted_files: - # Filter out empty lines, and files that were deleted in the remote - if filename and filename not in upstream_deleted: + if not filename: + # filter out empty lines + continue + + if filename in upstream_deleted: + # deleted in _both_, avoid conflict with git 2.40 by checking it out + # even though it's just about to be deleted + yield from execute_cmd( + ['git', 'checkout', 'HEAD', '--', filename], cwd=self.repo_dir + ) + else: + # not deleted in upstream, restore with checkout yield from execute_cmd(['git', 'checkout', 'origin/{}'.format(self.branch_name), '--', filename], cwd=self.repo_dir) def repo_is_dirty(self): From ad8a01232c477f95ef3f1949cbcc6dc631842c3e Mon Sep 17 00:00:00 2001 From: Min RK Date: Tue, 11 Apr 2023 12:29:09 +0200 Subject: [PATCH 15/63] add git version to test matrix install with micromamba --- .github/workflows/test.yml | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d821e236..fcb54e4d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,20 +26,42 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] - node-version: ["16"] + include: + - python-version: "3.7" + - python-version: "3.8" + # 2.17 is in ubuntu 18.04 + git-version: "2.17" + - python-version: "3.9" + # 2.25 is in ubuntu 20.04 + git-version: "2.25" + - python-version: "3.10" + # 2.34 is in ubuntu 22.04 + git-version: "2.34" + - python-version: "3.11" steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: python-version: "${{ matrix.python-version }}" + - uses: actions/setup-node@v3 with: - node-version: "${{ matrix.node-version }}" + node-version: "${{ matrix.node-version || '16'}}" + + - name: install git ${{ matrix.git-version }} + if: ${{ matrix.git-version }} + run: | + export MAMBA_ROOT_PREFIX=$/tmp/conda + mkdir -p $MAMBA_ROOT_PREFIX/bin + curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/1.4.2 | tar -xvj -C $MAMBA_ROOT_PREFIX/bin/ --strip-components=1 bin/micromamba + $MAMBA_ROOT_PREFIX/bin/micromamba install -c conda-forge -p $MAMBA_ROOT_PREFIX "git=${{ matrix.git-version }}" + echo "PATH=$MAMBA_ROOT_PREFIX/bin:$PATH" >> $GITHUB_ENV - name: git version - run: git --version + run: | + which git + git --version - name: Run webpack to build static assets run: | From dab62e91fada1068ef4a6a06769ec3a9977f0408 Mon Sep 17 00:00:00 2001 From: Min RK Date: Tue, 11 Apr 2023 12:45:53 +0200 Subject: [PATCH 16/63] handle initial-branch arg added in git 2.28 --- .github/workflows/test.yml | 2 +- dev-requirements.txt | 1 + tests/repohelpers.py | 10 +++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fcb54e4d..9602cc57 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -76,4 +76,4 @@ jobs: - name: Run tests run: | - pytest --verbose --maxfail=2 --color=yes --cov nbgitpuller + pytest --verbose --maxfail=2 --color=yes --cov nbgitpuller tests diff --git a/dev-requirements.txt b/dev-requirements.txt index 03baf1b9..bdf678f1 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,5 @@ jupyter-packaging>=0.10 nbclassic +packaging pytest pytest-cov diff --git a/tests/repohelpers.py b/tests/repohelpers.py index 2052bcf2..98bfd110 100644 --- a/tests/repohelpers.py +++ b/tests/repohelpers.py @@ -7,6 +7,7 @@ import subprocess as sp from uuid import uuid4 +from packaging.version import Version as V from nbgitpuller import GitPuller @@ -18,7 +19,14 @@ def __init__(self, path=None): def __enter__(self): os.makedirs(self.path, exist_ok=True) - self.git('init', '--bare', '--initial-branch=master') + + # --initial-branch added in git 2.28 + git_version = self.git("--version").split()[-1] + if V(git_version) >= V("2.28"): + extra_args = ('--initial-branch=master',) + else: + extra_args = () + self.git('init', '--bare', *extra_args) return self def __exit__(self, *args): From 55da2945aa66b5d062576f982cbfb1a4b818e911 Mon Sep 17 00:00:00 2001 From: Min RK Date: Tue, 11 Apr 2023 16:00:09 +0200 Subject: [PATCH 17/63] fix width of link generator form full-width overflows by the width of the sidebar on the opposite side --- docs/link.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/link.rst b/docs/link.rst index 4252ab79..14836faa 100644 --- a/docs/link.rst +++ b/docs/link.rst @@ -12,7 +12,7 @@ Use the following form to create your own ``nbgitpuller`` links. .. raw:: html -
+
From 88a59513679cc7bbb9b2723805b3c798a03e51c2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 2 May 2023 04:26:42 +0000 Subject: [PATCH 18/63] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/mirrors-prettier: v3.0.0-alpha.6 → v3.0.0-alpha.9-for-vscode](https://github.com/pre-commit/mirrors-prettier/compare/v3.0.0-alpha.6...v3.0.0-alpha.9-for-vscode) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c14893ff..e42936dd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -45,7 +45,7 @@ repos: # Autoformat: markdown, yaml, javascript (see the file .prettierignore) - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.0-alpha.6 + rev: v3.0.0-alpha.9-for-vscode hooks: - id: prettier # FIXME: Autoformatting of our .js files is initially not enabled as it From 5d93247a515177933f03fc86014bcfb600487bb7 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 22 May 2023 14:44:31 -0700 Subject: [PATCH 19/63] Update README.md Link generator 404s --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f112fde2..32af5ac5 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ pip install nbgitpuller This example shows how to use the [nbgitpuller link generator] to create an nbgitpuller link, which a user then clicks. -[nbgitpuller link generator]: https://nbgitpuller.readthedocs.io/link +[nbgitpuller link generator]: https://nbgitpuller.readthedocs.io/en/latest/link.html 1. The nbgitpuller link generator GUI is used to create a link. From 385c300f91739465526fb68ea849055603604b2e Mon Sep 17 00:00:00 2001 From: Min RK Date: Tue, 23 May 2023 10:57:03 +0200 Subject: [PATCH 20/63] tests still require legacy notebook --- dev-requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/dev-requirements.txt b/dev-requirements.txt index bdf678f1..0a8b925e 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,5 +1,6 @@ jupyter-packaging>=0.10 nbclassic +notebook>=5.5,<7 packaging pytest pytest-cov From f230919bbfe7951647de1d5823553ddfc5575e4f Mon Sep 17 00:00:00 2001 From: Min RK Date: Tue, 23 May 2023 11:02:19 +0200 Subject: [PATCH 21/63] verify rejected auth as well --- tests/test_api.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/test_api.py b/tests/test_api.py index 55172ca9..d5cb1c31 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -118,6 +118,23 @@ def test_clone_default(jupyterdir, jupyter_server): assert os.path.isdir(os.path.join(target_path, '.git')) +def test_clone_auth(jupyterdir, jupyter_server): + """ + Tests use of 'repo' and 'branch' parameters. + """ + with Remote() as remote, Pusher(remote) as pusher: + pusher.push_file('README.md', 'Testing some content') + print(f'path: {remote.path}') + params = { + 'repo': remote.path, + 'branch': 'master', + 'token': 'wrong', + } + r = request_api(params) + # no token, redirect to login + assert r.code == 302 + + def test_clone_targetpath(jupyterdir, jupyter_server): """ Tests use of 'targetpath' parameter. From bb2e7bd5ea518dba53422dff505660823a6ba253 Mon Sep 17 00:00:00 2001 From: Min RK Date: Tue, 23 May 2023 14:10:39 +0200 Subject: [PATCH 22/63] select base JupyterHandler according to application implementation --- nbgitpuller/__init__.py | 14 +++++++++++++- nbgitpuller/_compat.py | 40 ++++++++++++++++++++++++++++++++++++++++ nbgitpuller/handlers.py | 4 +++- 3 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 nbgitpuller/_compat.py diff --git a/nbgitpuller/__init__.py b/nbgitpuller/__init__.py index 16888814..47973f96 100644 --- a/nbgitpuller/__init__.py +++ b/nbgitpuller/__init__.py @@ -1,5 +1,4 @@ from .version import __version__ # noqa -from .handlers import SyncHandler, UIHandler, LegacyInteractRedirectHandler, LegacyGitSyncRedirectHandler from .pull import GitPuller # noqa from jupyter_server.utils import url_path_join from tornado.web import StaticFileHandler @@ -33,6 +32,19 @@ def _load_jupyter_server_extension(app): - notebook: https://jupyter-notebook.readthedocs.io/en/stable/examples/Notebook/Distributing%20Jupyter%20Extensions%20as%20Python%20Packages.html#Example---Server-extension - jupyter_server: https://jupyter-server.readthedocs.io/en/latest/developers/extensions.html """ + # identify base handler by app class + # must do this before importing from .handlers + from ._compat import get_base_handler + + get_base_handler(app) + + from .handlers import ( + SyncHandler, + UIHandler, + LegacyInteractRedirectHandler, + LegacyGitSyncRedirectHandler, + ) + web_app = app.web_app base_url = url_path_join(web_app.settings['base_url'], 'git-pull') handlers = [ diff --git a/nbgitpuller/_compat.py b/nbgitpuller/_compat.py new file mode 100644 index 00000000..036967c9 --- /dev/null +++ b/nbgitpuller/_compat.py @@ -0,0 +1,40 @@ +"""Import base Handler classes from Jupyter Server or Notebook + +Must be called before importing .handlers to ensure the correct base classes +""" +import warnings + +_JupyterHandler = None + + +def get_base_handler(app=None): + """Get the base JupyterHandler class to use + + Inferred from app class (either jupyter_server or notebook app) + """ + global _JupyterHandler + if _JupyterHandler is not None: + return _JupyterHandler + if app is None: + warnings.warn( + "Guessing base JupyterHandler class. Specify an app to ensure the right JupyterHandler is used.", + stacklevel=2, + ) + from jupyter_server.base.handlers import JupyterHandler + return JupyterHandler + + top_modules = {cls.__module__.split(".", 1)[0] for cls in app.__class__.mro()} + if "jupyter_server" in top_modules: + from jupyter_server.base.handlers import JupyterHandler + + _JupyterHandler = JupyterHandler + return _JupyterHandler + if "notebook" in top_modules: + from notebook.base.handlers import IPythonHandler + + _JupyterHandler = IPythonHandler + return _JupyterHandler + + warnings.warn(f"Failed to detect base JupyterHandler class for {app}.", stacklevel=2) + from jupyter_server.base.handlers import JupyterHandler + return JupyterHandler diff --git a/nbgitpuller/handlers.py b/nbgitpuller/handlers.py index 1fa36ba6..2e572768 100644 --- a/nbgitpuller/handlers.py +++ b/nbgitpuller/handlers.py @@ -2,7 +2,6 @@ import traceback import urllib.parse -from jupyter_server.base.handlers import JupyterHandler import threading import json import os @@ -11,6 +10,9 @@ from .pull import GitPuller from .version import __version__ +from ._compat import get_base_handler + +JupyterHandler = get_base_handler() jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader( From 5230731580a1ed1e3c9eff8ec5be8e10dd2c706b Mon Sep 17 00:00:00 2001 From: Michael Soule Date: Wed, 24 May 2023 14:53:05 -0700 Subject: [PATCH 23/63] Ref #307 addition of named server support --- docs/_static/link_gen/link.js | 12 +++++++++--- docs/link.rst | 11 +++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/docs/_static/link_gen/link.js b/docs/_static/link_gen/link.js index ef67e1c4..d5166117 100644 --- a/docs/_static/link_gen/link.js +++ b/docs/_static/link_gen/link.js @@ -1,5 +1,5 @@ // Pure function that generates an nbgitpuller URL -function generateRegularUrl(hubUrl, urlPath, repoUrl, branch) { +function generateRegularUrl(hubUrl, serverPath, urlPath, repoUrl, branch) { // assume hubUrl is a valid URL var url = new URL(hubUrl); @@ -17,7 +17,12 @@ function generateRegularUrl(hubUrl, urlPath, repoUrl, branch) { if (!url.pathname.endsWith('/')) { url.pathname += '/' } - url.pathname += 'hub/user-redirect/git-pull'; + + if (serverPath) { + url.pathname += 'hub/user-redirect/'+serverPath+'/git-pull'; + } else { + url.pathname += 'hub/user-redirect/git-pull'; + } return url.toString(); } @@ -160,6 +165,7 @@ function displayLink() { var contentRepoUrl = document.getElementById('content-repo').value; var contentRepoBranch = document.getElementById('content-branch').value; var filePath = document.getElementById('filepath').value; + var server = document.getElementById('server').value; var appName = form.querySelector('input[name="app"]:checked').value; var activeTab = document.querySelector(".nav-link.active").id; @@ -178,7 +184,7 @@ function displayLink() { if (activeTab === "tab-auth-default") { document.getElementById('default-link').value = generateRegularUrl( - hubUrl, urlPath, repoUrl, branch + hubUrl, server, urlPath, repoUrl, branch ); } else if (activeTab === "tab-auth-canvas"){ document.getElementById('canvas-link').value = generateCanvasUrl( diff --git a/docs/link.rst b/docs/link.rst index 14836faa..a1534f03 100644 --- a/docs/link.rst +++ b/docs/link.rst @@ -172,6 +172,17 @@ Use the following form to create your own ``nbgitpuller`` links.
+
+ +
+ + + Use for specific named server Jupyter server instance. + +
+
+



From 3fef41bff985d5a2a5178bdf8f74790659a5cb3f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Jun 2023 05:59:04 +0000 Subject: [PATCH 24/63] Bump pypa/gh-action-pypi-publish from 1.8.5 to 1.8.6 Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.8.5 to 1.8.6. - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.8.5...v1.8.6) --- updated-dependencies: - dependency-name: pypa/gh-action-pypi-publish dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5d693a9a..d15598f5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -43,7 +43,7 @@ jobs: ls -l dist - name: publish to pypi - uses: pypa/gh-action-pypi-publish@v1.8.5 + uses: pypa/gh-action-pypi-publish@v1.8.6 if: startsWith(github.ref, 'refs/tags/') with: user: __token__ From b393bfe11e1cda2bfa6aa7b7573bdc5a63b4bb7a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Jul 2023 05:54:08 +0000 Subject: [PATCH 25/63] Bump pypa/gh-action-pypi-publish from 1.8.6 to 1.8.7 Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.8.6 to 1.8.7. - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.8.6...v1.8.7) --- updated-dependencies: - dependency-name: pypa/gh-action-pypi-publish dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d15598f5..572f9397 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -43,7 +43,7 @@ jobs: ls -l dist - name: publish to pypi - uses: pypa/gh-action-pypi-publish@v1.8.6 + uses: pypa/gh-action-pypi-publish@v1.8.7 if: startsWith(github.ref, 'refs/tags/') with: user: __token__ From 848c71972c20f9cf0db5e8da35c2d25885bc88b9 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Sat, 1 Jul 2023 08:10:29 +0200 Subject: [PATCH 26/63] Apply suggestions from code review --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 572f9397..913129a3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -43,7 +43,7 @@ jobs: ls -l dist - name: publish to pypi - uses: pypa/gh-action-pypi-publish@v1.8.7 + uses: pypa/gh-action-pypi-publish@release/v1 if: startsWith(github.ref, 'refs/tags/') with: user: __token__ From d5de271f7645371c1f1c1d0cfc0563cfd67f814b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 1 Aug 2023 08:35:34 +0000 Subject: [PATCH 27/63] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/mirrors-prettier: v3.0.0-alpha.9-for-vscode → v3.0.0](https://github.com/pre-commit/mirrors-prettier/compare/v3.0.0-alpha.9-for-vscode...v3.0.0) - [github.com/PyCQA/flake8: 6.0.0 → 6.1.0](https://github.com/PyCQA/flake8/compare/6.0.0...6.1.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e42936dd..8c02759e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -45,7 +45,7 @@ repos: # Autoformat: markdown, yaml, javascript (see the file .prettierignore) - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.0-alpha.9-for-vscode + rev: v3.0.0 hooks: - id: prettier # FIXME: Autoformatting of our .js files is initially not enabled as it @@ -65,7 +65,7 @@ repos: # Linting: Python code (see the file .flake8) - repo: https://github.com/PyCQA/flake8 - rev: "6.0.0" + rev: "6.1.0" hooks: - id: flake8 From f9707bfceda14c46537f14cf020139f032a7ba3d Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Tue, 1 Aug 2023 08:48:18 +0200 Subject: [PATCH 28/63] Add changelog for 1.2.0 --- CHANGELOG.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a804ac0..adf780e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,48 @@ -## 1.0 +## 1.2 + +### 1.2.0 - 2023-08-04 + +([full changelog](https://github.com/jupyterhub/nbgitpuller/compare/1.1.1...1.2.0)) + +#### Enhancements made + +- Depend on jupyter-server only, compatibility with jupyter server >= 2, notebook < 7 [#240](https://github.com/jupyterhub/nbgitpuller/pull/240) ([@manics](https://github.com/manics), [@yuvipanda](https://github.com/yuvipanda), [@consideRatio](https://github.com/consideRatio), [@akhmerov](https://github.com/akhmerov), [@minrk](https://github.com/minrk), [@jtpio](https://github.com/jtpio)) + +#### Bugs fixed + +- fix handling of deleted-but-not-staged files with git 2.40 [#302](https://github.com/jupyterhub/nbgitpuller/pull/302) ([@minrk](https://github.com/minrk), [@consideRatio](https://github.com/consideRatio), [@yuvipanda](https://github.com/yuvipanda)) + +#### Maintenance and upkeep improvements + +- avoid deprecation warnings in test_api teardown [#301](https://github.com/jupyterhub/nbgitpuller/pull/301) ([@minrk](https://github.com/minrk), [@consideRatio](https://github.com/consideRatio), [@yuvipanda](https://github.com/yuvipanda)) +- redirect gh-pages to readthedocs [#298](https://github.com/jupyterhub/nbgitpuller/pull/298) ([@minrk](https://github.com/minrk), [@consideRatio](https://github.com/consideRatio)) +- migrate docs to RTD [#297](https://github.com/jupyterhub/nbgitpuller/pull/297) ([@minrk](https://github.com/minrk), [@consideRatio](https://github.com/consideRatio), [@yuvipanda](https://github.com/yuvipanda), [@frankier](https://github.com/frankier)) +- Bootstrap pre-commit config, add dependabot config, test py311 [#288](https://github.com/jupyterhub/nbgitpuller/pull/288) ([@consideRatio](https://github.com/consideRatio), [@yuvipanda](https://github.com/yuvipanda)) +- Fix test_exception_branch_exists [#287](https://github.com/jupyterhub/nbgitpuller/pull/287) ([@a3626a](https://github.com/a3626a), [@minrk](https://github.com/minrk), [@yuvipanda](https://github.com/yuvipanda)) +- Make tests work with different default branch, or different locale [#284](https://github.com/jupyterhub/nbgitpuller/pull/284) ([@jdmansour](https://github.com/jdmansour), [@yuvipanda](https://github.com/yuvipanda)) + +#### Documentation improvements -### 1.1.1 +- Link generator - support generating links for named servers [#309](https://github.com/jupyterhub/nbgitpuller/pull/309) ([@Snozzberries](https://github.com/Snozzberries), [@consideRatio](https://github.com/consideRatio)) +- Update README.md [#306](https://github.com/jupyterhub/nbgitpuller/pull/306) ([@Snozzberries](https://github.com/Snozzberries), [@yuvipanda](https://github.com/yuvipanda)) + +#### Continuous integration improvements + +- dependabot: monthly updates of github actions [#299](https://github.com/jupyterhub/nbgitpuller/pull/299) ([@consideRatio](https://github.com/consideRatio)) +- ci: relocate dependabot.yaml to correct location [#294](https://github.com/jupyterhub/nbgitpuller/pull/294) ([@consideRatio](https://github.com/consideRatio), [@yuvipanda](https://github.com/yuvipanda)) + +#### Contributors to this release + +The following people contributed discussions, new ideas, code and documentation contributions, and review. +See [our definition of contributors](https://github-activity.readthedocs.io/en/latest/#how-does-this-tool-define-contributions-in-the-reports). + +([GitHub contributors page for this release](https://github.com/jupyterhub/nbgitpuller/graphs/contributors?from=2022-11-08&to=2023-08-04&type=c)) + +@a3626a ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Aa3626a+updated%3A2022-11-08..2023-08-04&type=Issues)) | @akhmerov ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Aakhmerov+updated%3A2022-11-08..2023-08-04&type=Issues)) | @albertmichaelj ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Aalbertmichaelj+updated%3A2022-11-08..2023-08-04&type=Issues)) | @balajialg ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Abalajialg+updated%3A2022-11-08..2023-08-04&type=Issues)) | @consideRatio ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3AconsideRatio+updated%3A2022-11-08..2023-08-04&type=Issues)) | @frankier ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Afrankier+updated%3A2022-11-08..2023-08-04&type=Issues)) | @jdmansour ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Ajdmansour+updated%3A2022-11-08..2023-08-04&type=Issues)) | @jtpio ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Ajtpio+updated%3A2022-11-08..2023-08-04&type=Issues)) | @manics ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Amanics+updated%3A2022-11-08..2023-08-04&type=Issues)) | @minrk ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Aminrk+updated%3A2022-11-08..2023-08-04&type=Issues)) | @Snozzberries ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3ASnozzberries+updated%3A2022-11-08..2023-08-04&type=Issues)) | @yuvipanda ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Ayuvipanda+updated%3A2022-11-08..2023-08-04&type=Issues)) + +## 1.1 + +### 1.1.1 - 2022-11-08 ([full changelog](https://github.com/jupyterhub/nbgitpuller/compare/1.1.0...1.1.1)) @@ -13,7 +55,7 @@ - Deal with modify/delete conflicts [#269](https://github.com/jupyterhub/nbgitpuller/pull/269) ([@jdmansour](https://github.com/jdmansour)) - Fix regression: can't reset some files anymore [#264](https://github.com/jupyterhub/nbgitpuller/pull/264) ([@jdmansour](https://github.com/jdmansour)) -#### Other merged PRs +#### Maintenance and upkeep improvements - Modernize JS a little [#273](https://github.com/jupyterhub/nbgitpuller/pull/273) ([@yuvipanda](https://github.com/yuvipanda)) - Remove jquery dependency [#272](https://github.com/jupyterhub/nbgitpuller/pull/272) ([@yuvipanda](https://github.com/yuvipanda)) @@ -29,7 +71,7 @@ [@balajialg](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Abalajialg+updated%3A2022-03-19..2022-11-08&type=Issues) | [@consideRatio](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3AconsideRatio+updated%3A2022-03-19..2022-11-08&type=Issues) | [@farcila](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Afarcila+updated%3A2022-03-19..2022-11-08&type=Issues) | [@jdmansour](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Ajdmansour+updated%3A2022-03-19..2022-11-08&type=Issues) | [@yuvipanda](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Ayuvipanda+updated%3A2022-03-19..2022-11-08&type=Issues) -### 1.1.0 +### 1.1.0 - 2022-03-19 ([full changelog](https://github.com/jupyterhub/nbgitpuller/compare/1.0.2...1.1.0)) @@ -68,6 +110,8 @@ [@akhmerov](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Aakhmerov+updated%3A2021-09-02..2022-03-18&type=Issues) | [@brian-rose](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Abrian-rose+updated%3A2021-09-02..2022-03-18&type=Issues) | [@choldgraf](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Acholdgraf+updated%3A2021-09-02..2022-03-18&type=Issues) | [@consideRatio](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3AconsideRatio+updated%3A2021-09-02..2022-03-18&type=Issues) | [@jameshowison](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Ajameshowison+updated%3A2021-09-02..2022-03-18&type=Issues) | [@jdmansour](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Ajdmansour+updated%3A2021-09-02..2022-03-18&type=Issues) | [@manics](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Amanics+updated%3A2021-09-02..2022-03-18&type=Issues) | [@ryanlovett](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Aryanlovett+updated%3A2021-09-02..2022-03-18&type=Issues) | [@welcome](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Awelcome+updated%3A2021-09-02..2022-03-18&type=Issues) | [@yuvipanda](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Ayuvipanda+updated%3A2021-09-02..2022-03-18&type=Issues) | [@Zsailer](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3AZsailer+updated%3A2021-09-02..2022-03-18&type=Issues) +## 1.0 + ### 1.0.2 - 2021-09-03 A release to fix an issue that stopped us from publishing nbgitpuller on From a9feede57a2638ff6f985eee830d3df65eb55638 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Fri, 4 Aug 2023 15:29:39 +0200 Subject: [PATCH 29/63] docs: fix broken link --- docs/contributing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contributing.md b/docs/contributing.md index 85097105..c8acf96c 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -3,7 +3,7 @@ ## Setup nbgitpuller is a jupyter extension that works with both the -[classic Notebook Server](https://jupyter-notebook.readthedocs.io/en/stable/extending/handlers.html), +[classic Notebook Server](https://nbclassic.readthedocs.io/en/latest/extending/handlers.html), and the newer [Jupyter Server](https://jupyter-server.readthedocs.io/en/latest/operators/configuring-extensions.html). Hence, nbgitpuller can be developed locally without needing a JupyterHub. From 9efc02e601587257bd363d7f51f1fdcd1dd78991 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Mon, 7 Aug 2023 10:35:35 +0200 Subject: [PATCH 30/63] Fix dates in changelog for 1.2.0 release --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index adf780e7..0a10a199 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## 1.2 -### 1.2.0 - 2023-08-04 +### 1.2.0 - 2023-08-07 ([full changelog](https://github.com/jupyterhub/nbgitpuller/compare/1.1.1...1.2.0)) @@ -36,9 +36,9 @@ The following people contributed discussions, new ideas, code and documentation contributions, and review. See [our definition of contributors](https://github-activity.readthedocs.io/en/latest/#how-does-this-tool-define-contributions-in-the-reports). -([GitHub contributors page for this release](https://github.com/jupyterhub/nbgitpuller/graphs/contributors?from=2022-11-08&to=2023-08-04&type=c)) +([GitHub contributors page for this release](https://github.com/jupyterhub/nbgitpuller/graphs/contributors?from=2022-11-08&to=2023-08-07&type=c)) -@a3626a ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Aa3626a+updated%3A2022-11-08..2023-08-04&type=Issues)) | @akhmerov ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Aakhmerov+updated%3A2022-11-08..2023-08-04&type=Issues)) | @albertmichaelj ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Aalbertmichaelj+updated%3A2022-11-08..2023-08-04&type=Issues)) | @balajialg ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Abalajialg+updated%3A2022-11-08..2023-08-04&type=Issues)) | @consideRatio ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3AconsideRatio+updated%3A2022-11-08..2023-08-04&type=Issues)) | @frankier ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Afrankier+updated%3A2022-11-08..2023-08-04&type=Issues)) | @jdmansour ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Ajdmansour+updated%3A2022-11-08..2023-08-04&type=Issues)) | @jtpio ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Ajtpio+updated%3A2022-11-08..2023-08-04&type=Issues)) | @manics ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Amanics+updated%3A2022-11-08..2023-08-04&type=Issues)) | @minrk ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Aminrk+updated%3A2022-11-08..2023-08-04&type=Issues)) | @Snozzberries ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3ASnozzberries+updated%3A2022-11-08..2023-08-04&type=Issues)) | @yuvipanda ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Ayuvipanda+updated%3A2022-11-08..2023-08-04&type=Issues)) +@a3626a ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Aa3626a+updated%3A2022-11-08..2023-08-07&type=Issues)) | @akhmerov ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Aakhmerov+updated%3A2022-11-08..2023-08-07&type=Issues)) | @albertmichaelj ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Aalbertmichaelj+updated%3A2022-11-08..2023-08-07&type=Issues)) | @balajialg ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Abalajialg+updated%3A2022-11-08..2023-08-07&type=Issues)) | @consideRatio ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3AconsideRatio+updated%3A2022-11-08..2023-08-07&type=Issues)) | @frankier ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Afrankier+updated%3A2022-11-08..2023-08-07&type=Issues)) | @jdmansour ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Ajdmansour+updated%3A2022-11-08..2023-08-07&type=Issues)) | @jtpio ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Ajtpio+updated%3A2022-11-08..2023-08-07&type=Issues)) | @manics ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Amanics+updated%3A2022-11-08..2023-08-07&type=Issues)) | @minrk ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Aminrk+updated%3A2022-11-08..2023-08-07&type=Issues)) | @Snozzberries ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3ASnozzberries+updated%3A2022-11-08..2023-08-07&type=Issues)) | @yuvipanda ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Ayuvipanda+updated%3A2022-11-08..2023-08-07&type=Issues)) ## 1.1 From 5c1bba52d308a8ab2698e7b47c1a57d0d628b624 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Mon, 7 Aug 2023 10:57:34 +0200 Subject: [PATCH 31/63] Align with org wide pattern on making releases (tbump, pypi credentials) --- .../workflows/{publish.yml => release.yaml} | 21 +++-- .github/workflows/test.yml | 2 +- RELEASE.md | 81 +++++++++---------- nbgitpuller/version.py | 6 +- pyproject.toml | 33 ++++++++ setup.py | 12 +-- 6 files changed, 91 insertions(+), 64 deletions(-) rename .github/workflows/{publish.yml => release.yaml} (61%) diff --git a/.github/workflows/publish.yml b/.github/workflows/release.yaml similarity index 61% rename from .github/workflows/publish.yml rename to .github/workflows/release.yaml index 913129a3..525fb88e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/release.yaml @@ -1,18 +1,20 @@ # This is a GitHub workflow defining a set of jobs with a set of steps. -# ref: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions +# ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions # -# Build releases and publish to PyPI if a tag is pushed name: Release +# Always tests wheel building, but only publish to PyPI on pushed tags. on: pull_request: paths-ignore: - "docs/**" - - "**/docs.yml" + - ".github/workflows/*.yaml" + - "!.github/workflows/release.yaml" push: paths-ignore: - "docs/**" - - "**/docs.yml" + - ".github/workflows/*.yaml" + - "!.github/workflows/release.yaml" branches-ignore: - "dependabot/**" - "pre-commit-ci-update-config" @@ -22,6 +24,14 @@ on: jobs: build-release: runs-on: ubuntu-22.04 + permissions: + # id-token=write is required for pypa/gh-action-pypi-publish, and the PyPI + # project needs to be configured to trust this workflow. + # + # ref: https://github.com/jupyterhub/team-compass/issues/648 + # + id-token: write + steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 @@ -45,6 +55,3 @@ jobs: - name: publish to pypi uses: pypa/gh-action-pypi-publish@release/v1 if: startsWith(github.ref, 'refs/tags/') - with: - user: __token__ - password: ${{ secrets.pypi_password }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9602cc57..f29c5195 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -47,7 +47,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: "${{ matrix.node-version || '16'}}" + node-version: "${{ matrix.node-version || '18'}}" - name: install git ${{ matrix.git-version }} if: ${{ matrix.git-version }} diff --git a/RELEASE.md b/RELEASE.md index c8488f03..a51fe33b 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,67 +1,60 @@ # How to make a release -`nbgitpuller` is a package available on -[PyPI](https://pypi.org/project/nbgitpuller/) and -[conda-forge](https://anaconda.org/conda-forge/nbgitpuller). -These are instructions on how to make a release on PyPI. -The PyPI release is done automatically by TravisCI when a tag is pushed. +`nbgitpuller` is a package available on [PyPI] and [conda-forge]. + +These are the instructions on how to make a release. + +## Pre-requisites + +- Push rights to this GitHub repository ## Steps to make a release -1. Checkout main and make sure it is up to date. +1. Create a PR updating `CHANGELOG.md` with [github-activity] and continue when + its merged. - ```shell - ORIGIN=${ORIGIN:-origin} # set to the canonical remote, e.g. 'upstream' if 'origin' is not the official repo - git checkout main - git fetch $ORIGIN main - git reset --hard $ORIGIN/main - # WARNING! This next command deletes any untracked files in the repo - git clean -xfd - ``` + Advice on this procedure can be found in [this team compass + issue](https://github.com/jupyterhub/team-compass/issues/563). -1. Set the `__version__` variable in - [`nbgitpuller/version.py`](nbgitpuller/version.py) - and make a commit. +2. Checkout main and make sure it is up to date. ```shell - git add nbgitpuller/version.py - VERSION=... # e.g. 1.2.3 - git commit -m "release $VERSION" + git checkout main + git fetch origin main + git reset --hard origin/main ``` -1. Reset the `__version__` variable in - [`nbgitpuller/version.py`](nbgitpuller/version.py) - to an incremented patch version with a `dev` element, then make a commit. +3. Update the version, make commits, and push a git tag with `tbump`. ```shell - git add nbgitpuller/version.py - git commit -m "back to dev" + pip install tbump ``` -1. Push your two commits to main. + `tbump` will ask for confirmation before doing anything. ```shell - # first push commits without a tags to ensure the - # commits comes through, because a tag can otherwise - # be pushed all alone without company of rejected - # commits, and we want have our tagged release coupled - # with a specific commit in main - git push $ORIGIN main + # Example versions to set: 1.0.0, 1.0.0b1 + VERSION= + tbump ${VERSION} ``` -1. Create a git tag for the pushed release commit and push it. - - ```shell - git tag -a $VERSION -m $VERSION HEAD~1 + Following this, the [CI system] will build and publish a release. - # then verify you tagged the right commit - git log +4. Reset the version back to dev, e.g. `1.0.1.dev` after releasing `1.0.0`. - # then push it - git push $ORIGIN refs/tags/$VERSION + ```shell + # Example version to set: 1.0.1.dev + NEXT_VERSION= + tbump --no-tag ${NEXT_VERSION}.dev ``` -1. Following the release to PyPI, an automated PR should arrive to - [conda-forge/nbgitpuller-feedstock](https://github.com/conda-forge/nbgitpuller-feedstock), - check for the tests to succeed on this PR and then merge it to successfully - update the package for `conda` on the `conda-forge` channel. +5. Following the release to PyPI, an automated PR should arrive within 24 hours + to [conda-forge/nbgitpuller-feedstock] with instructions + on releasing to conda-forge. You are welcome to volunteer doing this, but + aren't required as part of making this release to PyPI. + +[github-activity]: https://github.com/executablebooks/github-activity +[pypi]: https://pypi.org/project/nbgitpuller/ +[conda-forge]: https://anaconda.org/conda-forge/nbgitpuller +[conda-forge/nbgitpuller-feedstock]: https://github.com/conda-forge/nbgitpuller-feedstock +[ci system]: https://github.com/jupyterhub/nbgitpuller/actions/workflows/release.yaml diff --git a/nbgitpuller/version.py b/nbgitpuller/version.py index 62e16d16..fcd362a1 100644 --- a/nbgitpuller/version.py +++ b/nbgitpuller/version.py @@ -1,2 +1,4 @@ -""""The nbgitpuller PyPI package SemVer version.""" -__version__ = '1.1.2dev' +# __version__ should be updated using tbump, based on configuration in +# pyproject.toml, according to instructions in RELEASE.md. +# +__version__ = "1.1.2.dev" diff --git a/pyproject.toml b/pyproject.toml index e7467386..27975fb1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,3 +46,36 @@ target_version = [ markers = [ "jupyter_server: configure the jupyter_server fixture" ] + + + +# tbump is used to simplify and standardize the release process when updating +# the version, making a git commit and tag, and pushing changes. +# +# ref: https://github.com/your-tools/tbump#readme +# +[tool.tbump] +github_url = "https://github.com/jupyterhub/nbgitpuller" + +[tool.tbump.version] +current = "1.1.2.dev" +regex = ''' + (?P\d+) + \. + (?P\d+) + \. + (?P\d+) + (?P
((a|b|rc)\d+)|)
+    \.?
+    (?P(?<=\.)dev\d*|)
+'''
+
+[tool.tbump.git]
+message_template = "Bump to {new_version}"
+tag_template = "{new_version}"
+
+[[tool.tbump.file]]
+src = "nbgitpuller/version.py"
+
+[[tool.tbump.file]]
+src = "setup.py"
diff --git a/setup.py b/setup.py
index 32fb0347..9b9664f4 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,5 @@
 from jupyter_packaging import wrap_installers, npm_builder
 from setuptools import find_packages, setup
-from distutils.util import convert_path
 import os.path
 
 HERE = os.path.abspath(os.path.dirname(__file__))
@@ -17,16 +16,9 @@
     pre_develop=jsdeps, pre_dist=jsdeps,
     ensured_targets=jstargets)
 
-# Imports __version__, reference: https://stackoverflow.com/a/24517154/2220152
-ns = {}
-ver_path = convert_path('nbgitpuller/version.py')
-with open(ver_path) as ver_file:
-    exec(ver_file.read(), ns)
-__version__ = ns['__version__']
-
 setup(
     name='nbgitpuller',
-    version=__version__,
+    version="1.1.2.dev",
     url='https://github.com/jupyterhub/nbgitpuller',
     license='3-clause BSD',
     author='Peter Veerman, YuviPanda',
@@ -50,7 +42,7 @@
         ],
     },
     classifiers=[
-        'Development Status :: 4 - Beta',
+        'Development Status :: 5 - Production/Stable',
         'License :: OSI Approved :: BSD License',
         'Operating System :: POSIX',
         'Operating System :: MacOS',

From 68c485e206688abbfcb6f2859332e5b6e930ee46 Mon Sep 17 00:00:00 2001
From: Erik Sundell 
Date: Mon, 7 Aug 2023 10:59:38 +0200
Subject: [PATCH 32/63] Bump to 1.2.0

---
 nbgitpuller/version.py | 2 +-
 pyproject.toml         | 2 +-
 setup.py               | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/nbgitpuller/version.py b/nbgitpuller/version.py
index fcd362a1..55aafb79 100644
--- a/nbgitpuller/version.py
+++ b/nbgitpuller/version.py
@@ -1,4 +1,4 @@
 # __version__ should be updated using tbump, based on configuration in
 # pyproject.toml, according to instructions in RELEASE.md.
 #
-__version__ = "1.1.2.dev"
+__version__ = "1.2.0"
diff --git a/pyproject.toml b/pyproject.toml
index 27975fb1..aa8d38cc 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -58,7 +58,7 @@ markers = [
 github_url = "https://github.com/jupyterhub/nbgitpuller"
 
 [tool.tbump.version]
-current = "1.1.2.dev"
+current = "1.2.0"
 regex = '''
     (?P\d+)
     \.
diff --git a/setup.py b/setup.py
index 9b9664f4..1321b71e 100644
--- a/setup.py
+++ b/setup.py
@@ -18,7 +18,7 @@
 
 setup(
     name='nbgitpuller',
-    version="1.1.2.dev",
+    version="1.2.0",
     url='https://github.com/jupyterhub/nbgitpuller',
     license='3-clause BSD',
     author='Peter Veerman, YuviPanda',

From 18198d6d9cb42b398a1b837a9b42a99e020bd27b Mon Sep 17 00:00:00 2001
From: Erik Sundell 
Date: Mon, 7 Aug 2023 11:02:40 +0200
Subject: [PATCH 33/63] Bump to 1.2.1.dev

---
 nbgitpuller/version.py | 2 +-
 pyproject.toml         | 2 +-
 setup.py               | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/nbgitpuller/version.py b/nbgitpuller/version.py
index 55aafb79..d6536649 100644
--- a/nbgitpuller/version.py
+++ b/nbgitpuller/version.py
@@ -1,4 +1,4 @@
 # __version__ should be updated using tbump, based on configuration in
 # pyproject.toml, according to instructions in RELEASE.md.
 #
-__version__ = "1.2.0"
+__version__ = "1.2.1.dev"
diff --git a/pyproject.toml b/pyproject.toml
index aa8d38cc..aecdd811 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -58,7 +58,7 @@ markers = [
 github_url = "https://github.com/jupyterhub/nbgitpuller"
 
 [tool.tbump.version]
-current = "1.2.0"
+current = "1.2.1.dev"
 regex = '''
     (?P\d+)
     \.
diff --git a/setup.py b/setup.py
index 1321b71e..56ff8bcb 100644
--- a/setup.py
+++ b/setup.py
@@ -18,7 +18,7 @@
 
 setup(
     name='nbgitpuller',
-    version="1.2.0",
+    version="1.2.1.dev",
     url='https://github.com/jupyterhub/nbgitpuller',
     license='3-clause BSD',
     author='Peter Veerman, YuviPanda',

From 17f4b759a014b7b6fc3cc1084dd4ac62d3fbd7ac Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
 <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Tue, 5 Sep 2023 08:10:44 +0000
Subject: [PATCH 34/63] [pre-commit.ci] pre-commit autoupdate
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

updates:
- [github.com/pre-commit/mirrors-prettier: v3.0.0 → v3.0.3](https://github.com/pre-commit/mirrors-prettier/compare/v3.0.0...v3.0.3)
---
 .pre-commit-config.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 8c02759e..9fdf1b4c 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -45,7 +45,7 @@ repos:
 
   # Autoformat: markdown, yaml, javascript (see the file .prettierignore)
   - repo: https://github.com/pre-commit/mirrors-prettier
-    rev: v3.0.0
+    rev: v3.0.3
     hooks:
       - id: prettier
         # FIXME: Autoformatting of our .js files is initially not enabled as it

From f9b5c19b11fe3ab0bcc171e68084ad4368392ad0 Mon Sep 17 00:00:00 2001
From: YuviPanda 
Date: Wed, 6 Sep 2023 09:22:59 -0700
Subject: [PATCH 35/63] Add a FAQ entry for 'nbgitpuller link selecting profile
 options'

This gets asked a *lot*, and it would be useful to have a central
place to point people to!
---
 docs/faq.md   | 23 +++++++++++++++++++++++
 docs/index.md |  1 +
 2 files changed, 24 insertions(+)
 create mode 100644 docs/faq.md

diff --git a/docs/faq.md b/docs/faq.md
new file mode 100644
index 00000000..a74f8f21
--- /dev/null
+++ b/docs/faq.md
@@ -0,0 +1,23 @@
+# Frequently asked questions
+
+## Can I automatically JupyterHub what kind of server to start(node size, profile name, etc) as part of my nbgitpuller link?
+
+You can use Kubespawner's profile_list or ProfileSpawner to allow your
+end users to choose the resources (memory, cpu, GPUs, etc) they want before
+starting their server. Wouldn't it be nice if this information could be
+embedded in the nbgitpuller link, so this (often confusing) choice is made
+for your students?
+
+While it would indeed be very nice, this is not currently possible for two
+reasons:
+
+1. nbgitpuller is a Jupyter Server extension, and only runs *after* the server
+   is started. It knows nothing about JupyterHub. So it can not influence the
+   options JupyterHub uses to start the server.
+2. There is UX complexity in what happens if the user clicks an nbgitpuller
+   link when a server is *already* running, but with a different set of resource
+   requests / profile options. Do we shut that existing one down? Just error? Do
+   nothing? Many valid options, but takes a bunch of work.
+
+So while this workflow *is* possible, it would most likely require work in
+JupyterHub to make it possible, rather than in nbgitpuller
diff --git a/docs/index.md b/docs/index.md
index e52903be..90013a35 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -69,5 +69,6 @@ contributing
 topic/automatic-merging
 topic/url-options
 topic/repo-best-practices
+faq
 link
 ```

From 5c2f02e1b7f406ffaf5439e7839da171a4350ff2 Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
 <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Wed, 6 Sep 2023 16:24:05 +0000
Subject: [PATCH 36/63] [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
---
 docs/faq.md | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/docs/faq.md b/docs/faq.md
index a74f8f21..6f366fab 100644
--- a/docs/faq.md
+++ b/docs/faq.md
@@ -11,13 +11,13 @@ for your students?
 While it would indeed be very nice, this is not currently possible for two
 reasons:
 
-1. nbgitpuller is a Jupyter Server extension, and only runs *after* the server
+1. nbgitpuller is a Jupyter Server extension, and only runs _after_ the server
    is started. It knows nothing about JupyterHub. So it can not influence the
    options JupyterHub uses to start the server.
 2. There is UX complexity in what happens if the user clicks an nbgitpuller
-   link when a server is *already* running, but with a different set of resource
+   link when a server is _already_ running, but with a different set of resource
    requests / profile options. Do we shut that existing one down? Just error? Do
    nothing? Many valid options, but takes a bunch of work.
 
-So while this workflow *is* possible, it would most likely require work in
+So while this workflow _is_ possible, it would most likely require work in
 JupyterHub to make it possible, rather than in nbgitpuller

From 63dbdc527075491c8674611cc32f26dc405fe892 Mon Sep 17 00:00:00 2001
From: Yuvi Panda 
Date: Wed, 6 Sep 2023 09:35:49 -0700
Subject: [PATCH 37/63] Fix typo

Co-authored-by: Sarah Gibson <44771837+sgibson91@users.noreply.github.com>
---
 docs/faq.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/faq.md b/docs/faq.md
index 6f366fab..ae32b687 100644
--- a/docs/faq.md
+++ b/docs/faq.md
@@ -1,6 +1,6 @@
 # Frequently asked questions
 
-## Can I automatically JupyterHub what kind of server to start(node size, profile name, etc) as part of my nbgitpuller link?
+## Can I automatically tell JupyterHub what kind of server to start (node size, profile name, etc) as part of my nbgitpuller link?
 
 You can use Kubespawner's profile_list or ProfileSpawner to allow your
 end users to choose the resources (memory, cpu, GPUs, etc) they want before

From 32d150295d9844d8b546f1066c437dedecf2bb0d Mon Sep 17 00:00:00 2001
From: YuviPanda 
Date: Mon, 11 Sep 2023 09:51:48 -0700
Subject: [PATCH 38/63] Update wording

---
 docs/faq.md | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/docs/faq.md b/docs/faq.md
index ae32b687..bc0158fd 100644
--- a/docs/faq.md
+++ b/docs/faq.md
@@ -8,7 +8,7 @@ starting their server. Wouldn't it be nice if this information could be
 embedded in the nbgitpuller link, so this (often confusing) choice is made
 for your students?
 
-While it would indeed be very nice, this is not currently possible for two
+While it would indeed be very nice, this is not currently not easy for two
 reasons:
 
 1. nbgitpuller is a Jupyter Server extension, and only runs _after_ the server
@@ -19,5 +19,5 @@ reasons:
    requests / profile options. Do we shut that existing one down? Just error? Do
    nothing? Many valid options, but takes a bunch of work.
 
-So while this workflow _is_ possible, it would most likely require work in
-JupyterHub to make it possible, rather than in nbgitpuller
+So while this workflow _is_ possible, it would most likely be done at the
+JupyterHub level to make it possible, rather than in nbgitpuller

From 0dab6437435fcbb76d6227362ab6d0259d4d0a24 Mon Sep 17 00:00:00 2001
From: YuviPanda 
Date: Mon, 11 Sep 2023 10:01:16 -0700
Subject: [PATCH 39/63] Remove double negative

---
 docs/faq.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/faq.md b/docs/faq.md
index bc0158fd..2cec8c76 100644
--- a/docs/faq.md
+++ b/docs/faq.md
@@ -8,7 +8,7 @@ starting their server. Wouldn't it be nice if this information could be
 embedded in the nbgitpuller link, so this (often confusing) choice is made
 for your students?
 
-While it would indeed be very nice, this is not currently not easy for two
+While it would indeed be very nice, this is currently not easy for two
 reasons:
 
 1. nbgitpuller is a Jupyter Server extension, and only runs _after_ the server

From 18394a8a63580559afab3d4a28061d62be922d9b Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Sun, 1 Oct 2023 05:23:53 +0000
Subject: [PATCH 40/63] Bump actions/checkout from 3 to 4

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] 
---
 .github/workflows/docs.yml     | 2 +-
 .github/workflows/release.yaml | 2 +-
 .github/workflows/test.yml     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index d005fff1..16994f25 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -26,7 +26,7 @@ jobs:
     runs-on: ubuntu-22.04
 
     steps:
-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v4
       - uses: actions/setup-python@v4
         with:
           python-version: "3.11"
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 525fb88e..3da02f54 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -33,7 +33,7 @@ jobs:
       id-token: write
 
     steps:
-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v4
       - uses: actions/setup-python@v4
         with:
           python-version: "3.11"
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index f29c5195..57a9f766 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -40,7 +40,7 @@ jobs:
           - python-version: "3.11"
 
     steps:
-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v4
       - uses: actions/setup-python@v4
         with:
           python-version: "${{ matrix.python-version }}"

From b0c88c6436e4b36bf11a1a44e594741ed29fa67b Mon Sep 17 00:00:00 2001
From: Ayaz Salikhov 
Date: Sat, 7 Oct 2023 16:25:27 +0400
Subject: [PATCH 41/63] Fix automatic merging link in README.md

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 32af5ac5..7326b4fd 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@
 
 `nbgitpuller` lets you distribute content in a git repository to your students
 by having them click a simple link. [Automatic
-merging](https://nbgitpuller.readthedocs.io/topic/automatic-merging.html)
+merging](https://nbgitpuller.readthedocs.io/en/latest/topic/automatic-merging.html)
 ensures that your students are never exposed to `git` directly. It is primarily
 used with a JupyterHub, but can also work on students' local computers.
 

From fdcc27ab97b128c373f52ff01acc6f1ea8d9bb8e Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Wed, 1 Nov 2023 05:08:00 +0000
Subject: [PATCH 42/63] Bump actions/setup-node from 3 to 4

Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3 to 4.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] 
---
 .github/workflows/release.yaml | 2 +-
 .github/workflows/test.yml     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 3da02f54..8547edbe 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -37,7 +37,7 @@ jobs:
       - uses: actions/setup-python@v4
         with:
           python-version: "3.11"
-      - uses: actions/setup-node@v3
+      - uses: actions/setup-node@v4
         with:
           node-version: "18"
 
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 57a9f766..01225e11 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -45,7 +45,7 @@ jobs:
         with:
           python-version: "${{ matrix.python-version }}"
 
-      - uses: actions/setup-node@v3
+      - uses: actions/setup-node@v4
         with:
           node-version: "${{ matrix.node-version || '18'}}"
 

From e8879e6f559c4ffc05acc66264dfe9cb45d545ab Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
 <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Mon, 6 Nov 2023 20:27:46 +0000
Subject: [PATCH 43/63] [pre-commit.ci] pre-commit autoupdate
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

updates:
- [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.4.0...v4.5.0)
---
 .pre-commit-config.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 9fdf1b4c..d140f643 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -56,7 +56,7 @@ repos:
 
   # Autoformat and linting, misc. details
   - repo: https://github.com/pre-commit/pre-commit-hooks
-    rev: v4.4.0
+    rev: v4.5.0
     hooks:
       - id: end-of-file-fixer
       - id: requirements-txt-fixer

From f4a259f11475d77d4505004d545e28f803cd9941 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 1 Jan 2024 05:15:58 +0000
Subject: [PATCH 44/63] Bump actions/setup-python from 4 to 5

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] 
---
 .github/workflows/docs.yml     | 2 +-
 .github/workflows/release.yaml | 2 +-
 .github/workflows/test.yml     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 16994f25..3ca53fcc 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -27,7 +27,7 @@ jobs:
 
     steps:
       - uses: actions/checkout@v4
-      - uses: actions/setup-python@v4
+      - uses: actions/setup-python@v5
         with:
           python-version: "3.11"
 
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 8547edbe..6eca1877 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -34,7 +34,7 @@ jobs:
 
     steps:
       - uses: actions/checkout@v4
-      - uses: actions/setup-python@v4
+      - uses: actions/setup-python@v5
         with:
           python-version: "3.11"
       - uses: actions/setup-node@v4
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 01225e11..326d172e 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -41,7 +41,7 @@ jobs:
 
     steps:
       - uses: actions/checkout@v4
-      - uses: actions/setup-python@v4
+      - uses: actions/setup-python@v5
         with:
           python-version: "${{ matrix.python-version }}"
 

From 0853a7d7ea4fa588dbd2ed2e95a9b9cc672e508c Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
 <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Mon, 1 Jan 2024 20:22:31 +0000
Subject: [PATCH 45/63] [pre-commit.ci] pre-commit autoupdate
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

updates:
- [github.com/pre-commit/mirrors-prettier: v3.0.3 → v4.0.0-alpha.8](https://github.com/pre-commit/mirrors-prettier/compare/v3.0.3...v4.0.0-alpha.8)
---
 .pre-commit-config.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index d140f643..9091335c 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -45,7 +45,7 @@ repos:
 
   # Autoformat: markdown, yaml, javascript (see the file .prettierignore)
   - repo: https://github.com/pre-commit/mirrors-prettier
-    rev: v3.0.3
+    rev: v4.0.0-alpha.8
     hooks:
       - id: prettier
         # FIXME: Autoformatting of our .js files is initially not enabled as it

From 04145b27085d12d2836b2fbef5049a63349523c6 Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
 <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Mon, 5 Feb 2024 20:26:56 +0000
Subject: [PATCH 46/63] [pre-commit.ci] pre-commit autoupdate
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

updates:
- [github.com/PyCQA/flake8: 6.1.0 → 7.0.0](https://github.com/PyCQA/flake8/compare/6.1.0...7.0.0)
---
 .pre-commit-config.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 9091335c..77cf6871 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -65,7 +65,7 @@ repos:
 
   # Linting: Python code (see the file .flake8)
   - repo: https://github.com/PyCQA/flake8
-    rev: "6.1.0"
+    rev: "7.0.0"
     hooks:
       - id: flake8
 

From eb388a16429ecd20b142904c329d0d5591d96b7d Mon Sep 17 00:00:00 2001
From: Erik Sundell 
Date: Thu, 28 Mar 2024 20:33:22 +0100
Subject: [PATCH 47/63] Add test for Python 3.12 and git 2.43 (ubuntu 24.04)

---
 .github/workflows/test.yml | 12 +++++++++---
 pyproject.toml             | 10 +++++++++-
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 326d172e..00d8c016 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -38,6 +38,9 @@ jobs:
             # 2.34 is in ubuntu 22.04
             git-version: "2.34"
           - python-version: "3.11"
+          - python-version: "3.12"
+            # 2.43 is in ubuntu 24.04
+            git-version: "2.43"
 
     steps:
       - uses: actions/checkout@v4
@@ -47,14 +50,14 @@ jobs:
 
       - uses: actions/setup-node@v4
         with:
-          node-version: "${{ matrix.node-version || '18'}}"
+          node-version: "lts/*"
 
       - name: install git ${{ matrix.git-version }}
         if: ${{ matrix.git-version }}
         run: |
           export MAMBA_ROOT_PREFIX=$/tmp/conda
           mkdir -p $MAMBA_ROOT_PREFIX/bin
-          curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/1.4.2 | tar -xvj -C $MAMBA_ROOT_PREFIX/bin/ --strip-components=1 bin/micromamba
+          curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/1.5.8 | tar -xvj -C $MAMBA_ROOT_PREFIX/bin/ --strip-components=1 bin/micromamba
           $MAMBA_ROOT_PREFIX/bin/micromamba install -c conda-forge -p $MAMBA_ROOT_PREFIX "git=${{ matrix.git-version }}"
           echo "PATH=$MAMBA_ROOT_PREFIX/bin:$PATH" >> $GITHUB_ENV
 
@@ -72,8 +75,11 @@ jobs:
         run: |
           pip install -r dev-requirements.txt
           pip install .
+
+      - name: List dependencies
+        run: |
           pip freeze
 
       - name: Run tests
         run: |
-          pytest --verbose --maxfail=2 --color=yes --cov nbgitpuller tests
+          pytest --maxfail=2
diff --git a/pyproject.toml b/pyproject.toml
index aecdd811..85130383 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -40,15 +40,23 @@ target_version = [
     "py39",
     "py310",
     "py311",
+    "py312",
 ]
 
+
+# pytest is used for running Python based tests
+#
+# ref: https://docs.pytest.org/en/stable/
+#
 [tool.pytest.ini_options]
+addopts = "--verbose --color=yes --durations=10 --cov nbgitpuller"
+asyncio_mode = "auto"
+testpaths = ["tests"]
 markers = [
     "jupyter_server: configure the jupyter_server fixture"
 ]
 
 
-
 # tbump is used to simplify and standardize the release process when updating
 # the version, making a git commit and tag, and pushing changes.
 #

From a55f65ab3485a5d76ec0c0868b645d9158540566 Mon Sep 17 00:00:00 2001
From: Erik Sundell 
Date: Thu, 28 Mar 2024 22:31:51 +0100
Subject: [PATCH 48/63] Test against jupyter_server 1 and notebook 5 and 7

---
 .github/workflows/test.yml | 5 +++--
 dev-requirements.txt       | 2 +-
 tests/test_api.py          | 8 ++++++--
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 00d8c016..6e09290c 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -28,7 +28,9 @@ jobs:
       matrix:
         include:
           - python-version: "3.7"
+            pip-install: "jupyter_server==1.* notebook==5.*"
           - python-version: "3.8"
+            pip-install: "jupyter_server==1.* notebook==6.*"
             # 2.17 is in ubuntu 18.04
             git-version: "2.17"
           - python-version: "3.9"
@@ -73,8 +75,7 @@ jobs:
 
       - name: Install dependencies
         run: |
-          pip install -r dev-requirements.txt
-          pip install .
+          pip install -r dev-requirements.txt ${{ matrix.pip-install }} .
 
       - name: List dependencies
         run: |
diff --git a/dev-requirements.txt b/dev-requirements.txt
index 0a8b925e..820cbabd 100644
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -1,6 +1,6 @@
 jupyter-packaging>=0.10
 nbclassic
-notebook>=5.5,<7
+notebook>=5.5
 packaging
 pytest
 pytest-cov
diff --git a/tests/test_api.py b/tests/test_api.py
index d5cb1c31..c1be2545 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -4,6 +4,7 @@
 import time
 from urllib.parse import urlencode
 from uuid import uuid4
+import notebook
 import pytest
 
 from repohelpers import Pusher, Remote
@@ -65,13 +66,13 @@ def jupyter_server(request, tmpdir, jupyterdir):
     if extra_env:
         env.update(extra_env)
 
+    extension_command = ["jupyter", "server", "extension"]
     if backend_type == "jupyter-server":
         command = [
             'jupyter-server',
             '--ServerApp.token=secret',
             '--port={}'.format(PORT),
         ]
-        extension_command = ["jupyter", "server", "extension"]
     elif backend_type == "jupyter-notebook":
         command = [
             'jupyter-notebook',
@@ -79,7 +80,10 @@ def jupyter_server(request, tmpdir, jupyterdir):
             '--NotebookApp.token=secret',
             '--port={}'.format(PORT),
         ]
-        extension_command = ["jupyter", "serverextension"]
+        # notebook <7 require "jupyter serverextension" instead of "jupyter
+        # server extension"
+        if notebook.version_info[0] < 7:
+            extension_command = ["jupyter", "serverextension"]
     else:
         raise ValueError(
             f"backend_type must be 'jupyter-server' or 'jupyter-notebook' not {backend_type!r}"

From 1ceca4ae671d086e17021629f366b27034ee12c1 Mon Sep 17 00:00:00 2001
From: Min RK 
Date: Thu, 28 Mar 2024 23:30:22 +0100
Subject: [PATCH 49/63] include xsrf token in event stream request

JupyterHub 4.1 increases strictness of xsrf checks

omitting it is no longer allowed on `Sec-Fetch: cors` requests
---
 nbgitpuller/static/js/gitsync.js  | 4 +++-
 nbgitpuller/static/js/index.js    | 3 ++-
 nbgitpuller/templates/status.html | 1 +
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/nbgitpuller/static/js/gitsync.js b/nbgitpuller/static/js/gitsync.js
index e441d8a7..94d800a4 100644
--- a/nbgitpuller/static/js/gitsync.js
+++ b/nbgitpuller/static/js/gitsync.js
@@ -1,5 +1,5 @@
 export class GitSync {
-    constructor(baseUrl, repo, branch, depth, targetpath, path) {
+    constructor(baseUrl, repo, branch, depth, targetpath, path, xsrf) {
         // Class that talks to the API backend & emits events as appropriate
         this.baseUrl = baseUrl;
         this.repo = repo;
@@ -7,6 +7,7 @@ export class GitSync {
         this.depth = depth;
         this.targetpath = targetpath;
         this.redirectUrl = baseUrl + path;
+        this._xsrf = xsrf;
 
         this.callbacks = {};
     }
@@ -30,6 +31,7 @@ export class GitSync {
     start() {
         // Start git pulling handled by SyncHandler, declared in handlers.py
         let syncUrlParams = new URLSearchParams({
+            _xsrf: this._xsrf,
             repo: this.repo,
             targetpath: this.targetpath
         });
diff --git a/nbgitpuller/static/js/index.js b/nbgitpuller/static/js/index.js
index 02c31634..5e35f1aa 100644
--- a/nbgitpuller/static/js/index.js
+++ b/nbgitpuller/static/js/index.js
@@ -21,7 +21,8 @@ const gs = new GitSync(
     getBodyData('branch'),
     getBodyData('depth'),
     getBodyData('targetpath'),
-    getBodyData('path')
+    getBodyData('path'),
+    getBodyData('xsrf'),
 );
 
 const gsv = new GitSyncView(
diff --git a/nbgitpuller/templates/status.html b/nbgitpuller/templates/status.html
index 2b969f59..fd19756e 100644
--- a/nbgitpuller/templates/status.html
+++ b/nbgitpuller/templates/status.html
@@ -5,6 +5,7 @@
 data-base-url="{{ base_url | urlencode }}"
 data-repo="{{ repo | urlencode }}"
 data-path="{{ path | urlencode }}"
+data-xsrf="{{ xsrf_token | urlencode }}"
 {% if branch %}data-branch="{{ branch | urlencode }}"{% endif %}
 {% if depth %}data-depth="{{ depth | urlencode }}"{% endif %}
 data-targetpath="{{ targetpath | urlencode }}"

From bbfd41c57d8b216daa69827e08544aa2feb380f0 Mon Sep 17 00:00:00 2001
From: Min RK 
Date: Fri, 29 Mar 2024 08:37:51 +0100
Subject: [PATCH 50/63] 403 on auth failure in EventStream

avoids redirects that won't work for EventStream requests
---
 nbgitpuller/handlers.py | 6 ++++++
 tests/test_api.py       | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/nbgitpuller/handlers.py b/nbgitpuller/handlers.py
index 2e572768..3cd4c359 100644
--- a/nbgitpuller/handlers.py
+++ b/nbgitpuller/handlers.py
@@ -29,6 +29,12 @@ def __init__(self, *args, **kwargs):
         if 'git_lock' not in self.settings:
             self.settings['git_lock'] = locks.Lock()
 
+    def get_login_url(self):
+        # raise on failed auth, not redirect
+        # can't redirect EventStream to login
+        # same as Jupyter's APIHandler
+        raise web.HTTPError(403)
+
     @property
     def git_lock(self):
         return self.settings['git_lock']
diff --git a/tests/test_api.py b/tests/test_api.py
index c1be2545..edb78170 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -136,7 +136,7 @@ def test_clone_auth(jupyterdir, jupyter_server):
         }
         r = request_api(params)
         # no token, redirect to login
-        assert r.code == 302
+        assert r.code == 403
 
 
 def test_clone_targetpath(jupyterdir, jupyter_server):

From b34002d3e798bde60ece0bfff52d321bf9b09ac7 Mon Sep 17 00:00:00 2001
From: Erik Sundell 
Date: Fri, 29 Mar 2024 17:07:18 +0100
Subject: [PATCH 51/63] Add changelog for 1.2.1

---
 CHANGELOG.md | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0a10a199..103f5d1c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,32 @@
 ## 1.2
 
+### 1.2.1 - 2024-03-29
+
+([full changelog](https://github.com/jupyterhub/nbgitpuller/compare/1.2.0...1.2.1))
+
+#### Bugs fixed
+
+- 403 on failed auth for EventStream [#347](https://github.com/jupyterhub/nbgitpuller/pull/347) ([@minrk](https://github.com/minrk), [@consideRatio](https://github.com/consideRatio))
+- include xsrf token in event stream request [#346](https://github.com/jupyterhub/nbgitpuller/pull/346) ([@minrk](https://github.com/minrk), [@consideRatio](https://github.com/consideRatio), [@yuvipanda](https://github.com/yuvipanda))
+
+#### Maintenance and upkeep improvements
+
+- Add test for Python 3.12, jupyter_server 1, notebook 5 and 7, and git 2.43 (ubuntu 24.04) [#345](https://github.com/jupyterhub/nbgitpuller/pull/345) ([@consideRatio](https://github.com/consideRatio), [@minrk](https://github.com/minrk), [@yuvipanda](https://github.com/yuvipanda))
+
+#### Documentation improvements
+
+- Fix automatic merging link in README.md [#328](https://github.com/jupyterhub/nbgitpuller/pull/328) ([@mathbunnyru](https://github.com/mathbunnyru), [@manics](https://github.com/manics))
+- Add a FAQ entry for 'nbgitpuller link selecting profile options' [#322](https://github.com/jupyterhub/nbgitpuller/pull/322) ([@yuvipanda](https://github.com/yuvipanda), [@consideRatio](https://github.com/consideRatio), [@ryanlovett](https://github.com/ryanlovett), [@sgibson91](https://github.com/sgibson91))
+
+#### Contributors to this release
+
+The following people contributed discussions, new ideas, code and documentation contributions, and review.
+See [our definition of contributors](https://github-activity.readthedocs.io/en/latest/#how-does-this-tool-define-contributions-in-the-reports).
+
+([GitHub contributors page for this release](https://github.com/jupyterhub/nbgitpuller/graphs/contributors?from=2023-08-07&to=2024-03-29&type=c))
+
+@balajialg ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Abalajialg+updated%3A2023-08-07..2024-03-29&type=Issues)) | @consideRatio ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3AconsideRatio+updated%3A2023-08-07..2024-03-29&type=Issues)) | @fomightez ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Afomightez+updated%3A2023-08-07..2024-03-29&type=Issues)) | @jtpio ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Ajtpio+updated%3A2023-08-07..2024-03-29&type=Issues)) | @manics ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Amanics+updated%3A2023-08-07..2024-03-29&type=Issues)) | @mathbunnyru ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Amathbunnyru+updated%3A2023-08-07..2024-03-29&type=Issues)) | @minrk ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Aminrk+updated%3A2023-08-07..2024-03-29&type=Issues)) | @ryanlovett ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Aryanlovett+updated%3A2023-08-07..2024-03-29&type=Issues)) | @sgibson91 ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Asgibson91+updated%3A2023-08-07..2024-03-29&type=Issues)) | @yuvipanda ([activity](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Ayuvipanda+updated%3A2023-08-07..2024-03-29&type=Issues))
+
 ### 1.2.0 - 2023-08-07
 
 ([full changelog](https://github.com/jupyterhub/nbgitpuller/compare/1.1.1...1.2.0))

From ef354eb409273a92342b4336fe59cb9f194f4694 Mon Sep 17 00:00:00 2001
From: Erik Sundell 
Date: Fri, 29 Mar 2024 22:04:52 +0100
Subject: [PATCH 52/63] Add note about compatibility with jupyterhub 4.1+

---
 CHANGELOG.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 103f5d1c..d85bb293 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,8 @@
 
 ### 1.2.1 - 2024-03-29
 
+This release provides compatibility with JupyterHub >=4.1.
+
 ([full changelog](https://github.com/jupyterhub/nbgitpuller/compare/1.2.0...1.2.1))
 
 #### Bugs fixed

From abed309723ec034bcc19f2e4779fc580f3b3c753 Mon Sep 17 00:00:00 2001
From: Erik Sundell 
Date: Fri, 29 Mar 2024 22:06:18 +0100
Subject: [PATCH 53/63] Bump to 1.2.1

---
 nbgitpuller/version.py | 2 +-
 pyproject.toml         | 2 +-
 setup.py               | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/nbgitpuller/version.py b/nbgitpuller/version.py
index d6536649..fa2a7ed8 100644
--- a/nbgitpuller/version.py
+++ b/nbgitpuller/version.py
@@ -1,4 +1,4 @@
 # __version__ should be updated using tbump, based on configuration in
 # pyproject.toml, according to instructions in RELEASE.md.
 #
-__version__ = "1.2.1.dev"
+__version__ = "1.2.1"
diff --git a/pyproject.toml b/pyproject.toml
index 85130383..dcbe064f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -66,7 +66,7 @@ markers = [
 github_url = "https://github.com/jupyterhub/nbgitpuller"
 
 [tool.tbump.version]
-current = "1.2.1.dev"
+current = "1.2.1"
 regex = '''
     (?P\d+)
     \.
diff --git a/setup.py b/setup.py
index 56ff8bcb..b6da7bc8 100644
--- a/setup.py
+++ b/setup.py
@@ -18,7 +18,7 @@
 
 setup(
     name='nbgitpuller',
-    version="1.2.1.dev",
+    version="1.2.1",
     url='https://github.com/jupyterhub/nbgitpuller',
     license='3-clause BSD',
     author='Peter Veerman, YuviPanda',

From 04930d2dcefe0866463ab0b5e29be2d718e078b6 Mon Sep 17 00:00:00 2001
From: Erik Sundell 
Date: Fri, 29 Mar 2024 22:06:42 +0100
Subject: [PATCH 54/63] Bump to 1.2.2.dev

---
 nbgitpuller/version.py | 2 +-
 pyproject.toml         | 2 +-
 setup.py               | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/nbgitpuller/version.py b/nbgitpuller/version.py
index fa2a7ed8..58596cf8 100644
--- a/nbgitpuller/version.py
+++ b/nbgitpuller/version.py
@@ -1,4 +1,4 @@
 # __version__ should be updated using tbump, based on configuration in
 # pyproject.toml, according to instructions in RELEASE.md.
 #
-__version__ = "1.2.1"
+__version__ = "1.2.2.dev"
diff --git a/pyproject.toml b/pyproject.toml
index dcbe064f..0854bf16 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -66,7 +66,7 @@ markers = [
 github_url = "https://github.com/jupyterhub/nbgitpuller"
 
 [tool.tbump.version]
-current = "1.2.1"
+current = "1.2.2.dev"
 regex = '''
     (?P\d+)
     \.
diff --git a/setup.py b/setup.py
index b6da7bc8..8eec22bb 100644
--- a/setup.py
+++ b/setup.py
@@ -18,7 +18,7 @@
 
 setup(
     name='nbgitpuller',
-    version="1.2.1",
+    version="1.2.2.dev",
     url='https://github.com/jupyterhub/nbgitpuller',
     license='3-clause BSD',
     author='Peter Veerman, YuviPanda',

From ecb099bdb242b590dd66bed616c657ffab2c3ec2 Mon Sep 17 00:00:00 2001
From: Jordan Bradford <36420801+jrdnbradford@users.noreply.github.com>
Date: Wed, 17 Apr 2024 22:13:49 -0400
Subject: [PATCH 55/63] Add copy button for link generator

---
 docs/_static/link_gen/link.js |  7 ++++++
 docs/link.rst                 | 41 ++++++++++++++++++++++++++---------
 2 files changed, 38 insertions(+), 10 deletions(-)

diff --git a/docs/_static/link_gen/link.js b/docs/_static/link_gen/link.js
index d5166117..cea964ab 100644
--- a/docs/_static/link_gen/link.js
+++ b/docs/_static/link_gen/link.js
@@ -283,3 +283,10 @@ function linkMain() {
     // Do an initial render, to make sure our disabled / enabled properties are correctly set
     render();
 }
+
+function copyLink(elementId) {
+  var copyText = document.getElementById(elementId);
+  copyText.select();
+  copyText.setSelectionRange(0, 99999);
+  navigator.clipboard.writeText(copyText.value);
+} 
diff --git a/docs/link.rst b/docs/link.rst
index a1534f03..e8511727 100644
--- a/docs/link.rst
+++ b/docs/link.rst
@@ -38,17 +38,25 @@ Use the following form to create your own ``nbgitpuller`` links.
              
 
              
-
- -
-
- -
-
- -
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
-
@@ -191,6 +199,19 @@ Use the following form to create your own ``nbgitpuller`` links. // load link javascript on page load window.addEventListener("load", linkMain); + **Pre-populating some fields in the link generator** From 8abe5f00b54e2ae51d631463336201fe67a3df16 Mon Sep 17 00:00:00 2001 From: Jordan Bradford <36420801+jrdnbradford@users.noreply.github.com> Date: Fri, 19 Apr 2024 09:29:28 -0400 Subject: [PATCH 56/63] Remove redundant `form-control` `class` --- docs/link.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/link.rst b/docs/link.rst index e8511727..f06ace1a 100644 --- a/docs/link.rst +++ b/docs/link.rst @@ -40,19 +40,19 @@ Use the following form to create your own ``nbgitpuller`` links.
- +
- +
- +
From 15da6df7c492d5b7f1d37a68d5803a86369fb8d9 Mon Sep 17 00:00:00 2001 From: Jordan Bradford <36420801+jrdnbradford@users.noreply.github.com> Date: Mon, 22 Apr 2024 13:33:14 -0400 Subject: [PATCH 57/63] Update to use `focus()` --- docs/_static/link_gen/link.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/_static/link_gen/link.js b/docs/_static/link_gen/link.js index cea964ab..3a054a06 100644 --- a/docs/_static/link_gen/link.js +++ b/docs/_static/link_gen/link.js @@ -286,7 +286,6 @@ function linkMain() { function copyLink(elementId) { var copyText = document.getElementById(elementId); - copyText.select(); - copyText.setSelectionRange(0, 99999); + copyText.focus(); navigator.clipboard.writeText(copyText.value); } From 30726c883691d27e9725394d84b548abf6f4d5eb Mon Sep 17 00:00:00 2001 From: Jordan Bradford <36420801+jrdnbradford@users.noreply.github.com> Date: Mon, 22 Apr 2024 13:33:35 -0400 Subject: [PATCH 58/63] Add `margin` between fields --- docs/link.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/link.rst b/docs/link.rst index f06ace1a..2f894188 100644 --- a/docs/link.rst +++ b/docs/link.rst @@ -203,6 +203,7 @@ Use the following form to create your own ``nbgitpuller`` links. .input-group { display: flex; align-items: center; + margin: 10px; } .input-group input { flex: 1; From f47a2e9918965d399929d059eab9bad974bf4c61 Mon Sep 17 00:00:00 2001 From: Jordan Bradford <36420801+jrdnbradford@users.noreply.github.com> Date: Mon, 22 Apr 2024 15:22:59 -0400 Subject: [PATCH 59/63] Fix CSS issue --- docs/link.rst | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/docs/link.rst b/docs/link.rst index 2f894188..969caf67 100644 --- a/docs/link.rst +++ b/docs/link.rst @@ -37,22 +37,22 @@ Use the following form to create your own ``nbgitpuller`` links. -
+
- +
- +
- +
@@ -199,20 +199,6 @@ Use the following form to create your own ``nbgitpuller`` links. // load link javascript on page load window.addEventListener("load", linkMain); - **Pre-populating some fields in the link generator** From 655655cb518704fb166f67c91be26e3bf8fd8a45 Mon Sep 17 00:00:00 2001 From: Jordan Bradford <36420801+jrdnbradford@users.noreply.github.com> Date: Fri, 26 Apr 2024 09:49:14 -0400 Subject: [PATCH 60/63] Use `select()` --- docs/_static/link_gen/link.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/_static/link_gen/link.js b/docs/_static/link_gen/link.js index 3a054a06..3dd0dab7 100644 --- a/docs/_static/link_gen/link.js +++ b/docs/_static/link_gen/link.js @@ -286,6 +286,7 @@ function linkMain() { function copyLink(elementId) { var copyText = document.getElementById(elementId); - copyText.focus(); + copyText.select(); + copyText.setSelectionRange(0, copyText.value.length); navigator.clipboard.writeText(copyText.value); } From c2e7dc9b60bc58fe910e0db97ae13593444af2f0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 May 2024 22:03:25 +0000 Subject: [PATCH 61/63] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v4.6.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.5.0...v4.6.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 77cf6871..b8555f9e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -56,7 +56,7 @@ repos: # Autoformat and linting, misc. details - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: end-of-file-fixer - id: requirements-txt-fixer From 29f00c9f5a8c6c8c994df5f0015bf197e589d523 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 5 Aug 2024 23:06:51 +0000 Subject: [PATCH 62/63] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/PyCQA/flake8: 7.0.0 → 7.1.1](https://github.com/PyCQA/flake8/compare/7.0.0...7.1.1) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b8555f9e..561aca8e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -65,7 +65,7 @@ repos: # Linting: Python code (see the file .flake8) - repo: https://github.com/PyCQA/flake8 - rev: "7.0.0" + rev: "7.1.1" hooks: - id: flake8 From b8a076b79834b7ec3c708cbd45ebf10624b1230f Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Mon, 12 Aug 2024 17:58:28 -0700 Subject: [PATCH 63/63] Handle extra trailing slash when determining default targetpath Otherwise we end up with targetpath being `.`, which always exists (given it is current working directory) and we end up with weird failures Discovered while working on https://github.com/2i2c-org/infrastructure/issues/4576 --- nbgitpuller/handlers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nbgitpuller/handlers.py b/nbgitpuller/handlers.py index 3cd4c359..d170d1cb 100644 --- a/nbgitpuller/handlers.py +++ b/nbgitpuller/handlers.py @@ -154,8 +154,11 @@ async def get(self): self.get_argument('subPath', '.') app = self.get_argument('app', app_env) parent_reldir = os.getenv('NBGITPULLER_PARENTPATH', '') + # Remove trailing slashes before determining default targetPath + # Otherwise we end up with targetpath being `.`, which always exists (given it is current + # working directory) and we end up with weird failures targetpath = self.get_argument('targetpath', None) or \ - self.get_argument('targetPath', repo.split('/')[-1]) + self.get_argument('targetPath', repo.rstrip('/').split('/')[-1]) if urlPath: path = urlPath