Skip to content
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

Add pytest-check-links for internal URLs #3677

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .binder/README
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
This directory holds configuration files for https://mybinder.org/.

The interactive notebooks can be accessed with this link:
https://mybinder.org/v2/gh/jupyter-widgets/ipywidgets/master?filepath=docs/source/examples
https://mybinder.org/v2/gh/jupyter-widgets/ipywidgets/main?filepath=docs/source/examples

To check out a different version, just replace "master" with the desired
To check out a different version, just replace `main` with the desired
branch/tag name or commit hash.

To use JupyterLab, use:
https://mybinder.org/v2/gh/jupyter-widgets/ipywidgets/master?urlpath=lab/tree/docs/source/examples
https://mybinder.org/v2/gh/jupyter-widgets/ipywidgets/main?urlpath=lab/tree/docs/source/examples
2 changes: 1 addition & 1 deletion .github/workflows/binder-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
script: |
var PR_HEAD_USERREPO = process.env.PR_HEAD_USERREPO;
var PR_HEAD_REF = process.env.PR_HEAD_REF;
github.issues.createComment({
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build jupyterlab_widgets

on:
push:
branches: master
branches: main
pull_request:
branches: '*'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/devinstall.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Run the dev-install script

on:
push:
branches: master
branches: main
pull_request:
branches: '*'

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: Packaging

on:
push:
branches: [master]
branches:
- main
pull_request:
branches: '*'

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ jobs:
run: |
cd docs/source
python -m sphinx -T -E -b html -d ../build/doctrees -D language=en . ../build/html
- name: Check internal links
run: |
cd docs/build/html
pytest-check-links -vv --check-anchors --check-links-ignore "^https?://" --links-ext html
js:
name: JavaScript
runs-on: ubuntu-latest
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

| Purpose | Badges |
| ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Latest (master: future 8.0)** | [![Test Status](https://github.com/jupyter-widgets/ipywidgets/actions/workflows/tests.yml/badge.svg?query=branch%3Amaster)](https://github.com/jupyter-widgets/ipywidgets/actions?query=branch%3Amaster) [![Documentation Status: latest](https://img.shields.io/readthedocs/ipywidgets?logo=read-the-docs)](https://ipywidgets.readthedocs.io/en/latest/?badge=latest) [![Binder:master](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/jupyter-widgets/ipywidgets/master?urlpath=lab/tree/docs%2Fsource%2Fexamples) |
| **Latest (`main`: future 8.0)** | [![Test Status](https://github.com/jupyter-widgets/ipywidgets/actions/workflows/tests.yml/badge.svg?query=branch%3Amain)](https://github.com/jupyter-widgets/ipywidgets/actions?query=branch%3Amain) [![Documentation Status: latest](https://img.shields.io/readthedocs/ipywidgets?logo=read-the-docs)](https://ipywidgets.readthedocs.io/en/latest/?badge=latest) [![Binder:main](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/jupyter-widgets/ipywidgets/main?urlpath=lab/tree/docs%2Fsource%2Fexamples) |
| **Stable** | [![Version](https://img.shields.io/pypi/v/ipywidgets.svg?logo=pypi)](https://pypi.python.org/pypi/ipywidgets) [![Conda Version](https://img.shields.io/conda/vn/conda-forge/ipywidgets.svg?logo=conda-forge)](https://anaconda.org/conda-forge/ipywidgets) [![Documentation Status](https://img.shields.io/readthedocs/ipywidgets?logo=read-the-docs)](https://ipywidgets.readthedocs.io/en/stable/?badge=stable) [![Binder:7.x](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/jupyter-widgets/ipywidgets/7.x?urlpath=lab/tree/docs%2Fsource%2Fexamples) |
| **Communication** | [![Join the chat at https://gitter.im/ipython/ipywidgets](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jupyter-widgets/Lobby) [![Discourse](https://img.shields.io/badge/help_forum-discourse-blue?logo=discourse)](https://discourse.jupyter.org/c/widgets/46) |
| | |

**ipywidgets**, also known as jupyter-widgets or simply widgets, are
[interactive HTML widgets](https://github.com/jupyter-widgets/ipywidgets/blob/master/docs/source/examples/Index.ipynb)
[interactive HTML widgets](https://github.com/jupyter-widgets/ipywidgets/blob/main/docs/source/examples/Index.ipynb)
for Jupyter notebooks and the IPython kernel.

Notebooks come alive when interactive widgets are used. Users gain control of
Expand All @@ -21,7 +21,7 @@ ipywidgets to your notebooks, and we're here to help you get started.
## Core Interactive Widgets

The fundamental widgets provided by this library are called core interactive
widgets. A [demonstration notebook](https://github.com/jupyter-widgets/ipywidgets/blob/master/docs/source/examples/Index.ipynb)
widgets. A [demonstration notebook](https://github.com/jupyter-widgets/ipywidgets/blob/main/docs/source/examples/Index.ipynb)
provides an overview of the core interactive widgets, including:

- sliders
Expand Down Expand Up @@ -87,14 +87,14 @@ see the detailed [developer install](docs/source/dev_install.md) instructions.

If you want to install ipywidgets from source, **you will need the
[yarn](https://yarnpkg.com/) package manager version 1.2.1 or later**.
To install the latest master version from the root directory of the source
To install the latest `main` version from the root directory of the source
code, run `dev-install.sh`. To only build the Python package enter
`pip install -e .`.

## Usage

See the [examples](docs/source/examples.md) section of the documentation. The widgets are being used in a variety of ways; some uses can be seen in these notebooks:
[Demo notebook of interactive widgets](https://github.com/jupyter-widgets/ipywidgets/blob/master/docs/source/examples/Index.ipynb)
[Demo notebook of interactive widgets](https://github.com/jupyter-widgets/ipywidgets/blob/main/docs/source/examples/Index.ipynb)

## Change log

Expand All @@ -106,13 +106,13 @@ Refer to change log for more detail.

| ipywidgets | JupyterLab | [Classic Notebook](https://github.com/jupyter/notebook) | [nbclassic](https://github.com/jupyterlab/nbclassic) |
| ---------- | :--------: | :-----------------------------------------------------: | :--------------------------------------------------: |
| master | | - | TBD |
| 7.6.3 | | | 0.2.6 |
| `main` | | - | TBD |
| `7.6.3` | | | 0.2.6 |
| **Legacy** | | | |
| 6.x | | | - |
| 5.x | | 4.2 | - |
| 4.1.x | | 4.1 | - |
| 4.0.x | | 4.0 | - |
| `6.x` | | | - |
| `5.x` | | 4.2 | - |
| `4.1.x` | | 4.1 | - |
| `4.0.x` | | 4.0 | - |

## Contributing to ipywidgets

Expand Down
5 changes: 4 additions & 1 deletion docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ dependencies:
- scikit-image
- scikit-learn
- sympy
# jupyterlite dependencies
# test
- pytest-check-links
- requests-cache
# jupyterlite
- doit
- pkginfo
- python-libarchive-c
Expand Down
10 changes: 6 additions & 4 deletions docs/lite/jupyter_lite_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
"Layout Templates\\.ipynb",
"Variable Inspector\\.ipynb"
],
"contents": ["../source/examples"],
"contents": ["../source/examples"]
},
"PipliteAddon": {
"piplite_urls": [
"../python/ipywidgets/dist",
"../python/widgetsnbextension/dist",
"../python/jupyterlab_widgets/dist"
"../../python/ipywidgets/dist",
"../../python/widgetsnbextension/dist",
"../../python/jupyterlab_widgets/dist"
]
}
}
2 changes: 2 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ numpy
packaging
pkginfo
pydata-sphinx-theme
pytest-check-links
recommonmark
requests-cache
scikit-image
scikit-learn
sphinx >=1.4.6
Expand Down
6 changes: 3 additions & 3 deletions docs/source/_templates/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
autocomplete="off"
checked
title="Lab"
value="{{ pathto('try/lab/index') }}?path=Index.ipynb&path=Widget%20List.ipynb"
value="{{ pathto('try/lab/index') }}?path=Widget%20List.ipynb"
>
<i class="fas fa-flask"></i> Lab
</label>
Expand All @@ -20,14 +20,14 @@
type="radio"
name="demo-app"
title="Notebook"
value="{{ pathto('try/retro/index') }}?path=Index.ipynb&path=Widget%20List.ipynb"
value="{{ pathto('try/retro/index') }}?path=Widget%20List.ipynb"
>
<i class="fas fa-book"></i> Notebook
</label>
</div>

<a
href="{{ pathto('try/lab/index') }}?path=Index.ipynb&path=Widget%20List.ipynb"
href="{{ pathto('try/lab/index') }}?path=Widget%20List.ipynb"
class="btn btn-primary"
target="_blank"
title="Try Jupyter Widgets in your browser."
Expand Down
4 changes: 2 additions & 2 deletions docs/source/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ If you are developing a custom widget or widget manager, here are some major cha
- A custom serializer is given the widget instance as its second argument, and a custom deserializer is given the widget manager as its second argument.
- The Javascript model `.id` attribute has been renamed to `.model_id` to avoid conflicting with the Backbone `.id` attribute. ([#1410](https://github.com/jupyter-widgets/ipywidgets/pull/1410))
- Regarding widget managers and the syncing message protocol:
- The widget protocol was significantly overhauled. The new widget messaging protocol (version 2) is specified in the [version 2 protocol documentation](https://github.com/jupyter-widgets/ipywidgets/blob/master/jupyter-widgets-schema/messages.md).
- The widget protocol was significantly overhauled. The new widget messaging protocol (version 2) is specified in the [version 2 protocol documentation](https://github.com/jupyter-widgets/ipywidgets/blob/main/jupyter-widgets-schema/messages.md).
- Widgets are now displayed with a `display_data` message instead of with a custom comm message. See the [ipywidgets](https://github.com/jupyter-widgets/ipywidgets/blob/20cd0f050090b1b19bb9657b8c3fa42ae384cfca/ipywidgets/widgets/widget.py#L656) implementation for an example. ([#1274](https://github.com/jupyter-widgets/ipywidgets/pull/1274))
- Custom widget managers are now responsible completely for loading widget model and view classes. Widget managers should provide an output model and view class appropriate for their environment so that the `Output` widget works. ([#1313](https://github.com/jupyter-widgets/ipywidgets/pull/1313))
- The widget manager `clear_state` method no longer has a `commlessOnly` argument. All models in the widget manager will be closed and cleared when `clear_state` is called. ([#1354](https://github.com/jupyter-widgets/ipywidgets/pull/1354))
Expand All @@ -459,7 +459,7 @@ Major user-visible changes in ipywidgets 6.0 include:
- Rendering of Jupyter interactive widgets in various web contexts

sphinx documentation: http://ipywidgets.readthedocs.io/en/latest/examples/Widget%20List.html
nbviewer: http://nbviewer.jupyter.org/github/jupyter-widgets/ipywidgets/blob/master/docs/source/examples/Widget%20List.ipynb
nbviewer: http://nbviewer.jupyter.org/github/jupyter-widgets/ipywidgets/blob/main/docs/source/examples/Widget%20List.ipynb
Static web pages: http://jupyter.org/widgets

- Addition of a DatePicker widget in the core widget collection.
Expand Down
3 changes: 1 addition & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def setup(app):

extensions = [
'myst_nb',
'sphinx.ext.autosectionlabel',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
Expand Down Expand Up @@ -178,7 +177,7 @@ def setup(app):
"doc_path": "docs",
"github_repo": "ipywidgets",
"github_user": "jupyter-widgets",
"github_version": "master",
"github_version": "main",
}

html_sidebars = {
Expand Down
2 changes: 1 addition & 1 deletion docs/source/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

We appreciate contributions from the community.

We follow the [IPython Contributing Guide](https://github.com/ipython/ipython/blob/master/CONTRIBUTING.md)
We follow the [IPython Contributing Guide](https://github.com/ipython/ipython/blob/main/CONTRIBUTING.md)
and [Jupyter Contributing Guides](https://jupyter.readthedocs.io/en/latest/contributor/content-contributor.html).
24 changes: 24 additions & 0 deletions docs/source/dev_docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,27 @@ all output from a notebook:
```bash
nbstripout "docs/source/examples/Widget List.ipynb"
```

## Checking links

After build the docs, it is possible to check all links point to pages (and `#` anchors)
that actually exist with [`pytest-check-links`][pytest-check-links].

To check all _internal_ links, which is still quite slow:

```bash
cd docs/build/html
pytest-check-links -vv --check-anchors --check-links-ignore="^https?://" --links-ext=html
```

To also check _external_ links, it is good manners to ensure external requests are cached:

```bash
cd docs/build/html
pytest-check-links -vv --check-anchors --links-ext=html --check-links-cache
```

It is possible to configure the cache in more ways: see more on the
[`pytest-check-links` README][pytest-check-links].

[pytest-check-links]: https://github.com/jupyterlab/pytest-check-links
2 changes: 1 addition & 1 deletion docs/source/dev_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To install ipywidgets from git, you will need:
- the latest [Jupyter Notebook development release](https://github.com/jupyter/notebook/releases)

- Everything in the ipywidgets repository is developed using Jupyter
notebook's master branch.
notebook's `main` branch.
- If you want to have a copy of ipywidgets that works against a stable
version of the notebook, checkout the appropriate tag.
- See the
Expand Down
20 changes: 10 additions & 10 deletions docs/source/dev_release.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Developer Release Procedure

To release a new version of the widgets on PyPI and npm, first checkout the
`master` branch and `cd` into the repo root.
`main` branch and `cd` into the repo root.

```
cd release
Expand Down Expand Up @@ -43,9 +43,9 @@ Commit the changes (don't forget to `git add` the new model spec file).

```
# clean out all dirty files
git checkout master
git pull origin master
git reset --hard origin/master
git checkout main
git pull origin main
git reset --hard origin/main
git clean -fdx
yarn install
yarn version
Expand Down Expand Up @@ -121,11 +121,11 @@ Using the above script, you can do:
./scripts/hashes python/jupyterlab_widgets/dist/*
```

Commit the changes you've made above, and include the uploaded files hashes in the commit message. Tag the release if ipywidgets was released. Push to origin master (and include the tag in the push), e.g:
Commit the changes you've made above, and include the uploaded files hashes in the commit message. Tag the release if ipywidgets was released. Push to origin `main` (and include the tag in the push), e.g:

```
git tag 8.0.4
git push origin master 8.0.4
git push origin main 8.0.4
```

Update conda-forge packages (if the requirements changed to ipywidgets, make sure to update widgetsnbextension first).
Expand All @@ -150,7 +150,7 @@ Here are some commands used to generate some of the statistics above.

```
# merges since in 6.0.0, but not 7.0.0, which is a rough list of merged PRs
git log --merges 6.0.0...master --pretty=oneline
git log --merges 6.0.0...main --pretty=oneline

# To really make sure we get all PRs, we could write a program that
# pulled all of the PRs, examined a commit in each one, and did
Expand All @@ -164,11 +164,11 @@ git log --merges 6.0.0...master --pretty=oneline
git show -s --format=%cd --date=short 6.0.0^{commit}

# Non-merge commits in 7.0.0 not in any 6.x release
git log --pretty=oneline --no-merges ^6.0.0 master | wc -l
git log --pretty=oneline --no-merges ^6.0.0 main | wc -l

# Authors of non-merge commits
git shortlog -s 6.0.0..master --no-merges | cut -c8- | sort -f
git shortlog -s 6.0.0..main --no-merges | cut -c8- | sort -f

# New committers: authors unique in the 6.0.0..7.0.0 logs, but not in the 6.0.0 log
comm -23 <(git shortlog -s -n 6.0.0..master --no-merges | cut -c8- | sort) <(git shortlog -s -n 6.0.0 --no-merges | cut -c8- | sort) | sort -f
comm -23 <(git shortlog -s -n 6.0.0..main --no-merges | cut -c8- | sort) <(git shortlog -s -n 6.0.0 --no-merges | cut -c8- | sort) | sort -f
```
Loading