New Upstream Snapshot - mkdocs-redirects

Ready changes

Summary

Merged new upstream version: 1.2.0+git20221231.1.b7a3353 (was: 1.2.0).

Diff

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
deleted file mode 100644
index 86ee229..0000000
--- a/.github/workflows/ci.yml
+++ /dev/null
@@ -1,48 +0,0 @@
-name: CI
-on:
-  push:
-  pull_request:
-  schedule:
-    - cron: '0 6 * * 6'
-jobs:
-  build:
-    strategy:
-      fail-fast: false
-      matrix:
-        include:
-          - python: '^3.10'
-            os: ubuntu-latest
-          - python: 3.9
-            os: windows-latest
-          - python: 3.8
-            os: ubuntu-latest
-          - python: 3.7
-            os: macos-latest
-          - python: 3.6
-            os: windows-latest
-          - python: 3.6
-            os: ubuntu-latest
-            versions: minimal
-    runs-on: ${{matrix.os}}
-    steps:
-      - name: Download source
-        uses: actions/checkout@v2
-      - name: Install Python
-        uses: actions/setup-python@v2
-        with:
-          python-version: ${{matrix.python}}
-      - name: Pin to lowest versions
-        if: matrix.versions == 'minimal'
-        run: |
-          sed -i -E "s/^ +'(\\w+)>=([0-9])/'\\1==\\2/" setup.py
-      - name: Install packages
-        run: |
-          python -m pip install -U pip'>=19'
-          pip install -U --upgrade-strategy=eager .[test]
-      - name: Test
-        run: |
-          .tools/ci.sh with_groups
-      - name: Check formatting
-        if: matrix.versions == null
-        run: |
-          git diff --exit-code
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 894a44c..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,104 +0,0 @@
-# Byte-compiled / optimized / DLL files
-__pycache__/
-*.py[cod]
-*$py.class
-
-# C extensions
-*.so
-
-# Distribution / packaging
-.Python
-build/
-develop-eggs/
-dist/
-downloads/
-eggs/
-.eggs/
-lib/
-lib64/
-parts/
-sdist/
-var/
-wheels/
-*.egg-info/
-.installed.cfg
-*.egg
-MANIFEST
-
-# PyInstaller
-#  Usually these files are written by a python script from a template
-#  before PyInstaller builds the exe, so as to inject date/other infos into it.
-*.manifest
-*.spec
-
-# Installer logs
-pip-log.txt
-pip-delete-this-directory.txt
-
-# Unit test / coverage reports
-htmlcov/
-.tox/
-.coverage
-.coverage.*
-.cache
-nosetests.xml
-coverage.xml
-*.cover
-.hypothesis/
-.pytest_cache/
-
-# Translations
-*.mo
-*.pot
-
-# Django stuff:
-*.log
-local_settings.py
-db.sqlite3
-
-# Flask stuff:
-instance/
-.webassets-cache
-
-# Scrapy stuff:
-.scrapy
-
-# Sphinx documentation
-docs/_build/
-
-# PyBuilder
-target/
-
-# Jupyter Notebook
-.ipynb_checkpoints
-
-# pyenv
-.python-version
-
-# celery beat schedule file
-celerybeat-schedule
-
-# SageMath parsed files
-*.sage.py
-
-# Environments
-.env
-.venv
-env/
-venv/
-ENV/
-env.bak/
-venv.bak/
-
-# Spyder project settings
-.spyderproject
-.spyproject
-
-# Rope project settings
-.ropeproject
-
-# mkdocs documentation
-/site
-
-# mypy
-.mypy_cache/
diff --git a/.tools/ci.sh b/.tools/ci.sh
deleted file mode 100755
index 2d1b93e..0000000
--- a/.tools/ci.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-set -e
-
-cd "$(dirname "$0")/.."
-
-with_groups() {
-    echo "::group::$@"
-    "$@" && echo "::endgroup::"
-}
-
-srcs='mkdocs_redirects tests setup.py'
-
-"$@" pytest -q
-"$@" autoflake -i -r --remove-all-unused-imports --remove-unused-variables $srcs
-"$@" isort -q $srcs
-"$@" black -l100 -tpy36 --skip-string-normalization -q $srcs
diff --git a/Makefile b/Makefile
deleted file mode 100644
index f86c713..0000000
--- a/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-clean:  ## Clean intermediate build files
-	find . -name '__pycache__' | xargs rm -rf
-	find . -name '*.pyc' | xargs rm -rf
-	rm -rf dist/
-.PHONY: clean
-
-build: clean dev  ## Build the package (source distribution)
-	python setup.py sdist
-.PHONY: build
-
-dev: clean  ## Setup development environment
-	pip install .[dev]
-.PHONY: dev
-
-test: dev ## Run tests
-	.tools/ci.sh
-.PHONY: test
-
-release: build  ## Release to PyPi
-	twine upload --repository-url https://upload.pypi.org/legacy/ dist/*
-.PHONY: release
diff --git a/PKG-INFO b/PKG-INFO
new file mode 100644
index 0000000..316f970
--- /dev/null
+++ b/PKG-INFO
@@ -0,0 +1,120 @@
+Metadata-Version: 2.1
+Name: mkdocs-redirects
+Version: 1.2.0
+Summary: A MkDocs plugin for dynamic page redirects to prevent broken links.
+Home-page: https://github.com/datarobot/mkdocs-redirects
+Author: Dustin Burke
+Author-email: dustin@datarobot.com
+License: MIT
+Keywords: mkdocs redirect
+Classifier: Development Status :: 4 - Beta
+Classifier: Intended Audience :: Developers
+Classifier: Intended Audience :: Information Technology
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3.10
+Requires-Python: >=3.6
+Description-Content-Type: text/markdown
+Provides-Extra: dev
+Provides-Extra: release
+Provides-Extra: test
+License-File: LICENSE
+
+# mkdocs-redirects
+
+Plugin for [`mkdocs`](https://www.mkdocs.org/) to create page redirects (e.g. for moved/renamed pages).
+
+Initially developed by [DataRobot](https://www.datarobot.com/).
+
+## Installing
+
+> **Note:** This package requires MkDocs version 1.0.4 or higher.
+
+Install with pip:
+
+```bash
+pip install mkdocs-redirects
+```
+
+## Using
+
+To use this plugin, specify your desired redirects in the plugin's `redirect_maps` setting in your `mkdocs.yml`:
+
+```yaml
+plugins:
+    - redirects:
+        redirect_maps:
+            'old.md': 'new.md'
+            'old/file.md': 'new/file.md'
+            'some_file.md': 'http://external.url.com/foobar'
+```
+
+_Note: don't forget that specifying the `plugins` setting will override the defaults if you didn't already have it set! See [this page](https://www.mkdocs.org/user-guide/configuration/#plugins) for more information._
+
+The redirects map should take the form of a key/value pair:
+
+- The key of each redirect is the original _markdown doc_ (relative to the `docs_dir` path).
+  - This plugin will handle the filename resolution during the `mkdocs build` process.
+    This should be set to what the original markdown doc's filename was (or what it _would be_ if it existed), not the final HTML file rendered by MkDocs
+- The value is the _redirect target_. This can take the following forms:
+  - Path of the _markdown doc_ you wish to be redirected to (relative to `docs_dir`)
+    - This plugin will handle the filename resolution during the `mkdocs build` process.
+      This should be set to what the markdown doc's filename is, not the final HTML file rendered by MkDocs
+  - External URL (e.g. `http://example.com`)
+
+During the `mkdocs build` process, this plugin will create `.html` files in `site_dir` for each of the "old" file that redirects to the "new" path.
+It will produce a warning if any problems are encountered or of the redirect target doesn't actually exist (useful if you have `strict: true` set).
+
+### `use_directory_urls`
+
+If you have `use_directory_urls: true` set (which is the default), this plugin will modify the redirect targets to the _directory_ URL, not the _actual_ `index.html` filename.
+However, it will create the `index.html` file for each target in the correct place so URL resolution works.
+
+For example, a redirect map of `'old/dir/README.md': 'new/dir/README.md'` will result in an HTML file created at `$site_dir/old/dir/index.html` which redirects to `../../new/dir/`.
+
+Additionally, a redirect map of `'old/dir/doc_name.md': 'new/dir/doc_name.md'` will result in `$site_dir/old/dir/doc_name/index.html` redirecting to `../../new/dir/doc_name/`.
+
+This mimics the behavior of how MkDocs builds the site dir without this plugin.
+
+## Developing
+
+### Setup a virtualenv
+
+Create a virtualenv using a method of your choice.
+
+```bash
+brew install pyenv pyenv-virtualenv
+pyenv install 2.7.18
+pyenv virtualenv 2.7.18 mkdocs-redirects
+pyenv activate mkdocs-redirects
+```
+
+### Build
+
+```bash
+make build
+```
+
+### Test
+
+```bash
+make test
+```
+
+## Releasing
+
+```bash
+make release
+```
+
+It will prompt you for your PyPI user and password.
+
+See:
+
+- <https://packaging.python.org/tutorials/packaging-projects/>
+- <https://packaging.python.org/guides/migrating-to-pypi-org/>
diff --git a/debian/changelog b/debian/changelog
index 8c187be..0abd729 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+mkdocs-redirects (1.2.0+git20221231.1.b7a3353-1) UNRELEASED; urgency=low
+
+  * New upstream snapshot.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Sun, 26 Feb 2023 23:17:25 -0000
+
 mkdocs-redirects (1.2.0-2) unstable; urgency=medium
 
   [ Debian Janitor ]
diff --git a/mkdocs_redirects.egg-info/PKG-INFO b/mkdocs_redirects.egg-info/PKG-INFO
new file mode 100644
index 0000000..316f970
--- /dev/null
+++ b/mkdocs_redirects.egg-info/PKG-INFO
@@ -0,0 +1,120 @@
+Metadata-Version: 2.1
+Name: mkdocs-redirects
+Version: 1.2.0
+Summary: A MkDocs plugin for dynamic page redirects to prevent broken links.
+Home-page: https://github.com/datarobot/mkdocs-redirects
+Author: Dustin Burke
+Author-email: dustin@datarobot.com
+License: MIT
+Keywords: mkdocs redirect
+Classifier: Development Status :: 4 - Beta
+Classifier: Intended Audience :: Developers
+Classifier: Intended Audience :: Information Technology
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3.10
+Requires-Python: >=3.6
+Description-Content-Type: text/markdown
+Provides-Extra: dev
+Provides-Extra: release
+Provides-Extra: test
+License-File: LICENSE
+
+# mkdocs-redirects
+
+Plugin for [`mkdocs`](https://www.mkdocs.org/) to create page redirects (e.g. for moved/renamed pages).
+
+Initially developed by [DataRobot](https://www.datarobot.com/).
+
+## Installing
+
+> **Note:** This package requires MkDocs version 1.0.4 or higher.
+
+Install with pip:
+
+```bash
+pip install mkdocs-redirects
+```
+
+## Using
+
+To use this plugin, specify your desired redirects in the plugin's `redirect_maps` setting in your `mkdocs.yml`:
+
+```yaml
+plugins:
+    - redirects:
+        redirect_maps:
+            'old.md': 'new.md'
+            'old/file.md': 'new/file.md'
+            'some_file.md': 'http://external.url.com/foobar'
+```
+
+_Note: don't forget that specifying the `plugins` setting will override the defaults if you didn't already have it set! See [this page](https://www.mkdocs.org/user-guide/configuration/#plugins) for more information._
+
+The redirects map should take the form of a key/value pair:
+
+- The key of each redirect is the original _markdown doc_ (relative to the `docs_dir` path).
+  - This plugin will handle the filename resolution during the `mkdocs build` process.
+    This should be set to what the original markdown doc's filename was (or what it _would be_ if it existed), not the final HTML file rendered by MkDocs
+- The value is the _redirect target_. This can take the following forms:
+  - Path of the _markdown doc_ you wish to be redirected to (relative to `docs_dir`)
+    - This plugin will handle the filename resolution during the `mkdocs build` process.
+      This should be set to what the markdown doc's filename is, not the final HTML file rendered by MkDocs
+  - External URL (e.g. `http://example.com`)
+
+During the `mkdocs build` process, this plugin will create `.html` files in `site_dir` for each of the "old" file that redirects to the "new" path.
+It will produce a warning if any problems are encountered or of the redirect target doesn't actually exist (useful if you have `strict: true` set).
+
+### `use_directory_urls`
+
+If you have `use_directory_urls: true` set (which is the default), this plugin will modify the redirect targets to the _directory_ URL, not the _actual_ `index.html` filename.
+However, it will create the `index.html` file for each target in the correct place so URL resolution works.
+
+For example, a redirect map of `'old/dir/README.md': 'new/dir/README.md'` will result in an HTML file created at `$site_dir/old/dir/index.html` which redirects to `../../new/dir/`.
+
+Additionally, a redirect map of `'old/dir/doc_name.md': 'new/dir/doc_name.md'` will result in `$site_dir/old/dir/doc_name/index.html` redirecting to `../../new/dir/doc_name/`.
+
+This mimics the behavior of how MkDocs builds the site dir without this plugin.
+
+## Developing
+
+### Setup a virtualenv
+
+Create a virtualenv using a method of your choice.
+
+```bash
+brew install pyenv pyenv-virtualenv
+pyenv install 2.7.18
+pyenv virtualenv 2.7.18 mkdocs-redirects
+pyenv activate mkdocs-redirects
+```
+
+### Build
+
+```bash
+make build
+```
+
+### Test
+
+```bash
+make test
+```
+
+## Releasing
+
+```bash
+make release
+```
+
+It will prompt you for your PyPI user and password.
+
+See:
+
+- <https://packaging.python.org/tutorials/packaging-projects/>
+- <https://packaging.python.org/guides/migrating-to-pypi-org/>
diff --git a/mkdocs_redirects.egg-info/SOURCES.txt b/mkdocs_redirects.egg-info/SOURCES.txt
new file mode 100644
index 0000000..2b62367
--- /dev/null
+++ b/mkdocs_redirects.egg-info/SOURCES.txt
@@ -0,0 +1,12 @@
+LICENSE
+README.md
+setup.cfg
+setup.py
+mkdocs_redirects/__init__.py
+mkdocs_redirects/plugin.py
+mkdocs_redirects.egg-info/PKG-INFO
+mkdocs_redirects.egg-info/SOURCES.txt
+mkdocs_redirects.egg-info/dependency_links.txt
+mkdocs_redirects.egg-info/entry_points.txt
+mkdocs_redirects.egg-info/requires.txt
+mkdocs_redirects.egg-info/top_level.txt
\ No newline at end of file
diff --git a/mkdocs_redirects.egg-info/dependency_links.txt b/mkdocs_redirects.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/mkdocs_redirects.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/mkdocs_redirects.egg-info/entry_points.txt b/mkdocs_redirects.egg-info/entry_points.txt
new file mode 100644
index 0000000..901b36e
--- /dev/null
+++ b/mkdocs_redirects.egg-info/entry_points.txt
@@ -0,0 +1,2 @@
+[mkdocs.plugins]
+redirects = mkdocs_redirects.plugin:RedirectPlugin
diff --git a/mkdocs_redirects.egg-info/requires.txt b/mkdocs_redirects.egg-info/requires.txt
new file mode 100644
index 0000000..0253011
--- /dev/null
+++ b/mkdocs_redirects.egg-info/requires.txt
@@ -0,0 +1,17 @@
+mkdocs>=1.1.1
+
+[dev]
+autoflake
+black
+isort
+pytest
+twine>=1.13.0
+
+[release]
+twine>=1.13.0
+
+[test]
+autoflake
+black
+isort
+pytest
diff --git a/mkdocs_redirects.egg-info/top_level.txt b/mkdocs_redirects.egg-info/top_level.txt
new file mode 100644
index 0000000..1051c4b
--- /dev/null
+++ b/mkdocs_redirects.egg-info/top_level.txt
@@ -0,0 +1 @@
+mkdocs_redirects
diff --git a/mkdocs_redirects/plugin.py b/mkdocs_redirects/plugin.py
index a0a1ac3..207dfd0 100644
--- a/mkdocs_redirects/plugin.py
+++ b/mkdocs_redirects/plugin.py
@@ -12,7 +12,6 @@ from mkdocs.plugins import BasePlugin
 from mkdocs.structure.files import File
 
 log = logging.getLogger('mkdocs.plugin.redirects')
-log.addFilter(utils.warning_filter)
 
 
 HTML_TEMPLATE = """
diff --git a/pytest.ini b/pytest.ini
deleted file mode 100644
index 2b1c54f..0000000
--- a/pytest.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[pytest]
-addopts = --tb=native
-filterwarnings =
-    ignore::DeprecationWarning:.*:
-    default::DeprecationWarning:mkdocs_redirects.*:
diff --git a/setup.cfg b/setup.cfg
index 9ed7937..f43c034 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -5,3 +5,8 @@ extend-ignore = E203
 [isort]
 profile = black
 line_length = 100
+
+[egg_info]
+tag_build = 
+tag_date = 0
+
diff --git a/tests/test_plugin.py b/tests/test_plugin.py
deleted file mode 100644
index 6fee1c3..0000000
--- a/tests/test_plugin.py
+++ /dev/null
@@ -1,130 +0,0 @@
-"""
-Copyright 2019-2022 DataRobot, Inc. and its affiliates.
-All rights reserved.
-"""
-
-import pytest
-from mkdocs.structure.files import File
-
-from mkdocs_redirects import plugin
-
-existing_pages = [
-    "README.md",
-    "foo/README.md",
-    "foo/bar/new.md",
-    "foo/index.md",
-    "foo/new.md",
-    "index.md",
-    "new.md",
-    "new/README.md",
-    "new/index.md",
-    "100%.md",
-    "the/fake.md",
-]
-
-
-@pytest.fixture
-def run_redirect_test(monkeypatch, old_page, new_page, use_directory_urls):
-    wrote = ()
-
-    def write_html(site_dir, old_path, new_path):
-        nonlocal wrote
-        wrote = (old_path, new_path)
-
-    monkeypatch.setattr(plugin, "write_html", write_html)
-
-    plg = plugin.RedirectPlugin()
-    plg.redirects = {old_page: new_page}
-    plg.doc_pages = {
-        path: File(path, "docs", "site", use_directory_urls) for path in existing_pages
-    }
-    plg.doc_pages["the/fake.md"].dest_path = "fake/destination/index.html"
-    plg.doc_pages["the/fake.md"].url = plg.doc_pages["the/fake.md"]._get_url(use_directory_urls)
-
-    plg.on_post_build(dict(use_directory_urls=use_directory_urls, site_dir="site"))
-
-    return wrote
-
-
-@pytest.fixture
-def actual_redirect_target(run_redirect_test):
-    assert bool(run_redirect_test)
-    return run_redirect_test[1]
-
-
-@pytest.fixture
-def actual_written_file(run_redirect_test):
-    assert bool(run_redirect_test)
-    return run_redirect_test[0]
-
-
-# Tuples of:
-# * Left side of the redirect item
-# * Right side of the redirect item
-# * Expected destination URL written into the HTML file, use_directory_urls=False
-# * Expected destination URL written into the HTML file, use_directory_urls=True
-testdata = [
-    ("old.md", "index.md", "index.html", "../"),
-    ("old.md", "README.md", "index.html", "../"),
-    ("old.md", "new.md", "new.html", "../new/"),
-    ("old.md", "new/index.md", "new/index.html", "../new/"),
-    ("old.md", "new/README.md", "new/index.html", "../new/"),
-    ("foo/old.md", "foo/new.md", "new.html", "../new/"),
-    ("foo/fizz/old.md", "foo/bar/new.md", "../bar/new.html", "../../bar/new/"),
-    ("fizz/old.md", "foo/bar/new.md", "../foo/bar/new.html", "../../foo/bar/new/"),
-    ("foo.md", "foo/index.md", "foo/index.html", "./"),
-    ("foo.md", "foo/README.md", "foo/index.html", "./"),
-    ("foo.md", "the/fake.md", "fake/destination/index.html", "../fake/destination/"),
-    ("old.md", "index.md#hash", "index.html#hash", "../#hash"),
-    ("old.md", "README.md#hash", "index.html#hash", "../#hash"),
-    ("old.md", "new.md#hash", "new.html#hash", "../new/#hash"),
-    ("old.md", "new/index.md#hash", "new/index.html#hash", "../new/#hash"),
-    ("old.md", "new/README.md#hash", "new/index.html#hash", "../new/#hash"),
-    ("foo/old.md", "foo/new.md#hash", "new.html#hash", "../new/#hash"),
-    ("foo/fizz/old.md", "foo/bar/new.md#hash", "../bar/new.html#hash", "../../bar/new/#hash"),
-    ("fizz/old.md", "foo/bar/new.md#hash", "../foo/bar/new.html#hash", "../../foo/bar/new/#hash"),
-    ("foo.md", "foo/index.md#hash", "foo/index.html#hash", "./#hash"),
-    ("foo.md", "foo/README.md#hash", "foo/index.html#hash", "./#hash"),
-    ("foo.md", "the/fake.md#hash", "fake/destination/index.html#hash", "../fake/destination/#hash"),
-    ("foo.md", "100%.md", "100%25.html", "../100%25/"),
-    ("foo/fizz/old.md",) + ("https://example.org/old.md",) * 3,
-]
-
-
-@pytest.mark.parametrize("use_directory_urls", [False])
-@pytest.mark.parametrize(["old_page", "new_page", "expected", "_"], testdata)
-def test_relative_redirect_no_directory_urls(actual_redirect_target, expected, _):
-    assert actual_redirect_target == expected
-
-
-@pytest.mark.parametrize("use_directory_urls", [True])
-@pytest.mark.parametrize(["old_page", "new_page", "_", "expected"], testdata)
-def test_relative_redirect_directory_urls(actual_redirect_target, _, expected):
-    assert actual_redirect_target == expected
-
-
-# Tuples of:
-# * Left side of the redirect item
-# * Expected path of the written HTML file, use_directory_urls=False
-# * Expected path of the written HTML file, use_directory_urls=True
-testdata = [
-    ("old.md", "old.html", "old/index.html"),
-    ("README.md", "index.html", "index.html"),
-    ("100%.md", "100%.html", "100%/index.html"),
-    ("foo/fizz/old.md", "foo/fizz/old.html", "foo/fizz/old/index.html"),
-    ("foo/fizz/index.md", "foo/fizz/index.html", "foo/fizz/index.html"),
-]
-
-
-@pytest.mark.parametrize("use_directory_urls", [False])
-@pytest.mark.parametrize("new_page", ["new.md"])
-@pytest.mark.parametrize(["old_page", "expected", "_"], testdata)
-def test_page_dest_path_no_directory_urls(actual_written_file, old_page, expected, _):
-    assert actual_written_file == expected
-
-
-@pytest.mark.parametrize("use_directory_urls", [True])
-@pytest.mark.parametrize("new_page", ["new.md"])
-@pytest.mark.parametrize(["old_page", "_", "expected"], testdata)
-def test_page_dest_path_directory_urls(actual_written_file, old_page, _, expected):
-    assert actual_written_file == expected

More details

Full run details

Historical runs