diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 2aebc6ea..00000000 --- a/.flake8 +++ /dev/null @@ -1,11 +0,0 @@ -[flake8] -# Ignore style and complexity -# E: style errors -# W: style warnings -# C: complexity -# D: docstring warnings (unused pydocstyle extension) -# F841: local variable assigned but never used -ignore = E, C, W, D, F841 -exclude = - .cache, - .github diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml deleted file mode 100644 index c3ea9a00..00000000 --- a/.github/dependabot.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# dependabot.yaml reference: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file -# -# Notes: -# - Status and logs from dependabot are provided at -# https://github.com/jupyterhub/nbgitpuller/network/updates. -# -version: 2 -updates: - # Maintain dependencies in our GitHub Workflows - - package-ecosystem: github-actions - directory: / - labels: [ci] - schedule: - interval: monthly - time: "05:00" - timezone: Etc/UTC diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index d005fff1..00000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,41 +0,0 @@ -# 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 -# -name: Documentation - -on: - pull_request: - paths: - - "docs/**" - - "**/docs.yml" - push: - paths: - - "docs/**" - - "**/docs.yml" - branches-ignore: - - "dependabot/**" - - "pre-commit-ci-update-config" - tags: ["**"] - workflow_dispatch: - -env: - SPHINXOPTS: --color - -jobs: - linkcheck: - runs-on: ubuntu-22.04 - - 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 linkcheck (Verifies documentation links work) - run: | - cd docs - make linkcheck diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index d15598f5..00000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,50 +0,0 @@ -# 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 -# -# Build releases and publish to PyPI if a tag is pushed -name: Release - -on: - pull_request: - paths-ignore: - - "docs/**" - - "**/docs.yml" - push: - paths-ignore: - - "docs/**" - - "**/docs.yml" - branches-ignore: - - "dependabot/**" - - "pre-commit-ci-update-config" - tags: ["**"] - workflow_dispatch: - -jobs: - build-release: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: "3.11" - - uses: actions/setup-node@v3 - with: - node-version: "18" - - - name: install build package - run: | - pip install --upgrade pip - pip install build - pip freeze - - - name: build release - run: | - python -m build --sdist --wheel . - ls -l dist - - - name: publish to pypi - uses: pypa/gh-action-pypi-publish@v1.8.6 - 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 deleted file mode 100644 index 9602cc57..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,79 +0,0 @@ -# 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 -# -name: Tests - -on: - pull_request: - paths-ignore: - - "docs/**" - - "**/docs.yml" - push: - paths-ignore: - - "docs/**" - - "**/docs.yml" - branches-ignore: - - "dependabot/**" - - "pre-commit-ci-update-config" - tags: ["**"] - workflow_dispatch: - -jobs: - test: - runs-on: ubuntu-22.04 - timeout-minutes: 10 - - strategy: - fail-fast: false - matrix: - 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 || '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: | - which git - git --version - - - name: Run webpack to build static assets - run: | - npm install - npm run webpack - - - name: Install dependencies - run: | - pip install -r dev-requirements.txt - pip install . - pip freeze - - - name: Run tests - run: | - pytest --verbose --maxfail=2 --color=yes --cov nbgitpuller tests diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index e42936dd..00000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,74 +0,0 @@ -# pre-commit is a tool to perform a predefined set of tasks manually and/or -# automatically before git commits are made. -# -# Config reference: https://pre-commit.com/#pre-commit-configyaml---top-level -# -# Common tasks -# -# - Run on all files: pre-commit run --all-files -# - Register git hooks: pre-commit install --install-hooks -# -repos: - # FIXME: Autoformatting of our .py files by pyupgrade/autoflake/isort/black is - # initially not enabled as it would lead to large indentation changes - # while we currently have several open PRs good to resolve first. - # - - # # Autoformat: Python code, syntax patterns are modernized - # - repo: https://github.com/asottile/pyupgrade - # rev: v3.3.1 - # hooks: - # - id: pyupgrade - # args: - # - --py37-plus - - # # Autoformat: Python code - # - repo: https://github.com/PyCQA/autoflake - # rev: v2.0.0 - # hooks: - # - id: autoflake - # # args ref: https://github.com/PyCQA/autoflake#advanced-usage - # args: - # - --in-place - - # # Autoformat: Python code - # - repo: https://github.com/pycqa/isort - # rev: 5.11.4 - # hooks: - # - id: isort - - # # Autoformat: Python code - # - repo: https://github.com/psf/black - # rev: 22.12.0 - # hooks: - # - id: black - - # Autoformat: markdown, yaml, javascript (see the file .prettierignore) - - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.0-alpha.9-for-vscode - hooks: - - id: prettier - # FIXME: Autoformatting of our .js files is initially not enabled as it - # would lead to large indentation changes while we currently have - # several open PRs good to resolve first. - exclude_types: - - "javascript" - - # Autoformat and linting, misc. details - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 - hooks: - - id: end-of-file-fixer - - id: requirements-txt-fixer - - id: check-case-conflict - - id: check-executables-have-shebangs - - # Linting: Python code (see the file .flake8) - - repo: https://github.com/PyCQA/flake8 - rev: "6.0.0" - hooks: - - id: flake8 - -ci: - # pre-commit.ci will open PRs updating our hooks once a month - autoupdate_schedule: monthly diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 9cc05fa6..00000000 --- a/.prettierignore +++ /dev/null @@ -1 +0,0 @@ -nbgitpuller/templates/ diff --git a/.readthedocs.yaml b/.readthedocs.yaml deleted file mode 100644 index b165d7e5..00000000 --- a/.readthedocs.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# 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/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 7a804ac0..00000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,261 +0,0 @@ -## 1.0 - -### 1.1.1 - -([full changelog](https://github.com/jupyterhub/nbgitpuller/compare/1.1.0...1.1.1)) - -#### Enhancements made - -- Make links in the terminal clickable [#274](https://github.com/jupyterhub/nbgitpuller/pull/274) ([@yuvipanda](https://github.com/yuvipanda)) - -#### Bugs fixed - -- 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 - -- 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)) -- Make tests more robust [#271](https://github.com/jupyterhub/nbgitpuller/pull/271) ([@yuvipanda](https://github.com/yuvipanda)) - -#### Continuous integration improvements - -- ci: react to pushed tags [#262](https://github.com/jupyterhub/nbgitpuller/pull/262) ([@consideRatio](https://github.com/consideRatio)) - -#### Contributors to this release - -([GitHub contributors page for this release](https://github.com/jupyterhub/nbgitpuller/graphs/contributors?from=2022-03-19&to=2022-11-08&type=c)) - -[@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 - -([full changelog](https://github.com/jupyterhub/nbgitpuller/compare/1.0.2...1.1.0)) - -#### Enhancements made - -- Add retrolab support to link generator [#225](https://github.com/jupyterhub/nbgitpuller/pull/225) ([@yuvipanda](https://github.com/yuvipanda)) - -#### Bugs fixed - -- Fix sync problems after deleting files [#257](https://github.com/jupyterhub/nbgitpuller/pull/257) ([@jdmansour](https://github.com/jdmansour)) -- Use our own jinja2 template loader [#255](https://github.com/jupyterhub/nbgitpuller/pull/255) ([@yuvipanda](https://github.com/yuvipanda)) - -#### Maintenance and upkeep improvements - -- Remove binder folder with link_generator.ipynb [#249](https://github.com/jupyterhub/nbgitpuller/pull/249) ([@consideRatio](https://github.com/consideRatio)) -- Use async/await instead of gen.coroutine/yield [#246](https://github.com/jupyterhub/nbgitpuller/pull/246) ([@consideRatio](https://github.com/consideRatio)) - -#### Documentation improvements - -- Fix note format [#250](https://github.com/jupyterhub/nbgitpuller/pull/250) ([@brian-rose](https://github.com/brian-rose)) -- docs: adds docstrings (refactor: rename local parameter) [#242](https://github.com/jupyterhub/nbgitpuller/pull/242) ([@consideRatio](https://github.com/consideRatio)) -- DOC: Add link gen. screenshot, update example gif [#238](https://github.com/jupyterhub/nbgitpuller/pull/238) ([@consideRatio](https://github.com/consideRatio)) -- Update docs and remove unnecessary Sphinx configuration files [#237](https://github.com/jupyterhub/nbgitpuller/pull/237) ([@choldgraf](https://github.com/choldgraf)) -- Point people to the browser extension [#231](https://github.com/jupyterhub/nbgitpuller/pull/231) ([@yuvipanda](https://github.com/yuvipanda)) - -#### Other merged PRs - -- ci: test against python 3.7-3.10 [#245](https://github.com/jupyterhub/nbgitpuller/pull/245) ([@consideRatio](https://github.com/consideRatio)) -- Build docs using GitHub Actions, add linkcheck, and small tweaks to CI system [#232](https://github.com/jupyterhub/nbgitpuller/pull/232) ([@yuvipanda](https://github.com/yuvipanda)) -- Fix conf.py to work on newer versions of sphinx [#226](https://github.com/jupyterhub/nbgitpuller/pull/226) ([@yuvipanda](https://github.com/yuvipanda)) -- npm: auto-rebuild dist if js changed [#222](https://github.com/jupyterhub/nbgitpuller/pull/222) ([@manics](https://github.com/manics)) - -#### Contributors to this release - -([GitHub contributors page for this release](https://github.com/jupyterhub/nbgitpuller/graphs/contributors?from=2021-09-02&to=2022-03-18&type=c)) - -[@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.2 - 2021-09-03 - -A release to fix an issue that stopped us from publishing nbgitpuller on -conda-forge. - -#### Maintenance and upkeep improvements - -- Fix jupyter-packaging reference, use - instead of \_ [#219](https://github.com/jupyterhub/nbgitpuller/pull/219) ([@consideRatio](https://github.com/consideRatio)) - -### 1.0.1 - 2021-09-02 - -This release fixes a failure to install from a source distribution of the -package without having `node` and `npm` installed. - -#### Maintenance and upkeep improvements - -- Remove six from dev-requirements.txt [#213](https://github.com/jupyterhub/nbgitpuller/pull/213) ([@consideRatio](https://github.com/consideRatio)) -- Slim package.json to avoid fields relevant to npm publication [#212](https://github.com/jupyterhub/nbgitpuller/pull/212) ([@consideRatio](https://github.com/consideRatio)) -- Use jupyter-packaging for npm build [#211](https://github.com/jupyterhub/nbgitpuller/pull/211) ([@manics](https://github.com/manics)) - -#### Contributors to this release - -([GitHub contributors page for this release](https://github.com/jupyterhub/nbgitpuller/graphs/contributors?from=2021-09-01&to=2021-09-02&type=c)) - -[@consideRatio](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3AconsideRatio+updated%3A2021-09-01..2021-09-02&type=Issues) | [@manics](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Amanics+updated%3A2021-09-01..2021-09-02&type=Issues) - -### 1.0.0 - 2021-09-01 - -This is not a breaking release, we have just decided to let this be 1.0.0 to -better communicate changes via the version number in future releases. - -#### Enhancements made - -- Support use with jupyter_server by decoupling notebook dependencies [#193](https://github.com/jupyterhub/nbgitpuller/pull/193) ([@GeorgianaElena](https://github.com/GeorgianaElena)) - -#### Bugs fixed - -- Use addon instead of term when calling fit and import xterm css [#197](https://github.com/jupyterhub/nbgitpuller/pull/197) ([@GeorgianaElena](https://github.com/GeorgianaElena)) - -#### Maintenance and upkeep improvements - -- Rename nbgitpuller repo's master branch to main [#189](https://github.com/jupyterhub/nbgitpuller/pull/189) ([@consideRatio](https://github.com/consideRatio)) - -#### Documentation improvements - -- Update contributing guide to use `git-pull` [#202](https://github.com/jupyterhub/nbgitpuller/pull/202) ([@fperez](https://github.com/fperez)) - -#### Contributors to this release - -([GitHub contributors page for this release](https://github.com/jupyterhub/nbgitpuller/graphs/contributors?from=2021-06-24&to=2021-08-31&type=c)) - -[@choldgraf](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Acholdgraf+updated%3A2021-06-24..2021-08-31&type=Issues) | [@consideRatio](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3AconsideRatio+updated%3A2021-06-24..2021-08-31&type=Issues) | [@fmaussion](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Afmaussion+updated%3A2021-06-24..2021-08-31&type=Issues) | [@fperez](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Afperez+updated%3A2021-06-24..2021-08-31&type=Issues) | [@GeorgianaElena](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3AGeorgianaElena+updated%3A2021-06-24..2021-08-31&type=Issues) | [@manics](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Amanics+updated%3A2021-06-24..2021-08-31&type=Issues) | [@nibheis](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Anibheis+updated%3A2021-06-24..2021-08-31&type=Issues) | [@TimoRoth](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3ATimoRoth+updated%3A2021-06-24..2021-08-31&type=Issues) | [@welcome](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Awelcome+updated%3A2021-06-24..2021-08-31&type=Issues) | [@yuvipanda](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Ayuvipanda+updated%3A2021-06-24..2021-08-31&type=Issues) - -## 0.10 - -### 0.10.2 - 2021-08-25 - -This is a critical security release, please upgrade to this and see [GHSA-mq5p-2mcr-m52j](https://github.com/jupyterhub/nbgitpuller/security/advisories/GHSA-mq5p-2mcr-m52j) more information. - -### 0.10.1 - 2021-06-24 - -#### Bugs fixed - -- Added branch name back to command-line usage [#185](https://github.com/jupyterhub/nbgitpuller/pull/185) ([@sean-morris](https://github.com/sean-morris)) - -#### Documentation improvements - -- Provide cleaner feedback for lint vs test failures [#181](https://github.com/jupyterhub/nbgitpuller/pull/181) ([@yuvipanda](https://github.com/yuvipanda)) - -#### Continuous integration - -- Fix CI failures by disabling pip cache [#188](https://github.com/jupyterhub/nbgitpuller/pull/188) ([@consideRatio](https://github.com/consideRatio)) - -#### Contributors to this release - -([GitHub contributors page for this release](https://github.com/jupyterhub/nbgitpuller/graphs/contributors?from=2021-06-09&to=2021-06-24&type=c)) - -[@consideRatio](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3AconsideRatio+updated%3A2021-06-09..2021-06-24&type=Issues) | [@manics](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Amanics+updated%3A2021-06-09..2021-06-24&type=Issues) | [@sean-morris](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Asean-morris+updated%3A2021-06-09..2021-06-24&type=Issues) | [@yuvipanda](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Ayuvipanda+updated%3A2021-06-09..2021-06-24&type=Issues) - -### 0.10.0 - 2021-06-09 - -#### Enhancements made - -- UI: Branch input placeholder no longer suggests master branch [#180](https://github.com/jupyterhub/nbgitpuller/pull/180) ([@sean-morris](https://github.com/sean-morris)) -- Automatically detect default branch name [#179](https://github.com/jupyterhub/nbgitpuller/pull/179) ([@sean-morris](https://github.com/sean-morris)) -- Tell users about `main` vs `master` branches [#170](https://github.com/jupyterhub/nbgitpuller/pull/170) ([@yuvipanda](https://github.com/yuvipanda)) -- Support generating shiny links [#165](https://github.com/jupyterhub/nbgitpuller/pull/165) ([@yuvipanda](https://github.com/yuvipanda)) - -#### Bugs fixed - -- Handle lack of trailing slashes in hub URLs [#173](https://github.com/jupyterhub/nbgitpuller/pull/173) ([@yuvipanda](https://github.com/yuvipanda)) -- Respect path component of JupyterHub url [#172](https://github.com/jupyterhub/nbgitpuller/pull/172) ([@yuvipanda](https://github.com/yuvipanda)) -- Parse ssh git URLs properly [#163](https://github.com/jupyterhub/nbgitpuller/pull/163) ([@yuvipanda](https://github.com/yuvipanda)) -- Fix failure to restore deleted files (use raw output of git ls-files to avoid quoting unicode) [#156](https://github.com/jupyterhub/nbgitpuller/pull/156) ([@manics](https://github.com/manics)) -- Compare current branch to target - don't assume already on target branch locally [#141](https://github.com/jupyterhub/nbgitpuller/pull/141) ([@danlester](https://github.com/danlester)) - -#### Documentation improvements - -- Document restarting notebook process to see changes [#178](https://github.com/jupyterhub/nbgitpuller/pull/178) ([@yuvipanda](https://github.com/yuvipanda)) -- docs: update README.md badges [#175](https://github.com/jupyterhub/nbgitpuller/pull/175) ([@consideRatio](https://github.com/consideRatio)) -- Add best practices recommendation documentation [#169](https://github.com/jupyterhub/nbgitpuller/pull/169) ([@yuvipanda](https://github.com/yuvipanda)) -- Document how to do local development [#162](https://github.com/jupyterhub/nbgitpuller/pull/162) ([@yuvipanda](https://github.com/yuvipanda)) -- Add badges to README.md [#150](https://github.com/jupyterhub/nbgitpuller/pull/150) ([@consideRatio](https://github.com/consideRatio)) - -#### Continuous Integration - -- CI: Replace Travis with GitHub workflow [#161](https://github.com/jupyterhub/nbgitpuller/pull/161) ([@manics](https://github.com/manics)) -- CI: stop triggering CircleCI on automated pushes to gh-pages [#151](https://github.com/jupyterhub/nbgitpuller/pull/151) ([@consideRatio](https://github.com/consideRatio)) - -#### Contributors to this release - -([GitHub contributors page for this release](https://github.com/jupyterhub/nbgitpuller/graphs/contributors?from=2020-08-01&to=2021-06-09&type=c)) - -[@albertmichaelj](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Aalbertmichaelj+updated%3A2020-08-01..2021-06-09&type=Issues) | [@choldgraf](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Acholdgraf+updated%3A2020-08-01..2021-06-09&type=Issues) | [@consideRatio](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3AconsideRatio+updated%3A2020-08-01..2021-06-09&type=Issues) | [@danlester](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Adanlester+updated%3A2020-08-01..2021-06-09&type=Issues) | [@giumas](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Agiumas+updated%3A2020-08-01..2021-06-09&type=Issues) | [@manics](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Amanics+updated%3A2020-08-01..2021-06-09&type=Issues) | [@minrk](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Aminrk+updated%3A2020-08-01..2021-06-09&type=Issues) | [@ryanlovett](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Aryanlovett+updated%3A2020-08-01..2021-06-09&type=Issues) | [@SaladRaider](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3ASaladRaider+updated%3A2020-08-01..2021-06-09&type=Issues) | [@samuelmanzer](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Asamuelmanzer+updated%3A2020-08-01..2021-06-09&type=Issues) | [@sean-morris](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Asean-morris+updated%3A2020-08-01..2021-06-09&type=Issues) | [@ttimbers](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Attimbers+updated%3A2020-08-01..2021-06-09&type=Issues) | [@welcome](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Awelcome+updated%3A2020-08-01..2021-06-09&type=Issues) | [@yuvipanda](https://github.com/search?q=repo%3Ajupyterhub%2Fnbgitpuller+involves%3Ayuvipanda+updated%3A2020-08-01..2021-06-09&type=Issues) - -## 0.9 - -### 0.9.0 - 2020-09-1 - -- Allow destination to be configured ([#42](https://github.com/jupyterhub/nbgitpuller/pull/42)) -- Made the checkout from the reset_deleted_files to use the origin. ([#111](https://github.com/jupyterhub/nbgitpuller/pull/111)) -- Update version. ([#112](https://github.com/jupyterhub/nbgitpuller/pull/112)) -- Update index.rst ([#113](https://github.com/jupyterhub/nbgitpuller/pull/113)) -- Use shallow clones by default ([#117](https://github.com/jupyterhub/nbgitpuller/pull/117)) -- updating theme ([#126](https://github.com/jupyterhub/nbgitpuller/pull/126)) -- Update ipynb with newer query parameters and toggles ([#127](https://github.com/jupyterhub/nbgitpuller/pull/127)) -- Add a mybinder.org tab to the link builder ([#129](https://github.com/jupyterhub/nbgitpuller/pull/129)) -- tab activation on link generator ([#132](https://github.com/jupyterhub/nbgitpuller/pull/132)) -- fixing bug ([#134](https://github.com/jupyterhub/nbgitpuller/pull/134)) -- Fix typo from ipynb link generator external tool reference ([#136](https://github.com/jupyterhub/nbgitpuller/pull/136)) -- Use the correct branch for contentRepo ([#138](https://github.com/jupyterhub/nbgitpuller/pull/138)) -- Fix file paths or application paths ([#140](https://github.com/jupyterhub/nbgitpuller/pull/140)) -- Make the environment repo branch required for binder ([#143](https://github.com/jupyterhub/nbgitpuller/pull/143)) -- Travis pypi deployment, README fixes ([#145](https://github.com/jupyterhub/nbgitpuller/pull/145)) -- Replace data-8 with jupyterhub ([#146](https://github.com/jupyterhub/nbgitpuller/pull/146)) -- CI: fix broken test assertions following --depth 1 by default ([#147](https://github.com/jupyterhub/nbgitpuller/pull/147)) -- CI: ensure tox run's flake8 as well ([#148](https://github.com/jupyterhub/nbgitpuller/pull/148)) - -## 0.8 - -### 0.8.0 2019-11-23 - -- Link generator: init application type from query params ([#107](https://github.com/jupyterhub/nbgitpuller/pull/107)) -- Made the checkout from the reset_deleted_files to use the origin. ([#111](https://github.com/jupyterhub/nbgitpuller/pull/111)) - -## 0.7 - -### 0.7.2 - 2019-10-3 - -- Bump version number ([#103](https://github.com/jupyterhub/nbgitpuller/pull/103)) -- Set authorship info on each commit, rather than repo-wide ([#104](https://github.com/jupyterhub/nbgitpuller/pull/104)) -- Bump version number ([#105](https://github.com/jupyterhub/nbgitpuller/pull/105)) - -### 0.7.1 2019-10-3 - -- Update version to 0.7.0. ([#100](https://github.com/jupyterhub/nbgitpuller/pull/100)) -- Fix legacy links with empty path ([#102](https://github.com/jupyterhub/nbgitpuller/pull/102)) -- Bump version number ([#103](https://github.com/jupyterhub/nbgitpuller/pull/103)) - -### 0.7.0 2019-07-31 - -- adding a link generator binder ([#49](https://github.com/jupyterhub/nbgitpuller/pull/49)) -- Clean up link_generator notebook / app ([#50](https://github.com/jupyterhub/nbgitpuller/pull/50)) -- add link to TLJH guide in readme ([#52](https://github.com/jupyterhub/nbgitpuller/pull/52)) -- updating link sanitizing ([#54](https://github.com/jupyterhub/nbgitpuller/pull/54)) -- adds link to a basic video instruction ([#56](https://github.com/jupyterhub/nbgitpuller/pull/56)) -- Add new link generator instructions ([#62](https://github.com/jupyterhub/nbgitpuller/pull/62)) -- adding new nbgitpuller link gen app ([#63](https://github.com/jupyterhub/nbgitpuller/pull/63)) -- Implement depth/shallow-clone support ([#67](https://github.com/jupyterhub/nbgitpuller/pull/67)) -- Made repo_dir an absolute path based on the server_root_dir. ([#71](https://github.com/jupyterhub/nbgitpuller/pull/71)) -- Serve gh pages from docs/ not gh-pages ([#73](https://github.com/jupyterhub/nbgitpuller/pull/73)) -- Pass nbapp along to GitPuller so it can read from our configuration ([#75](https://github.com/jupyterhub/nbgitpuller/pull/75)) -- Rework nbgitpuller link generator ([#76](https://github.com/jupyterhub/nbgitpuller/pull/76)) -- Generate URLs that can be launched from canvas ([#78](https://github.com/jupyterhub/nbgitpuller/pull/78)) -- Don't require including cloned dir name in path to open ([#79](https://github.com/jupyterhub/nbgitpuller/pull/79)) -- adding documentation ([#81](https://github.com/jupyterhub/nbgitpuller/pull/81)) -- circle config to push docs ([#82](https://github.com/jupyterhub/nbgitpuller/pull/82)) -- documentation clarification ([#88](https://github.com/jupyterhub/nbgitpuller/pull/88)) -- Redo documentation ([#92](https://github.com/jupyterhub/nbgitpuller/pull/92)) -- Allow git@example.com:repo links ([#97](https://github.com/jupyterhub/nbgitpuller/pull/97)) - -## 0.6 - -### 0.6.1 2018-07-19 - -- Install Jupyter notebook extension by default, Add missing nbgitpuller.json file - -### 0.6.0 2018-07-18 - -- Work with (and require) newer notebook version ([#46](https://github.com/jupyterhub/nbgitpuller/pull/46)) -- Update README.md ([#48](https://github.com/jupyterhub/nbgitpuller/pull/48)) diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 100be3cf..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1,6 +0,0 @@ -include *.md -include LICENSE -include package.json -include setup.cfg -recursive-include nbfetch/static * -recursive-include nbfetch/templates * diff --git a/_config.yml b/_config.yml deleted file mode 100644 index f980e760..00000000 --- a/_config.yml +++ /dev/null @@ -1 +0,0 @@ -theme: jekyll-theme-slate diff --git a/dev-requirements.txt b/dev-requirements.txt deleted file mode 100644 index bdf678f1..00000000 --- a/dev-requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -jupyter-packaging>=0.10 -nbclassic -packaging -pytest -pytest-cov diff --git a/docs/Makefile b/docs/Makefile deleted file mode 100644 index e74b0547..00000000 --- a/docs/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -# Makefile for Sphinx documentation generated by sphinx-quickstart -# ---------------------------------------------------------------------------- - -# You can set these variables from the command line, and also -# from the environment for the first two. -SPHINXOPTS ?= -SPHINXBUILD ?= sphinx-build -SOURCEDIR = . -BUILDDIR = _build - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) - -.PHONY: help Makefile - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) - - -# Manually added commands -# ---------------------------------------------------------------------------- - -# For local development: -# - builds and rebuilds html on changes to source -# - starts a livereload enabled webserver and opens up a browser -devenv: - sphinx-autobuild -b html --open-browser "$(SOURCEDIR)" "$(BUILDDIR)/html" $(SPHINXOPTS) - -# For local development and CI: -# - verifies that links are valid -linkcheck: - $(SPHINXBUILD) -b linkcheck "$(SOURCEDIR)" "$(BUILDDIR)/linkcheck" $(SPHINXOPTS) - @echo - @echo "Link check complete; look for any errors in the above output " \ - "or in $(BUILDDIR)/linkcheck/output.txt." diff --git a/docs/_static/link_gen/link.js b/docs/_static/link_gen/link.js deleted file mode 100644 index ef67e1c4..00000000 --- a/docs/_static/link_gen/link.js +++ /dev/null @@ -1,279 +0,0 @@ -// Pure function that generates an nbgitpuller URL -function generateRegularUrl(hubUrl, urlPath, repoUrl, branch) { - - // assume hubUrl is a valid URL - var url = new URL(hubUrl); - - url.searchParams.set('repo', repoUrl); - - if (urlPath) { - url.searchParams.set('urlpath', urlPath); - } - - if (branch) { - url.searchParams.set('branch', branch); - } - - if (!url.pathname.endsWith('/')) { - url.pathname += '/' - } - url.pathname += 'hub/user-redirect/git-pull'; - - return url.toString(); -} - -function generateCanvasUrl(hubUrl, urlPath, repoUrl, branch) { - // assume hubUrl is a valid URL - var url = new URL(hubUrl); - - var nextUrlParams = new URLSearchParams(); - - nextUrlParams.append('repo', repoUrl); - - if (urlPath) { - nextUrlParams.append('urlpath', urlPath); - } - - if (branch) { - nextUrlParams.append('branch', branch); - } - - var nextUrl = '/hub/user-redirect/git-pull?' + nextUrlParams.toString(); - - if (!url.pathname.endsWith('/')) { - url.pathname += '/' - } - url.pathname += 'hub/lti/launch' - url.searchParams.append('next', nextUrl); - - return url.toString(); -} - -function generateBinderUrl(hubUrl, userName, repoName, branch, urlPath, - contentRepoUrl, contentRepoBranch) { - - var url = new URL(hubUrl); - - var nextUrlParams = new URLSearchParams(); - - nextUrlParams.append('repo', contentRepoUrl); - - if (urlPath) { - nextUrlParams.append('urlpath', urlPath); - } - - if (contentRepoBranch) { - nextUrlParams.append('branch', contentRepoBranch); - } - - var nextUrl = 'git-pull?' + nextUrlParams.toString(); - - var path = '/v2/gh/'; - url.pathname = path.concat(userName, "/", repoName, "/", branch); - url.searchParams.append('urlpath', nextUrl); - - return url.toString(); -} - -var apps = { - classic: { - title: 'Classic Notebook', - generateUrlPath: function (path) { return 'tree/' + path; }, - }, - retrolab: { - title: 'RetroLab', - generateUrlPath: function (path) { return 'retro/tree/' + path; }, - }, - jupyterlab: { - title: 'JupyterLab', - generateUrlPath: function (path) { return 'lab/tree/' + path; } - }, - shiny: { - title: 'Shiny', - generateUrlPath: function (path) { - // jupyter-shiny-proxy requires everything to end with a trailing slash - if (!path.endsWith("/")) { - path = path + "/"; - } - return 'shiny/' + path; - } - }, - rstudio: { - title: 'RStudio', - generateUrlPath: function (path) { return 'rstudio/'; } - } -} - -function changeTab(div) { - var hub = document.getElementById("hub"); - var hub_help_text = document.getElementById("hub-help-text"); - var env_repo = document.getElementById("repo"); - var env_repo_branch = document.getElementById("branch"); - var env_repo_help_text = document.getElementById("env-repo-help-text"); - var content_repo = document.getElementById("content-repo-group"); - var content_branch = document.getElementById("content-branch-group"); - var id = div.id; - - if (id.includes("binder")) { - hub.placeholder = "https://mybinder.org"; - hub.value = "https://mybinder.org"; - hub_help_text.hidden = true; - hub.labels[0].innerHTML = "BinderHub URL"; - env_repo.labels[0].innerHTML = "Git Environment Repository URL"; - env_repo_help_text.hidden = false; - env_repo_branch.required = true; - env_repo_branch.pattern = ".+"; - content_repo.hidden = false; - content_branch.hidden = false; - } else { - hub.placeholder = "https://hub.example.com"; - hub_help_text.hidden = false; - hub.labels[0].innerHTML = "JupyterHub URL"; - env_repo.labels[0].innerHTML = "Git Repository URL"; - env_repo_help_text.hidden = true; - env_repo_branch.required = false; - content_repo.hidden = true; - content_branch.hidden = true; - } -} - -/** - * Return name of directory git will clone given repo to. - * - * nbgitpuller needs to redirect users to *inside* the directory it - * just cloned. We copy the logic git itself uses to determine that. - * See https://github.com/git/git/blob/1c52ecf4ba0f4f7af72775695fee653f50737c71/builtin/clone.c#L276 - */ -function generateCloneDirectoryName(gitCloneUrl) { - var lastPart = gitCloneUrl.split('/').slice(-1)[0]; - return lastPart.split(':').slice(-1)[0].replace(/(\.git|\.bundle)?/, ''); -} - -function displayLink() { - var form = document.getElementById('linkgenerator'); - - form.classList.add('was-validated'); - if (form.checkValidity()) { - var hubUrl = document.getElementById('hub').value; - var repoUrl = document.getElementById('repo').value; - var branch = document.getElementById('branch').value; - var contentRepoUrl = document.getElementById('content-repo').value; - var contentRepoBranch = document.getElementById('content-branch').value; - var filePath = document.getElementById('filepath').value; - var appName = form.querySelector('input[name="app"]:checked').value; - var activeTab = document.querySelector(".nav-link.active").id; - - if (appName === 'custom') { - var urlPath = document.getElementById('urlpath').value; - } else { - var repoName = generateCloneDirectoryName(repoUrl); - var urlPath; - if (activeTab === "tab-auth-binder") { - var contentRepoName = new URL(contentRepoUrl).pathname.split('/').pop().replace(/\.git$/, ''); - urlPath = apps[appName].generateUrlPath(contentRepoName + '/' + filePath); - } else { - urlPath = apps[appName].generateUrlPath(repoName + '/' + filePath); - } - } - - if (activeTab === "tab-auth-default") { - document.getElementById('default-link').value = generateRegularUrl( - hubUrl, urlPath, repoUrl, branch - ); - } else if (activeTab === "tab-auth-canvas"){ - document.getElementById('canvas-link').value = generateCanvasUrl( - hubUrl, urlPath, repoUrl, branch - ); - } else if (activeTab === "tab-auth-binder"){ - // 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]; - document.getElementById('binder-link').value = generateBinderUrl( - hubUrl, userName, repoName, branch, urlPath, contentRepoUrl, contentRepoBranch - ); - } - } -} -function populateFromQueryString() { - // preseed values if specified in the url - var params = new URLSearchParams(window.location.search); - // Parameters are read from query string, and fields are set to them - var allowedParams = ['hub', 'repo', 'content-repo', 'branch', 'app', 'urlpath']; - if (params.has("urlpath")) { - // setting urlpath implies a custom app - document.getElementById('app-custom').checked = true; - } - for (var i = 0; i < allowedParams.length; i++) { - var param = allowedParams[i]; - if (params.has(param)) { - if ((param === 'app') && !params.has("urlpath")) { - radioId = 'app-' + params.get(param).toLowerCase(); - document.getElementById(radioId).checked = true; - } else { - document.getElementById(param).value = params.get(param); - } - } - } -} - -/** - * Main loop of the program. - * - * Called whenever any state changes (input received, page loaded, etc). - * Should turn on / off elements based only on current state, and display the link - * - * Sort of react-ish. - */ -function render() { - var form = document.getElementById('linkgenerator'); - var appName = form.querySelector('input[name="app"]:checked').value; - - if (appName == 'custom') { - document.getElementById('urlpath').disabled = false; - document.getElementById('filepath').disabled = true; - } else { - document.getElementById('urlpath').disabled = true; - - var app = apps[appName]; - if (!app.generateUrlPath) { - document.getElementById('filepath').disabled = true; - } else { - document.getElementById('filepath').disabled = false; - } - } - displayLink(); -} - -/** - * Entry point - */ -function linkMain() { - // Hook up any changes in form elements to call render() - document.querySelectorAll('#linkgenerator input[type="radio"]').forEach( - function (element) { - element.addEventListener('change', render); - } - ) - document.querySelectorAll('#linkgenerator input[type="text"], #linkgenerator input[type="url"]').forEach( - function (element) { - element.addEventListener('input', render); - } - ) - - populateFromQueryString(); - - // Activate tabs based on search parameters - var params = new URL(window.location).searchParams; - 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(); -} diff --git a/docs/_static/nbgitpuller-demo.gif b/docs/_static/nbgitpuller-demo.gif deleted file mode 100644 index 10e8d125..00000000 Binary files a/docs/_static/nbgitpuller-demo.gif and /dev/null differ diff --git a/docs/_static/nbgitpuller-link-generator.png b/docs/_static/nbgitpuller-link-generator.png deleted file mode 100644 index 0e686bbb..00000000 Binary files a/docs/_static/nbgitpuller-link-generator.png and /dev/null differ diff --git a/docs/conf.py b/docs/conf.py deleted file mode 100644 index c21428a1..00000000 --- a/docs/conf.py +++ /dev/null @@ -1,162 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -github_doc_root = "https://github.com/rtfd/recommonmark/tree/master/doc/" - - -def setup(app): - app.add_js_file("link_gen/link.js") - - -# -- General configuration ------------------------------------------------ - -# If your documentation needs a minimal Sphinx version, state it here. -# -# needs_sphinx = '1.0' - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ - "myst_parser", - "sphinx.ext.intersphinx", -] - -# Add any paths that contain templates here, relative to this directory. -templates_path = [] - -# The suffix(es) of source filenames. -# You can specify multiple suffix as a list of string: - -source_suffix = [".rst", ".md"] - - -# The root toctree document. -root_doc = master_doc = "index" - -# General information about the project. -project = "nbgitpuller" -copyright = "2021, The nbgitpuller Team" -author = "The nbgitpuller Team" - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The short X.Y version. -version = "0.1b" -# The full version, including alpha/beta/rc tags. -release = "0.1b" - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# -# This is also used if you do content translation via gettext catalogs. -# Usually you set "language" from the command line for these cases. -language = "en" - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This patterns also effect to html_static_path and html_extra_path -exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = "sphinx" - -# If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = False - -# -- Options for HTML output ---------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = "sphinx_book_theme" -html_title = "nbgitpuller documentation" - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -# -# html_theme_options = {} - -html_context = { - "github_user": "jupyterhub", - "github_repo": "nbgitpuller", - "github_version": "main", - "doc_path": "doc", - "source_suffix": source_suffix, -} - -html_theme_options = { - "repository_url": "https://github.com/jupyterhub/nbgitpuller", - "use_issues_button": True, - "use_repository_button": True -} - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ["_static"] - - -# -- Options for HTMLHelp output ------------------------------------------ - -# Output file base name for HTML help builder. -htmlhelp_basename = "nbgitpullerdoc" - - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # - # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). - # - # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. - # - # 'preamble': '', - # Latex figure (float) alignment - # - # 'figure_align': 'htbp', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - ( - root_doc, - "nbgitpuller.tex", - "nbgitpuller Documentation", - "The nbgitpuller Team", - "manual", - ) -] - - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [(root_doc, "nbgitpuller", "nbgitpuller Documentation", [author], 1)] - - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - ( - root_doc, - "nbgitpuller", - "nbgitpuller Documentation", - author, - "nbgitpuller", - "One line description of project.", - "Miscellaneous", - ) -] diff --git a/docs/contributing.md b/docs/contributing.md deleted file mode 100644 index 85097105..00000000 --- a/docs/contributing.md +++ /dev/null @@ -1,134 +0,0 @@ -# Contributing - -## Setup - -nbgitpuller is a jupyter extension that works with both the -[classic Notebook Server](https://jupyter-notebook.readthedocs.io/en/stable/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. - -1. Fork the nbgitpuller repository and `git clone` it to your local computer. - -2. Inside the nbgitpuller clone on your local machine, setup a virtual - environment to do development in - - ```bash - python3 -m venv venv - source venv/bin/activate - ``` - -3. Install development time dependencies in this virtual environment - - ```bash - pip install -r dev-requirements.txt - ``` - -4. Install nbgitpuller with its dependencies in this virtual environment - - ```bash - pip install -e . - ``` - -5. Install the NodeJS dependencies from package.json. - - ```bash - npm install - ``` - -6. Create the JS and CSS bundles. - - ```bash - npm run webpack - ``` - -7. Enable the nbgitpuller extension: - - - as a jupyter serverextension (classic Notebook Server extension) - - ```bash - jupyter serverextension enable --sys-prefix nbgitpuller - ``` - - - as a jupyter server extension - ```bash - jupyter server extension enable --sys-prefix nbgitpuller - ``` - -8. Start the notebook server: - - - You can either start the classical Notebook server. - This will open the classic notebook in your web - browser, and automatically authenticate you as a side effect. - - ```bash - jupyter notebook - ``` - - - Or you can start the new Jupyter Server. - - ```bash - jupyter server - ``` - - This won't open any notebook interface, unless you don't enable one - ([`nbclassic`](https://github.com/jupyterlab/nbclassic) or [`jupyterlab`](https://github.com/jupyterlab/jupyterlab)) - as a jupyter server extension. - - ```bash - jupyter server extension enable --sys-prefix nbclassic - ``` - - or - - ```bash - jupyter server extension enable --sys-prefix jupyterlab - ``` - -9. You can now test nbgitpuller locally, by hitting the `/git-pull` url with any - of the [URL query parameters](topic/url-options.rst). For example, to pull the - [data-8/textbook](https://github.com/data-8/textbook) repository's `gh-pages` - branch, you can use the following URL: - - ``` - http://localhost:8888/git-pull?repo=https://github.com/data-8/textbook&branch=gh-pages - ``` - -10. If you make changes to nbgitpuller's python code, you need to restart the `jupyter notebook` - process (started in step 5) to see your changes take effect. This is not needed if - you are only working on the javascript or css. - -## Running tests - -[pytest](https://docs.pytest.org/) is used to run unit and integration tests, -under the `tests/` directory. If you add new functionality, you should also add -tests to cover it. You can run the tests locally with `py.test tests/` - -## Building documentation - -[sphinx](https://www.sphinx-doc.org/) is used to write and maintain documentation, under -the `docs/` directory. If you add any new functionality, you should write documentaiton -for it as well. A mix of [reStructuredText](https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html) -and [MyST Markdown](https://myst-parser.readthedocs.io) is used to write our documentation, -although we would like to migrate purely to MyST markdown in the future. - -1. Install the packages needed to build the documentation - - ```bash - pip install -r docs/doc-requirements.txt - ``` - -2. Build the documentation by using `make` inside the `docs` folder. This will - internally call `sphinx` - - ```bash - cd docs - make html - ``` - -3. Preview the documentation by opening `_build/html/index.html` file in - your browser. From inside the `docs` folder, you can run either - `open _build/html/index.html` (on MacOS) or `xdg-open _build/html/index.html` - to quickly open the file in the browser. - -4. You can run `make html` again after making further changes to see their - effects. diff --git a/docs/doc-requirements.txt b/docs/doc-requirements.txt deleted file mode 100644 index e148b263..00000000 --- a/docs/doc-requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -myst_parser -sphinx-book-theme -sphinx_copybutton diff --git a/docs/index.md b/docs/index.md deleted file mode 100644 index e52903be..00000000 --- a/docs/index.md +++ /dev/null @@ -1,73 +0,0 @@ -# nbgitpuller - -`nbgitpuller` lets you distribute content to a Jupyter user via the click of a button! -This allows your users to focus on the content without needing to understand `git` -or other version control machinery. - -`nbgitpuller` provides {ref}`automatic, opinioned conflict resolution ` -by using `git` under the hood. -It is commonly used to distribute content to multiple users of a JupyterHub, though it works just fine on an individual person's computer, if they have Jupyter installed. - -Here's an example of `nbgitpuller` in action: - -1. The [nbgitpuller link generator](link) is used to create a link. - - ```{image} _static/nbgitpuller-link-generator.png - - ``` - -2. A user clicks the link, and the content is pulled into a live Jupyter session. - - ```{image} _static/nbgitpuller-demo.gif - - ``` - -## Use `nbgitpuller` - -See [](use.md) for information about how to use `nbgitpuller`. -Here's a short overview: - -1. Ensure your user has `nbgitpuller` installed. This is commonly done by installing it for all users of a JupyterHub. See [the installation instructions](install.rst) for more information. -2. Create an "`nbgitpuller` link" which points to the content you'd like to distribute (e.g., a Jupyter Notebook in a GitHub repository). -3. Tell your user to click the link, and `nbgitpuller` will automatically pull in the content to their file system. - -### Generate an nbgitpuller link - -There are several ways to generate an `nbgitpuller` link. -The two easiest ways to do so are: - -- Via a browser extension to generate links directly from your repository ([Chrome extension](https://chrome.google.com/webstore/detail/nbgitpuller-link-generato/hpdbdpklpmppnoibabdkkhnfhkkehgnc), [Firefox extension](https://addons.mozilla.org/en-US/firefox/addon/nbgitpuller-link-generator/?utm_source=addons.mozilla.org&utm_medium=referral&utm_content=search) -- Via a GUI web-app [at `nbgitpuller.link`](http://nbgitpuller.link) - -Fore more information about generating nbgitpuller links, see [](use.md). - -### When to use `nbgitpuller` - -Use nbgitpuller when: - -1. You want an easy way to distribute content (notebooks, markdown files, etc) to Jupyter users without requiring them to use `git`. -2. You have an alternative method for _collecting_ content from your users, as `nbgitpuller` does not "push", it only "pulls". - -You should **not** use nbgitpuller when: - -1. Users want to **push** to a `git` repository that has your content. - In this case, you should instruct them to just use `git` directly, - since the assumptions and design of nbgitpuller will surprise you in - unexpected ways if you are pushing with git but pulling with nbgitpuller. -2. Users want to perform **manual git operations** locally. - Mixing manual git operations + automatic nbgitpuller operations will - cause unwelcome surprises. - -## Full Contents - -```{toctree} -:maxdepth: 2 - -install -use -contributing -topic/automatic-merging -topic/url-options -topic/repo-best-practices -link -``` diff --git a/docs/install.rst b/docs/install.rst deleted file mode 100644 index 57d5c17d..00000000 --- a/docs/install.rst +++ /dev/null @@ -1,47 +0,0 @@ -.. _install: - -============ -Installation -============ - -nbgitpuller can work on any computer, but it is most-commonly used with a JupyterHub. -By installing nbgitpuller in the user environment for your hub, it means that -all users will be able to click nbgitpuller links to get the content. - -.. admonition:: To set up a JupyterHub - :class: tip - - If you do *not* have a JupyterHub, we recommend trying out `The Littlest - JupyterHub `_ to set one up. - It comes built in with nbgitpuller. - - For more information about JupyterHub, see - `the JupyterHub Documentation `_. - -You can install ``nbgitpuller`` from PyPI with ``pip``: - -.. code:: bash - - pip install nbgitpuller - -.. note:: - - If you use multiple environments in your JupyterHub, make sure you install - nbgitpuller in the environment that the jupyter notebook or - jupyter server process is running from. You can validate this by running - `jupyter serverextension list` - it should have an entry that says `nbgitpuller enabled`. - - -Troubleshooting -=============== - -nbgitpuller link shows `404 Not Found` --------------------------------------- - -If you are on an old version of Jupyter Notebook, you might get a `404 Not Found` -error when trying to access an nbgitpuller link. You might need to manually enable -the server extension that handles nbgitpuller. - -.. code:: bash - - jupyter serverextension enable nbgitpuller --sys-prefix diff --git a/docs/link.rst b/docs/link.rst deleted file mode 100644 index 14836faa..00000000 --- a/docs/link.rst +++ /dev/null @@ -1,207 +0,0 @@ -nbgitpuller link generator -========================== - -Use the following form to create your own ``nbgitpuller`` links. - -.. note:: - - Consider using the `nbgitpuller link generator browser extension `_ - instead! Available for `Firefox `_ and - `Chrome `_. - - -.. raw:: html - -
-
- -
- - - -
-
- -
-
- -
-
- -
-
-
- -
- -
- -
- Must be a valid web URL -
- - The JupyterHub to send users to. - nbgitpuller must be installed in this hub. - -
-
- -
- -
- -
- Must be a valid git URL -
- -
-
-
-
- branch -
- - - Use main instead of master for - - new GitHub repositories - -
- Must specify a branch name -
-
-
-
- - - -
- -
- - - This file or directory from within the repo will open when user clicks the link. - -
-
- -
-
- - - -
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - - -
-
-
- -
-
-


- - - - -**Pre-populating some fields in the link generator** - -You can pre-populate some fields in order to make it easier for some -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 -* ``branch`` is the branch you wish to pull from the Repository - -For example, the following URL will pre-populate the form with the -UC Berkeley DataHub as the JupyterHub:: - - https://nbgitpuller.readthedocs.io/link.html?hub=https://datahub.berkeley.edu - - -**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=`` query parameter. Here are the possible values: - -* ``?tab=binder`` - activates the Binder tab -* ``?tab=canvas`` - activates the Canvas tab diff --git a/docs/topic/automatic-merging.rst b/docs/topic/automatic-merging.rst deleted file mode 100644 index 5aa6e4ec..00000000 --- a/docs/topic/automatic-merging.rst +++ /dev/null @@ -1,61 +0,0 @@ -.. _topic/automatic-merging: - -========================== -Automatic Merging Behavior -========================== - -``nbgitpuller`` tries to make sure the end user who clicked the link -**never** has to manually interact with the git repo. This requires us to -make some opinionated choices on how we handle various cases where both the -student (end user) and instructor (author of the repo) repo have modified the -repository. - -Here, we describe how we handle the various possible cases each time the -student clicks the nbgitpuller link. - -Case 1: The instructor changed a file that the student has not changed -====================================================================== - -The student's changes are left alone, and the instructor's changes are pulled -in to the local copy. Most common case. This is also what happens when the -instructor adds a new file / directory. - -Case 2: Student & instructor changed different lines in same file -================================================================= - -Very similar to case 1 - the student's changes are left alone, and the -instructor's changes are merged in to the existing local file. - -Case 3: Student & instructor change same lines in same file -=========================================================== - -In this case, we **always keep the student's changes**. We want to never -accidentally lose a student's changes - ``nbgitpuller`` will not eat your -homework. - -Case 4: Student deletes file locally, but instructor doesn't -============================================================ - -If the student has deleted a file locally, but the file is still present in -the remote repo, the file from the remote repo is pulled into the student's -directory. This enables the use case where a student wants to 'start over' -a file after having made many changes to it. They can simply delete the file, -click the nbgitpuller link again, and get a fresh copy. - -Case 5: Student creates file manually, but instructor adds file with same name -============================================================================== - -As an example, let's say the student manually creates a file named -``Untitled141.ipynb`` in the directory where nbgitpuller has pulled a -repository. At some point afterwards, the instructor creates a file *also* -named ``Untitled141.ipynb`` and pushes it to the repo. - -When the student clicks the nbgitpuller link next, we want to make sure we -don't destroy the student's work. Since they were created in two different -places, the likelihood of them being mergeable is low. So we **rename** the -student's file, and pull the instructor's file. So the student's -``Untitled141.ipynb`` file will be renamed to -``Untitled141_.ipynb``, and the instructor's file will be kept at -``Untitled141.ipynb``. - -This is a fairly rare case in our experience. diff --git a/docs/topic/repo-best-practices.md b/docs/topic/repo-best-practices.md deleted file mode 100644 index 9376e3b3..00000000 --- a/docs/topic/repo-best-practices.md +++ /dev/null @@ -1,40 +0,0 @@ -# Content git repository best practices - -Sometimes, git's flexibility can lead to repositories that cause issues -when used with nbgitpuller. Here are some recommendations to make your -nbgitpuller experience smoother. - -## Never force push - -Never use `--force` or `--force-with-lease` when pushing to your repositories. -This is general good git practice, and unless you have [fairly deep -understanding](https://xkcd.com/1597/) of how git works, it might screw up some -of your users' local repositories beyond repair. - -If you are using GitHub, you should enable [protected branches](https://docs.github.com/en/github/administering-a-repository/about-protected-branches) -to prevent accidental force pushes. - -## Prevent your repos from becoming huge - -Larger git repos increase chances of timeouts and other intermittent failures -that will be difficult to debug. They might leave your git repo in strange states -too - contents fetched but not checked out, half-fetched, etc. Try and keep it small - -under 100MB is great, under 1G is ok, but anything more is probably asking for trouble. - -Large datasets are the biggest reason for increasing repository sizes. Try distribute -datasets some other way, use a subset of data, or compress your data if you need to. - -## Don't add `.ipynb_checkpoints` (and similar files) to your git repo - -Jupyter uses a hidden `.ipynb_checkpoints` directory to temporarily autosave copies of the -notebook. If you accidentally commit your local computer's copy of this to the git repo, -it can cause hard to debug issues when students click nbgitpuller links. The students' -Jupyter Notebook servers in the JupyterHub will also generate `.ipynb_checkpoints` for -autosaving, and conflicts between these two can cause issues. Similar issues can happen -with other temporary, hidden files - like `.DS_Store`, `__pycache__`, etc. - -Adding `.ipynb_checkpoints` to your repo's `.gitignore` file will eliminate this -class of issues completely. `git add` and similar commands will no longer -accidentally include them in your repo. You can download this [python specific -gitignore](https://github.com/github/gitignore/blob/master/Python.gitignore) -file and put it in your repo as `.gitignore`, and it should take care of this. diff --git a/docs/topic/url-options.rst b/docs/topic/url-options.rst deleted file mode 100644 index 7a6a0f5b..00000000 --- a/docs/topic/url-options.rst +++ /dev/null @@ -1,110 +0,0 @@ -.. _topic/url-options: - -============================= -Options in an nbgitpuller URL -============================= - -.. note:: - - If you just want to generate an nbgitpuller link, we highly - 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 -the various options available, and their behavior. - -``repo`` -======== - -The path to the git repository to be pulled from. This will accept -any parameter that can be passed to a ``git clone`` command. - -``branch`` -========== - -Branch in the git repo to pull from. Defaults to ``master``. - -``urlpath`` -=========== - -The URL to redirect the user to after synchronization has been complete. This -URL is primarily used to open a specific file or directory in a specific -application. This URL is interpreted relative to the base of the notebook -server. The URL to be specified depends on the application you want -the file to be opened in. - -.. warning:: - - ```` is relative to the directory the notebook - server was launched in - so the directory you see if you login to - JupyterHub regularly. This means you **must** include the name of - the local repository directory too, otherwise nbgitpuller can not - find the file. - - 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 :doc:`link generator <../link>` - takes care of all of this for you, so it is recommended to use that. - - -Classic Jupyter Notebook ------------------------- - -To open a notebook, file or directory in the classic Jupyter Notebook -interface, your pattern should be: ``/tree/``. - -JupyterLab ----------- - -To open a notebook, file or directory in the classic Jupyter Notebook -interface, your pattern should be: -``/lab/tree/%3Fautodecode``. - -The ``%3Fautodecode`` at the end makes sure you never get `a message -`_ about needing to -explicitly name a JupyterLab workspace. - -Shiny ------ - -To open a directory containing `shiny `_ files, -your pattern should be ``/shiny//``. The trailing -slash is important. - -RStudio -------- - -If you have RStudio installed and set up for use with your JupyterHub, -you can pass ``/rstudio`` to ``urlpath`` to open RStudio after the -repo has been pulled. You can not have RStudio open a specific file -or directory, unfortunately. - -``depth`` -========= - -How deep to clone the git repo on initial pull. By default, the -entire history of the git repository is pulled. This might be -slow if your git repository is large. You can set this to 1 to -pull only the latest commit on initial pull. - -Only explicitly set this if you are actively having performance -problems. - - -``targetPath`` -============== - -Where to place the repository when it is cloned. -By default, Git repositories are cloned into the default working directory. -You can specify a different parent directory for the clone by setting the environment variable ``NBGITPULLER_PARENTPATH``, this should be relative to the working directory. -If you require full control over the destination directory, or want to set the directory at runtime in the nbgitpuller link use this parameter. - - -Deprecated parameters -===================== - -The following parameters are currently deprecated, and will be removed in -a future version: ``subpath``, ``app``. diff --git a/docs/use.md b/docs/use.md deleted file mode 100644 index 842b6862..00000000 --- a/docs/use.md +++ /dev/null @@ -1,54 +0,0 @@ -# Using `nbgitpuller` - -## Overview of `nbgitpuller` links - -`nbgitpuller`links may be sent to your users via any method you like - websites, emails, a learning management system, etc. -This link will contain at least the following information: - -1. The location of the JupyterHub you are sending them to. -2. The git repository where you have published your content. -3. Optionally, a particular file or directory you want to automatically open after the content is pulled. -4. Optionally, which UI should be opened when the user clicks the link. - By default `nbgitpuller` uses the classic notebook interface - but you may instead use - [JupyterLab](https://github.com/jupyterlab/jupyterlab/), [RStudio](https://github.com/jupyterhub/jupyter-rsession-proxy/), [Linux Desktop](https://github.com/jupyterhub/jupyter-remote-desktop-proxy), etc based on what you have available in your JupyterHub. - open for your students once the repository has been synchronized. Note the entire repository will be copied, not just the specified file. - -The first time a particular student clicks the link, a local copy of the -repository is made for the student. On successive clicks, the latest version -of the remote repository is fetched, and merged automatically with the -student's local copy using a {ref}`series of rules ` -that ensure students never get merge conflicts nor lose any of their changes. - -## Create an `nbgitpuller` link via a web extension - -The easiest way to create an `nbgitpuller` link is via a web extension ([github repo](https://github.com/yuvipanda/nbgitpuller-link-generator-webextension)). -This allows you to quickly generate an `nbgitpuller` link directly from the content in your repository (e.g., on GitHub). -See the links below to download the extension. - -- [Chrome extension](https://chrome.google.com/webstore/detail/nbgitpuller-link-generato/hpdbdpklpmppnoibabdkkhnfhkkehgnc) -- [Firefox extension](https://addons.mozilla.org/en-US/firefox/addon/nbgitpuller-link-generator/?utm_source=addons.mozilla.org&utm_medium=referral&utm_content=search) - -## Automatically create an `nbgitpuller` link via a web app - -You can also create an `nbgitpuller` link via a GUI web app at the below link: - -[nbgitpuller.link](http://nbgitpuller.link) - -This contains a simple web form where you paste the location of the content you'd like your users to pull, and it will generate a link for you to distribute. - -## Manually create an `nbgitpuller` link - -There is a short video showing - -```{raw} html - -``` - -If you are interested in the details of available options when creating -the link, we have a {ref}`list of options ` as well. diff --git a/package.json b/package.json deleted file mode 100644 index 2a7cff80..00000000 --- a/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Dependencies to build nbgitpuller/static/dist/bundle.js from nbgitpuller/static/js/index.js with webpack.", - "devDependencies": { - "css-loader": "^6.2.0", - "style-loader": "^3.2.1", - "webpack": "^5.45.1", - "webpack-cli": "^4.7.2" - }, - "dependencies": { - "xterm": "^4.18.0", - "xterm-addon-fit": "^0.5.0", - "xterm-addon-web-links": "^0.5.1" - }, - "scripts": { - "webpack": "webpack", - "webpack:watch": "webpack --watch" - } -} diff --git a/pyproject.toml b/pyproject.toml deleted file mode 100644 index e7467386..00000000 --- a/pyproject.toml +++ /dev/null @@ -1,48 +0,0 @@ -[build-system] -requires = [ - "build", - "jupyter-packaging>=0.10", - "setuptools", -] -build-backend = "setuptools.build_meta" - - -# autoflake is used for autoformatting Python code -# -# ref: https://github.com/PyCQA/autoflake#readme -# -[tool.autoflake] -ignore-init-module-imports = true -remove-all-unused-imports = true -remove-duplicate-keys = true -#remove-unused-variables = true - - -# isort is used for autoformatting Python code -# -# ref: https://pycqa.github.io/isort/ -# -[tool.isort] -profile = "black" - - -# black is used for autoformatting Python code -# -# ref: https://black.readthedocs.io/en/stable/ -# -[tool.black] -skip-string-normalization = true -# target-version should be all supported versions, see -# https://github.com/psf/black/issues/751#issuecomment-473066811 -target_version = [ - "py37", - "py38", - "py39", - "py310", - "py311", -] - -[tool.pytest.ini_options] -markers = [ - "jupyter_server: configure the jupyter_server fixture" -] diff --git a/tests/repohelpers.py b/tests/repohelpers.py deleted file mode 100644 index 98bfd110..00000000 --- a/tests/repohelpers.py +++ /dev/null @@ -1,88 +0,0 @@ -""" -Helper classes for creating git repos -""" -import os -import tempfile -import shutil -import subprocess as sp -from uuid import uuid4 - -from packaging.version import Version as V -from nbgitpuller import GitPuller - - -class Repository: - def __init__(self, path=None): - if path is None: - path = os.path.join(tempfile.gettempdir(), str(uuid4())) - self.path = path - - def __enter__(self): - os.makedirs(self.path, exist_ok=True) - - # --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): - shutil.rmtree(self.path) - - def write_file(self, path, content): - with open(os.path.join(self.path, path), 'w') as f: - f.write(content) - - def read_file(self, path): - with open(os.path.join(self.path, path)) as f: - return f.read() - - def git(self, *args): - return sp.check_output( - ['git'] + list(args), - cwd=self.path, - stderr=sp.STDOUT - ).decode().strip() - - -class Remote(Repository): - pass - - -class Pusher(Repository): - def __init__(self, remote, path=None): - self.remote = remote - super().__init__(path=path) - - def __enter__(self): - sp.check_output(['git', 'clone', self.remote.path, self.path]) - self.git('config', '--local', 'user.email', 'pusher@example.com') - self.git('config', '--local', 'user.name', 'pusher') - return self - - def push_file(self, path, content): - self.write_file(path, content) - self.git('add', path) - self.git('commit', '-am', 'Ignore the message') - self.git('push', 'origin', 'master') - - -class Puller(Repository): - def __init__(self, remote, path=None, branch="master", *args, **kwargs): - super().__init__(path) - remotepath = "file://%s" % os.path.abspath(remote.path) - self.gp = GitPuller(remotepath, self.path, branch=branch, *args, **kwargs) - - def pull_all(self): - for line in self.gp.pull(): - print('{}: {}'.format(self.path, line.rstrip())) - - def __enter__(self): - print() - self.pull_all() - self.git('config', '--local', 'user.email', 'puller@example.com') - self.git('config', '--local', 'user.name', 'puller') - return self diff --git a/tests/test_api.py b/tests/test_api.py deleted file mode 100644 index 55172ca9..00000000 --- a/tests/test_api.py +++ /dev/null @@ -1,163 +0,0 @@ -import os -from http.client import HTTPConnection -import subprocess -import time -from urllib.parse import urlencode -from uuid import uuid4 -import pytest - -from repohelpers import Pusher, Remote - -PORT = os.getenv('TEST_PORT', 18888) - - -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) - 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}" - - -@pytest.fixture -def jupyterdir(tmpdir): - path = tmpdir.join("jupyter") - path.mkdir() - return str(path) - - -@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, jupyter_server): - """ - 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')) diff --git a/webpack.config.js b/webpack.config.js deleted file mode 100644 index f636d324..00000000 --- a/webpack.config.js +++ /dev/null @@ -1,20 +0,0 @@ -const webpack = require('webpack'); - -module.exports = { - context: __dirname + "/nbgitpuller/static/", - entry: "./js/index.js", - output: { - path: __dirname + "/nbgitpuller/static/dist/", - filename: "bundle.js", - publicPath: '/static/dist/' - }, - module: { - rules: [ - { - test: /\.css$/i, - use: ['style-loader', 'css-loader'] - }, - ] - }, - devtool: 'source-map' -}