[![Conda Version](https://img.shields.io/conda/vn/conda-forge/nbgitpuller-link.svg)](https://anaconda.org/conda-forge/nbgitpuller-link)
[![PyPI](https://img.shields.io/pypi/v/nbgitpuller-link)](https://pypi.org/project/nbgitpuller-link/)
[![Build/Test CI](https://github.com/mdpiper/nbgitpuller-link/actions/workflows/build-test-ci.yml/badge.svg)](https://github.com/mdpiper/nbgitpuller-link/actions/workflows/build-test-ci.yml)
# nbgitpuller-link
Generate an [nbgitpuller](https://jupyterhub.github.io/nbgitpuller/index.html) link
through a command-line interface or Python code.
## Installation
Install the latest stable release of *nbgitpuller-link* with `pip`:
```
pip install nbgitpuller-link
```
or with `conda`:
```
conda install nbgitpuller-link -c conda-forge
```
To install from source, after cloning or downloading the *nbgitpuller-link* [repository](https://github.com/mdpiper/nbgitpuller-link),
change into the repository directory
and install the package with `pip`:
```
pip install -e .
```
## Examples
The *nbgitpuller-link* package includes a CLI and a Python API.
The repository holds short [examples](https://github.com/mdpiper/nbgitpuller-link/tree/main/examples)
of both, which are adapted here.
### Shell
To see how to use the CLI,
call `nbgitpuller-link` with the `--help` option:
```bash
$ nbgitpuller-link --help
Usage: nbgitpuller-link [OPTIONS]
Generate an nbgitpuller link to load a repository on a JupyterHub
Options:
--version Show the version and exit.
--jupyterhub-url TEXT Target JupyterHub for link. [required]
--repository-url TEXT Source repository for link. [required]
--branch TEXT Branch to use from source repository. [default:
main]
--launch-path TEXT Relative path to file or directory in source
repository to launch on target JupyterHub.
[default: ]
--interface [notebook|lab] Open with classic Jupyter Notebook interface or
next-generation JupyterLab. [default: notebook]
--help Show this message and exit.
```
Generate a link to load a repository on a JupyterHub,
specifying the file to launch
and the branch to use:
```bash
nbgitpuller-link \
--jupyterhub-url=https://lab.openearthscape.org \
--repository-url=https://github.com/csdms/ivy \
--branch=main \
--launch-path=lessons/bmi/index.ipynb
```
The resulting link:
```bash
https://lab.openearthscape.org/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2Fcsdms%2Fivy&urlpath=tree%2Fivy%2Flessons%2Fbmi%2Findex.ipynb&branch=main
```
### Python
Start a Python session and import the `Link` class from the *nbgitpuller-link* package:
```python
from nbgitpuller_link import Link
```
Generate a link though a `Link` instance:
```python
linker = Link(
jupyterhub_url="https://lab.openearthscape.org",
repository_url="https://github.com/csdms/ivy",
branch="main",
launch_path="lessons/bmi/index.ipynb",
interface="lab",
)
```
Note that this example uses the JupyterLab interface.
The `link` property holds the URL:
```python
print(f"The nbgitpuller link is:\n{linker.link}")
```
```
The nbgitpuller link is:
https://lab.openearthscape.org/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2Fcsdms%2Fivy&urlpath=lab%2Ftree%2Fivy%2Flessons%2Fbmi%2Findex.ipynb%3Fautodecode&branch=main
```
Changes: nbgitpuller-link
=========================
0.2.5 (2024-03-25)
------------------
- Test on Python 3.12, set minimum to 3.10 (#15)
0.2.4 (2023-01-11)
------------------
- Use nox for build system management (#13)
- Update examples (#12)
0.2.3 (2022-12-01)
------------------
- Fix incorrect urllib.parse import
0.2.2 (2022-07-21)
------------------
- Update contents of built distributions (#9)
0.2.1 (2022-06-22)
------------------
- Get DOI from Zenodo and add CITATION.cff
- Move metadata from setup.cfg to pyproject.toml (#8)
0.2 (2021-03-04)
----------------
- Add choice of classic Notebook or JupyterLab interface
- Test against known link
0.1 (2021-02-28)
----------------
- Initial release
MIT License
===========
Copyright (c) 2021 Mark Piper
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Raw data
{
"_id": null,
"home_page": null,
"name": "nbgitpuller-link",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "Mark Piper <mark.piper@colorado.edu>",
"keywords": "jupyter, jupyterhub, notebook, git, nbgitpuller",
"author": null,
"author_email": "Mark Piper <mark.piper@colorado.edu>",
"download_url": "https://files.pythonhosted.org/packages/07/80/88dc8bcdbc616456a1bc2537b178b05ec3525c135e7affab2436ad1b423a/nbgitpuller-link-0.2.5.tar.gz",
"platform": null,
"description": "[![Conda Version](https://img.shields.io/conda/vn/conda-forge/nbgitpuller-link.svg)](https://anaconda.org/conda-forge/nbgitpuller-link)\n[![PyPI](https://img.shields.io/pypi/v/nbgitpuller-link)](https://pypi.org/project/nbgitpuller-link/)\n[![Build/Test CI](https://github.com/mdpiper/nbgitpuller-link/actions/workflows/build-test-ci.yml/badge.svg)](https://github.com/mdpiper/nbgitpuller-link/actions/workflows/build-test-ci.yml)\n\n# nbgitpuller-link\n\nGenerate an [nbgitpuller](https://jupyterhub.github.io/nbgitpuller/index.html) link\nthrough a command-line interface or Python code.\n\n## Installation\n\nInstall the latest stable release of *nbgitpuller-link* with `pip`:\n```\npip install nbgitpuller-link\n```\nor with `conda`:\n```\nconda install nbgitpuller-link -c conda-forge\n```\n\nTo install from source, after cloning or downloading the *nbgitpuller-link* [repository](https://github.com/mdpiper/nbgitpuller-link),\nchange into the repository directory\nand install the package with `pip`:\n```\npip install -e .\n```\n\n## Examples\n\nThe *nbgitpuller-link* package includes a CLI and a Python API.\nThe repository holds short [examples](https://github.com/mdpiper/nbgitpuller-link/tree/main/examples)\nof both, which are adapted here.\n\n### Shell\n\nTo see how to use the CLI,\ncall `nbgitpuller-link` with the `--help` option:\n```bash\n$ nbgitpuller-link --help\nUsage: nbgitpuller-link [OPTIONS]\n\n Generate an nbgitpuller link to load a repository on a JupyterHub\n\nOptions:\n --version Show the version and exit.\n --jupyterhub-url TEXT Target JupyterHub for link. [required]\n --repository-url TEXT Source repository for link. [required]\n --branch TEXT Branch to use from source repository. [default:\n main]\n --launch-path TEXT Relative path to file or directory in source\n repository to launch on target JupyterHub.\n [default: ]\n --interface [notebook|lab] Open with classic Jupyter Notebook interface or\n next-generation JupyterLab. [default: notebook]\n --help Show this message and exit.\n``` \n\nGenerate a link to load a repository on a JupyterHub,\nspecifying the file to launch\nand the branch to use:\n```bash\nnbgitpuller-link \\\n --jupyterhub-url=https://lab.openearthscape.org \\\n --repository-url=https://github.com/csdms/ivy \\\n --branch=main \\\n --launch-path=lessons/bmi/index.ipynb\n```\n\nThe resulting link:\n```bash\nhttps://lab.openearthscape.org/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2Fcsdms%2Fivy&urlpath=tree%2Fivy%2Flessons%2Fbmi%2Findex.ipynb&branch=main\n```\n\n### Python\n\nStart a Python session and import the `Link` class from the *nbgitpuller-link* package:\n```python\nfrom nbgitpuller_link import Link\n```\n\nGenerate a link though a `Link` instance:\n```python\nlinker = Link(\n jupyterhub_url=\"https://lab.openearthscape.org\",\n repository_url=\"https://github.com/csdms/ivy\",\n branch=\"main\",\n launch_path=\"lessons/bmi/index.ipynb\",\n interface=\"lab\",\n )\n```\nNote that this example uses the JupyterLab interface.\n\nThe `link` property holds the URL:\n```python\nprint(f\"The nbgitpuller link is:\\n{linker.link}\")\n```\n```\nThe nbgitpuller link is:\nhttps://lab.openearthscape.org/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2Fcsdms%2Fivy&urlpath=lab%2Ftree%2Fivy%2Flessons%2Fbmi%2Findex.ipynb%3Fautodecode&branch=main\n```\n\nChanges: nbgitpuller-link\n=========================\n\n0.2.5 (2024-03-25)\n------------------\n\n- Test on Python 3.12, set minimum to 3.10 (#15)\n\n\n0.2.4 (2023-01-11)\n------------------\n\n- Use nox for build system management (#13)\n- Update examples (#12)\n\n\n0.2.3 (2022-12-01)\n------------------\n\n- Fix incorrect urllib.parse import\n\n\n0.2.2 (2022-07-21)\n------------------\n\n- Update contents of built distributions (#9)\n\n\n0.2.1 (2022-06-22)\n------------------\n\n- Get DOI from Zenodo and add CITATION.cff\n- Move metadata from setup.cfg to pyproject.toml (#8)\n\n\n0.2 (2021-03-04)\n----------------\n\n- Add choice of classic Notebook or JupyterLab interface\n- Test against known link\n\n\n0.1 (2021-02-28)\n----------------\n\n- Initial release\n\nMIT License\n===========\n\nCopyright (c) 2021 Mark Piper\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Create an nbgitpuller link",
"version": "0.2.5",
"project_urls": {
"Changelog": "https://github.com/mdpiper/nbgitpuller-link/blob/main/CHANGES.md",
"Documentation": "https://github.com/mdpiper/nbgitpuller-link#readme",
"Homepage": "https://github.com/mdpiper/nbgitpuller-link",
"Repository": "https://github.com/mdpiper/nbgitpuller-link"
},
"split_keywords": [
"jupyter",
" jupyterhub",
" notebook",
" git",
" nbgitpuller"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "683a4d6509c00ad60bd2d24b221a5d3e8e25e40246be89639d5b1da4949d6fdd",
"md5": "4a66a51d4b1222bc90c63854e5b3c8f4",
"sha256": "b32f362924956965e200615aac8424e356aa174022cfb4960c88eeef128d0fd3"
},
"downloads": -1,
"filename": "nbgitpuller_link-0.2.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4a66a51d4b1222bc90c63854e5b3c8f4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 6568,
"upload_time": "2024-03-25T18:50:58",
"upload_time_iso_8601": "2024-03-25T18:50:58.520773Z",
"url": "https://files.pythonhosted.org/packages/68/3a/4d6509c00ad60bd2d24b221a5d3e8e25e40246be89639d5b1da4949d6fdd/nbgitpuller_link-0.2.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "078088dc8bcdbc616456a1bc2537b178b05ec3525c135e7affab2436ad1b423a",
"md5": "fd6485a430d8bf550bc9c70720a812e5",
"sha256": "3cdb47ab8a0bb6ed90c93b6d26056a55035e6a20fb3e97ee1f2083836da1a390"
},
"downloads": -1,
"filename": "nbgitpuller-link-0.2.5.tar.gz",
"has_sig": false,
"md5_digest": "fd6485a430d8bf550bc9c70720a812e5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 9476,
"upload_time": "2024-03-25T18:51:00",
"upload_time_iso_8601": "2024-03-25T18:51:00.211905Z",
"url": "https://files.pythonhosted.org/packages/07/80/88dc8bcdbc616456a1bc2537b178b05ec3525c135e7affab2436ad1b423a/nbgitpuller-link-0.2.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-25 18:51:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mdpiper",
"github_project": "nbgitpuller-link",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "nbgitpuller-link"
}