Name | pytest-check-links JSON |
Version |
0.10.1
JSON |
| download |
home_page | None |
Summary | Check links in files |
upload_time | 2024-04-10 13:10:17 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | Copyright (c) 2019 Project Jupyter Contributors All rights reserved. Copyright (c) 2017, Min RK All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
keywords |
documentation
html
links
testing
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# pytest-check-links
pytest plugin that checks URLs for HTML-containing files.
[![Tests](https://github.com/jupyterlab/pytest-check-links/workflows/Tests/badge.svg)](https://github.com/jupyterlab/pytest-check-links/actions?query=workflow%3ATests+branch%3Amaster)
[![PyPI version](https://badge.fury.io/py/pytest-check-links.svg)](https://badge.fury.io/py/pytest-check-links)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pytest-check-links)
## Supported files
- `.html`
- `.rst`
- `.md` (TODO: select renderer)
- `.ipynb` (requires `nbconvert`)
## Install
```
pip install pytest-check-links
```
## Use
```
pytest --check-links mynotebook.ipynb
```
## Configure
#### --links-ext
> default: `md,rst,html,ipynb`
A comma-separated list of extensions to check
#### --check-anchors
Also check whether links with `#anchors` HTML files (either local, or with
served with `html` in the `Content-Type`) actually exist, and point to _exactly one_
named anchor.
#### --check-links-ignore
A regular expression that matches URIs that should not be checked.
Can be specified multiple times for multiple ignore patterns.
This can be used for files that have a lot of links to GitHub pages,
such as a Changelog. GitHub has rate limiting, which would normally cause these files to take up to an hour to complete for larger repositories. For example:
```
pytest --check-links --check-links-ignore "https://github.com/.*/pull/.*" CHANGELOG.md
```
### Cache
Caching requires the installation of `requests-cache`.
```
pip install requests-cache
```
If enabled, each occurrence of a link will be checked, no matter how many times
it appears in a collection of files to check.
#### --check-links-cache
Cache requests when checking links. Caching is disabled by default, and this option
must be provided, even if other cache configuration options are provided.
#### --check-links-cache-name
> default: `.pytest-check-links-cache`
Name of link cache, either the base name of a file or similar, depending on backend.
#### --check-links-cache-backend
> default: `sqlite3`
Cache persistence backend. The other known backends are:
- `memory`
- `redis`
- `mongodb`
See the [requests-cache documentation](https://requests-cache.readthedocs.io)
for more information.
#### --check-links-cache-expire-after
> default: `None` (unlimited)
Time to cache link responses (seconds).
#### --check-links-cache-backend-opt
Backend-specific options for link cache, provided as `key:value`. These are passed
directly to the `requests_cache.CachedSession` constructor, as they vary depending
on the backend.
Values will be parsed as JSON first, so to overload the default of caching all
HTTP response codes (which requires a list of `int`s):
```bash
--check-links-backend-opt allowable_codes:[200]
```
## Code Styling
`pytest-check-links` has adopted automatic code formatting so you shouldn't
need to worry too much about your code style.
As long as your code is valid,
the pre-commit hook should take care of how it should look.
You can invoke the pre-commit hook by hand at any time with:
```bash
pre-commit run
```
which should run any autoformatting on your code
and tell you about any errors it couldn't fix automatically.
You may also install [black integration](https://black.readthedocs.io/en/stable/integrations/editors.html)
into your text editor to format code automatically.
If you have already committed files before setting up the pre-commit
hook with `pre-commit install`, you can fix everything up using
`pre-commit run --all-files`. You need to make the fixing commit
yourself after that.
Some of the hooks only run on CI by default, but you can invoke them by
running with the `--hook-stage manual` argument.
## TODO
- pick a markdown renderer (probably commonmark) or make the markdown renderer pluggable
- options for validating links (allow absolute links, only remote or local, etc.)
- find URLs in Python docstrings
Raw data
{
"_id": null,
"home_page": null,
"name": "pytest-check-links",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "documentation, html, links, testing",
"author": null,
"author_email": "Jupyter Development Team <jupyter@googlegroups.com>",
"download_url": "https://files.pythonhosted.org/packages/0c/c2/b7f226b8e3cfb8f301e04631027f7dc2b4c6f3a6f953de7b86a43a521c9d/pytest_check_links-0.10.1.tar.gz",
"platform": null,
"description": "# pytest-check-links\n\npytest plugin that checks URLs for HTML-containing files.\n\n[![Tests](https://github.com/jupyterlab/pytest-check-links/workflows/Tests/badge.svg)](https://github.com/jupyterlab/pytest-check-links/actions?query=workflow%3ATests+branch%3Amaster)\n[![PyPI version](https://badge.fury.io/py/pytest-check-links.svg)](https://badge.fury.io/py/pytest-check-links)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pytest-check-links)\n\n## Supported files\n\n- `.html`\n- `.rst`\n- `.md` (TODO: select renderer)\n- `.ipynb` (requires `nbconvert`)\n\n## Install\n\n```\npip install pytest-check-links\n```\n\n## Use\n\n```\npytest --check-links mynotebook.ipynb\n```\n\n## Configure\n\n#### --links-ext\n\n> default: `md,rst,html,ipynb`\n\nA comma-separated list of extensions to check\n\n#### --check-anchors\n\nAlso check whether links with `#anchors` HTML files (either local, or with\nserved with `html` in the `Content-Type`) actually exist, and point to _exactly one_\nnamed anchor.\n\n#### --check-links-ignore\n\nA regular expression that matches URIs that should not be checked.\nCan be specified multiple times for multiple ignore patterns.\nThis can be used for files that have a lot of links to GitHub pages,\nsuch as a Changelog. GitHub has rate limiting, which would normally cause these files to take up to an hour to complete for larger repositories. For example:\n\n```\npytest --check-links --check-links-ignore \"https://github.com/.*/pull/.*\" CHANGELOG.md\n```\n\n### Cache\n\nCaching requires the installation of `requests-cache`.\n\n```\npip install requests-cache\n```\n\nIf enabled, each occurrence of a link will be checked, no matter how many times\nit appears in a collection of files to check.\n\n#### --check-links-cache\n\nCache requests when checking links. Caching is disabled by default, and this option\nmust be provided, even if other cache configuration options are provided.\n\n#### --check-links-cache-name\n\n> default: `.pytest-check-links-cache`\n\nName of link cache, either the base name of a file or similar, depending on backend.\n\n#### --check-links-cache-backend\n\n> default: `sqlite3`\n\nCache persistence backend. The other known backends are:\n\n- `memory`\n- `redis`\n- `mongodb`\n\nSee the [requests-cache documentation](https://requests-cache.readthedocs.io)\nfor more information.\n\n#### --check-links-cache-expire-after\n\n> default: `None` (unlimited)\n\nTime to cache link responses (seconds).\n\n#### --check-links-cache-backend-opt\n\nBackend-specific options for link cache, provided as `key:value`. These are passed\ndirectly to the `requests_cache.CachedSession` constructor, as they vary depending\non the backend.\n\nValues will be parsed as JSON first, so to overload the default of caching all\nHTTP response codes (which requires a list of `int`s):\n\n```bash\n--check-links-backend-opt allowable_codes:[200]\n```\n\n## Code Styling\n\n`pytest-check-links` has adopted automatic code formatting so you shouldn't\nneed to worry too much about your code style.\nAs long as your code is valid,\nthe pre-commit hook should take care of how it should look.\nYou can invoke the pre-commit hook by hand at any time with:\n\n```bash\npre-commit run\n```\n\nwhich should run any autoformatting on your code\nand tell you about any errors it couldn't fix automatically.\nYou may also install [black integration](https://black.readthedocs.io/en/stable/integrations/editors.html)\ninto your text editor to format code automatically.\n\nIf you have already committed files before setting up the pre-commit\nhook with `pre-commit install`, you can fix everything up using\n`pre-commit run --all-files`. You need to make the fixing commit\nyourself after that.\n\nSome of the hooks only run on CI by default, but you can invoke them by\nrunning with the `--hook-stage manual` argument.\n\n## TODO\n\n- pick a markdown renderer (probably commonmark) or make the markdown renderer pluggable\n- options for validating links (allow absolute links, only remote or local, etc.)\n- find URLs in Python docstrings\n",
"bugtrack_url": null,
"license": "Copyright (c) 2019 Project Jupyter Contributors All rights reserved. Copyright (c) 2017, Min RK All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.",
"summary": "Check links in files",
"version": "0.10.1",
"project_urls": {
"Homepage": "https://github.com/jupyterlab/pytest-check-links"
},
"split_keywords": [
"documentation",
" html",
" links",
" testing"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "760af5850afa7c544360fad5aefbc4ae5ec38e8f4eb5499501702beb2dcc896a",
"md5": "0c3dd2af83d97ed896d80faabf8ebe91",
"sha256": "0e4a4313d08d6c5b81a72e133fd8513a3bb0b89d54dec3565da7ae01b74f603e"
},
"downloads": -1,
"filename": "pytest_check_links-0.10.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0c3dd2af83d97ed896d80faabf8ebe91",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 11920,
"upload_time": "2024-04-10T13:10:15",
"upload_time_iso_8601": "2024-04-10T13:10:15.163970Z",
"url": "https://files.pythonhosted.org/packages/76/0a/f5850afa7c544360fad5aefbc4ae5ec38e8f4eb5499501702beb2dcc896a/pytest_check_links-0.10.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0cc2b7f226b8e3cfb8f301e04631027f7dc2b4c6f3a6f953de7b86a43a521c9d",
"md5": "7cd5ff737c94f4e01ef4698097291901",
"sha256": "7358dd92c8e6c737c8749ec87f5a27c32390445d43182673f89247a1a34d776d"
},
"downloads": -1,
"filename": "pytest_check_links-0.10.1.tar.gz",
"has_sig": false,
"md5_digest": "7cd5ff737c94f4e01ef4698097291901",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 20488,
"upload_time": "2024-04-10T13:10:17",
"upload_time_iso_8601": "2024-04-10T13:10:17.294631Z",
"url": "https://files.pythonhosted.org/packages/0c/c2/b7f226b8e3cfb8f301e04631027f7dc2b4c6f3a6f953de7b86a43a521c9d/pytest_check_links-0.10.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-10 13:10:17",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jupyterlab",
"github_project": "pytest-check-links",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pytest-check-links"
}