-
Notifications
You must be signed in to change notification settings - Fork 84
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
Document how to do local development #162
Changes from 1 commit
67e963c
7c22dd1
61c3603
5d443c6
ef4a12b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Contributing | ||
|
||
## Setup | ||
|
||
nbgitpuller is a [jupyter | ||
serverextension](https://jupyter-notebook.readthedocs.io/en/stable/extending/handlers.html), | ||
and hence can be developed locally without needing a JupyterHub. | ||
|
||
1. Setup a virtual environment to do development in | ||
|
||
```bash | ||
python3 -m venv venv | ||
source venv/bin/activate | ||
``` | ||
|
||
2. Install nbgitpuller with its dependencies in this virtual environment | ||
|
||
```bash | ||
pip install -e . | ||
yuvipanda marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` | ||
|
||
3. Enable the nbgitpuller jupyter serverextension | ||
|
||
```bash | ||
jupyter serverextension enable --sys-prefix nbgitpuller | ||
``` | ||
|
||
4. Start the notebook server. This will open the classic notebook in your web | ||
browser, and automatically authenticate you as a side effect. | ||
|
||
```bash | ||
jupyter notebook | ||
``` | ||
|
||
5. 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-sync?repo=https://github.com/data-8/textbook&branch=gh-pages | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
recommonmark==0.4.0 | ||
sphinx_copybutton | ||
traitlets | ||
jupyterhub | ||
|
@@ -7,3 +6,4 @@ sphinx-book-theme | |
memory_profiler | ||
pytest | ||
PyGitHub | ||
myst_parser[sphinx] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From experience, order matters so I have the suggestion of mimicing the order in z2jh to avoid potential issues with RTD that has sphinx pre-installed already. To conclude, I think the key point is to let myst_parser be at the top, and that Relevant configs from z2jh for reference. doc-requirements.txt # Order matters:
# - myst-parser depends on "sphinx>=2,<4"
# - pydata-sphinx-theme depends on "sphinx"
# - sphinx-copybutton depends on "sphinx>=1.8"
#
# Listing either pydata-sphinx-theme or sphinx-copybutton first will make the
# myst-parser constraints on sphinx be ignored, so myst-parser should go
# first. This is only relevant if sphinx==1.* is already installed in the
# environment, which it is on ReadTheDocs.
#
chartpress
myst-parser
pydata-sphinx-theme
pyyaml
sphinx-autobuild
sphinx-copybutton
sphinxext-rediraffe .readthedocs.yml # Configuration on how ReadTheDocs (RTD) builds our documentation
# ref: https://readthedocs.org/projects/zero-to-jupyterhub/
# ref: https://docs.readthedocs.io/en/stable/config-file/v2.html
# Required (RTD configuration version)
version: 2
# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: doc/source/conf.py
# Optionally build your docs in additional formats such as PDF and ePub
formats: []
# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
install:
# WARNING: This requirements file will be installed without the pip
# --upgrade flag in an existing environment. This means that if a
# package is specified without a lower boundary, we may end up
# accepting the existing version.
#
# ref: https://github.com/readthedocs/readthedocs.org/blob/0e3df509e7810e46603be47d268273c596e68455/readthedocs/doc_builder/python_environments.py#L335-L344
- requirements: doc/doc-requirements.txt There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, but this doesn't use readthedocs for docs - it's hosted on GitHub pages i believe. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know exactly all details, but I suspect that if sphinx 4 is released, it will be installed and break things with this ordering. To safeguard for this, could you... I was about to push a commit and merge but I realized that the admonition thingy was still here and you probably have unpushed commits. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to understand - https://github.com/jupyterhub/nbgitpuller/blob/master/.circleci/config.yml is the current config used to build and deploy the docs. Should sphinx still be removed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In doc-requirements.txt, i think letting myst-parser install as the first item can help avoid a potential issue i struggled with that may show up if for example sphinx 4 is released. Removing sphinx is also fine as it is an myst_parser install requirement, but not important as long it is listed after myst_parser. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this doesn't need to be enabled explicitly as I use ```{admonition} ...``` directives already in z2jh's docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct, I believe (also, in the new myst-parser this configuration will be deprecated in favor of a list of extensions, so let's try just removing it for now?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, this is how I enable the substitution extension in z2jh currently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed! I don't even know what admonitions are :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A more general class for note, important, warning for example. A benefit is that you can give them a title as well, here is how!
Here is an example of a
:class: warning
admonition with a custom title from the z2jh guide.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to remain in the PR still, I think a cat must have disrupted the push :)