-
Notifications
You must be signed in to change notification settings - Fork 87
Added non-git source puller functionality #194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sean-morris
wants to merge
45
commits into
jupyterhub:main
Choose a base branch
from
sean-morris:non-git
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
ea87f2b
Command-line argument repo_dir is changed
sean-morris 10385bb
Added non-git source puller functionality
sean-morris ab80daf
Added async functionality to non-git archives
sean-morris 71ca2f4
Update nbgitpuller/plugin_helper.py
sean-morris ae66e53
Update nbgitpuller/hookspecs.py
sean-morris 8934f5f
renamed and simplified the test_files
sean-morris ac2072c
added README to plugins
sean-morris a84096d
added docstring to progress_loop function
sean-morris 86fd7bf
Update tests/test_download_puller.py
sean-morris c686651
Update tests/test_download_puller.py
sean-morris f8e04f1
Removed Downloader Plugins from Repo
sean-morris 958b0b1
Added Custom Exception for Bad Provider
sean-morris 2048e8d
Merge branch 'main' of https://github.com/jupyterhub/nbgitpuller
sean-morris 398a03f
merged from master and fixed conflicts
sean-morris 9a8fcab
Removed unused import from test file
sean-morris 78e31c3
Added packages to dev-requirements.txt
sean-morris a131b93
Moved the two constants and REPO_PARENT_DIR out of __init__.py
sean-morris 55da5e1
Revert some trivial formatting changes
consideRatio 0ca6cf9
Apply suggestions from code review
sean-morris 9e808e5
Changes from code review
sean-morris 8d63ee4
Apply suggestions from code review
sean-morris deecc7b
Removed setTerminalVisibility from automatically opening in UI
sean-morris a9e08c4
Reverted a mistaken change to command-line args
sean-morris 09c9249
Hookspecs renamed and documented
sean-morris 0085fab
Hookspecs name and seperate helper_args
sean-morris 88ec806
Renamed for clarity
sean-morris 8592d1f
Seperated actual query_line_args from helper_args
sean-morris 21d8f0f
fixed conflicts
sean-morris ab5dd10
Fixed tests
sean-morris e8ae5ca
Removed changes not meant to merged
sean-morris 56ad1ee
Apply suggestions from code review
sean-morris af567ca
Refactored docstrings
sean-morris 782a35b
Refactored docstrings
sean-morris d034d37
Merge branch 'non-git' of https://github.com/sean-morris/nbgitpuller …
sean-morris 9729464
Fix temp download dir to use the package tempfile
sean-morris 602ef01
provider is now contentProvider in the html/js/query parameters
sean-morris 3ebdc7e
The download_func and download_func_params brought in separately
sean-morris e22d076
Moved the handle_files_helper in Class
sean-morris 3b14405
Moved downloader-plugin util to own repo
sean-morris 613f863
Moved downloader-plugin util to own repo
sean-morris 5f39c68
Merge branch 'non-git' of https://github.com/sean-morris/nbgitpuller …
sean-morris f618560
Removed nested_asyncio from init.py
sean-morris 367f3c7
Moved downloader-plugin handling to puller thread
sean-morris 8893970
Moved downloader plugins handling to pull.py
sean-morris 7590c38
Access downloader-plugin results from plugin instance variable
sean-morris File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ jupyter-packaging>=0.10 | |
pytest | ||
pytest-cov | ||
flake8 | ||
nbclassic | ||
nbclassic |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import pluggy | ||
|
||
# this hookspec is decorating the handle_files function below. The decorator defines | ||
# the interface(hook specifications) for any implementing content-provider plugins. The project name, nbgitpuller, | ||
# is passed to the constructor for HookspecMarker and HookimplMarker as well as to the constructor for the | ||
# PluginManager in handlers.py in order to allow the PluginManager.add_hookspecs method to automatically discover | ||
# all marked functions. | ||
hookspec = pluggy.HookspecMarker("nbgitpuller") | ||
|
||
# As a convenience the hookimpl field can be used by content-provider plugins to decorate the implementations of the | ||
# handle_files function. A content-provider plugin could create the HookImplMarker itself but in order to register | ||
# with the PluginManager the name('nbgitpuller') must be used as we do here. | ||
hookimpl = pluggy.HookimplMarker("nbgitpuller") | ||
|
||
|
||
@hookspec(firstresult=True) | ||
def handle_files(repo_parent_dir, other_kw_args): | ||
""" | ||
This function must be implemented by content-provider plugins in order to handle the downloading and decompression | ||
of a non-git sourced compressed archive. | ||
|
||
The repo_parent_dir is where you will save your downloaded archive | ||
|
||
The parameter, other_kw_args, contains all the arguments you put on the nbgitpuller URL link or passed to GitPuller | ||
via CLI. This allows you flexibility to pass information your content-provider download plugin may need to | ||
successfully download source files. | ||
|
||
This function needs to return two pieces of information as a json object: | ||
- output_dir -- the is the name of the directory that will hold all the files you want GitPuller to expose | ||
for comparison, when git is the source, this is name of git repository you are pulling | ||
- origin_repo_path -- this is path to the local git repo that "acts" like the remote origin you would use | ||
if the content-provider is git. | ||
|
||
Once the files are saved to the directory, git puller can handle all the standard functions needed to make sure | ||
source files are updated or created as needed. | ||
|
||
I suggest you study the function handle_files_helper in file plugin_helper.py found in the | ||
nbgitpuller-downloader-plugins repository to get a deep sense of how | ||
we handle the downloading of compressed archives. There is also more documentation in the docs section of | ||
nbgitpuller. Finally, you can always implement the entire download process yourself and not use the | ||
handle_files_helper function but please to sure understand what is being passed into and back to the nbgitpuller | ||
handlers. | ||
|
||
:param str repo_parent_dir: save your downloaded archive here | ||
:param dict other_kw_args: this includes any argument you put on the nbgitpuller URL or pass via CLI as a dict | ||
:return two parameter json output_dir and origin_repo_path | ||
:rtype json object | ||
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.