mkdocs-git-authors-plugin 0.9.1__tar.gz → 0.9.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mkdocs_git_authors_plugin-0.9.1 → mkdocs_git_authors_plugin-0.9.3}/PKG-INFO +5 -6
- {mkdocs_git_authors_plugin-0.9.1 → mkdocs_git_authors_plugin-0.9.3}/mkdocs_git_authors_plugin/git/page.py +1 -0
- {mkdocs_git_authors_plugin-0.9.1 → mkdocs_git_authors_plugin-0.9.3}/mkdocs_git_authors_plugin/plugin.py +10 -7
- {mkdocs_git_authors_plugin-0.9.1 → mkdocs_git_authors_plugin-0.9.3}/mkdocs_git_authors_plugin/util.py +27 -0
- {mkdocs_git_authors_plugin-0.9.1 → mkdocs_git_authors_plugin-0.9.3}/mkdocs_git_authors_plugin.egg-info/PKG-INFO +5 -6
- {mkdocs_git_authors_plugin-0.9.1 → mkdocs_git_authors_plugin-0.9.3}/mkdocs_git_authors_plugin.egg-info/SOURCES.txt +1 -1
- mkdocs_git_authors_plugin-0.9.3/pyproject.toml +49 -0
- {mkdocs_git_authors_plugin-0.9.1 → mkdocs_git_authors_plugin-0.9.3}/tests/test_basic.py +30 -22
- mkdocs_git_authors_plugin-0.9.1/setup.py +0 -40
- {mkdocs_git_authors_plugin-0.9.1 → mkdocs_git_authors_plugin-0.9.3}/LICENSE +0 -0
- {mkdocs_git_authors_plugin-0.9.1 → mkdocs_git_authors_plugin-0.9.3}/README.md +0 -0
- {mkdocs_git_authors_plugin-0.9.1 → mkdocs_git_authors_plugin-0.9.3}/mkdocs_git_authors_plugin/__init__.py +0 -0
- {mkdocs_git_authors_plugin-0.9.1 → mkdocs_git_authors_plugin-0.9.3}/mkdocs_git_authors_plugin/ci.py +0 -0
- {mkdocs_git_authors_plugin-0.9.1 → mkdocs_git_authors_plugin-0.9.3}/mkdocs_git_authors_plugin/config.py +0 -0
- {mkdocs_git_authors_plugin-0.9.1 → mkdocs_git_authors_plugin-0.9.3}/mkdocs_git_authors_plugin/exclude.py +0 -0
- {mkdocs_git_authors_plugin-0.9.1 → mkdocs_git_authors_plugin-0.9.3}/mkdocs_git_authors_plugin/git/__init__.py +0 -0
- {mkdocs_git_authors_plugin-0.9.1 → mkdocs_git_authors_plugin-0.9.3}/mkdocs_git_authors_plugin/git/author.py +0 -0
- {mkdocs_git_authors_plugin-0.9.1 → mkdocs_git_authors_plugin-0.9.3}/mkdocs_git_authors_plugin/git/command.py +0 -0
- {mkdocs_git_authors_plugin-0.9.1 → mkdocs_git_authors_plugin-0.9.3}/mkdocs_git_authors_plugin/git/commit.py +0 -0
- {mkdocs_git_authors_plugin-0.9.1 → mkdocs_git_authors_plugin-0.9.3}/mkdocs_git_authors_plugin/git/repo.py +0 -0
- {mkdocs_git_authors_plugin-0.9.1 → mkdocs_git_authors_plugin-0.9.3}/mkdocs_git_authors_plugin.egg-info/dependency_links.txt +0 -0
- {mkdocs_git_authors_plugin-0.9.1 → mkdocs_git_authors_plugin-0.9.3}/mkdocs_git_authors_plugin.egg-info/entry_points.txt +0 -0
- {mkdocs_git_authors_plugin-0.9.1 → mkdocs_git_authors_plugin-0.9.3}/mkdocs_git_authors_plugin.egg-info/requires.txt +0 -0
- {mkdocs_git_authors_plugin-0.9.1 → mkdocs_git_authors_plugin-0.9.3}/mkdocs_git_authors_plugin.egg-info/top_level.txt +0 -0
- {mkdocs_git_authors_plugin-0.9.1 → mkdocs_git_authors_plugin-0.9.3}/setup.cfg +0 -0
- {mkdocs_git_authors_plugin-0.9.1 → mkdocs_git_authors_plugin-0.9.3}/tests/test_util.py +0 -0
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: mkdocs-git-authors-plugin
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.3
|
|
4
4
|
Summary: Mkdocs plugin to display git authors of a page
|
|
5
|
-
|
|
6
|
-
Author: Tim Vink
|
|
7
|
-
Author-email: vinktim@gmail.com
|
|
5
|
+
Author-email: Tim Vink <vinktim@gmail.com>
|
|
8
6
|
License: MIT
|
|
9
|
-
|
|
7
|
+
Project-URL: Homepage, https://github.com/timvink/mkdocs-git-authors-plugin
|
|
8
|
+
Keywords: mkdocs,git,contributors,committers,authors,plugin
|
|
10
9
|
Classifier: Operating System :: OS Independent
|
|
11
10
|
Classifier: Programming Language :: Python
|
|
12
11
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -149,6 +149,7 @@ class Page(AbstractRepoObject):
|
|
|
149
149
|
args.append("--ignore-revs-file")
|
|
150
150
|
args.append(self.repo().config("ignore_commits"))
|
|
151
151
|
args.append("--porcelain")
|
|
152
|
+
args.append("-w") # Ignore whitespace changes
|
|
152
153
|
args.append(str(self._path))
|
|
153
154
|
cmd = GitCommand("blame", args)
|
|
154
155
|
cmd.run()
|
|
@@ -15,6 +15,8 @@ from mkdocs_git_authors_plugin.config import GitAuthorsPluginConfig
|
|
|
15
15
|
from mkdocs_git_authors_plugin.exclude import exclude
|
|
16
16
|
from mkdocs_git_authors_plugin.git.command import GitCommandError
|
|
17
17
|
from mkdocs_git_authors_plugin.git.repo import Repo
|
|
18
|
+
from mkdocs_git_authors_plugin.util import working_directory
|
|
19
|
+
|
|
18
20
|
|
|
19
21
|
logger = logging.getLogger("mkdocs.plugins")
|
|
20
22
|
|
|
@@ -57,7 +59,8 @@ class GitAuthorsPlugin(BasePlugin[GitAuthorsPluginConfig]):
|
|
|
57
59
|
assert self.config.authorship_threshold_percent <= 100
|
|
58
60
|
|
|
59
61
|
try:
|
|
60
|
-
|
|
62
|
+
with working_directory(config.get("docs_dir",".")):
|
|
63
|
+
self._repo = Repo()
|
|
61
64
|
self._fallback = False
|
|
62
65
|
self.repo().set_config(self.config)
|
|
63
66
|
raise_ci_warnings(path=self.repo()._root)
|
|
@@ -118,16 +121,16 @@ class GitAuthorsPlugin(BasePlugin[GitAuthorsPluginConfig]):
|
|
|
118
121
|
if exclude(file.src_path, excluded_pages):
|
|
119
122
|
continue
|
|
120
123
|
|
|
121
|
-
if file
|
|
122
|
-
logger.debug(
|
|
123
|
-
f"[git-authors-plugin] Unable to find path for file {file.src_path}. "
|
|
124
|
-
"Generated, in-memory files won't have a git history."
|
|
125
|
-
)
|
|
126
|
-
elif hasattr(file, "generated_by") and file.generated_by:
|
|
124
|
+
if hasattr(file, "generated_by") and file.generated_by:
|
|
127
125
|
logger.debug(
|
|
128
126
|
f"[git-authors-plugin] The file {file.src_path} was generated by {file.generated_by}. "
|
|
129
127
|
"Generated, dynamic files won't have a git history."
|
|
130
128
|
)
|
|
129
|
+
elif not hasattr(file, 'src_dir') or file.src_dir is None:
|
|
130
|
+
logger.debug(
|
|
131
|
+
f"[git-authors-plugin] Unable to find path for file {file.src_path}. "
|
|
132
|
+
"Generated, in-memory files won't have a git history."
|
|
133
|
+
)
|
|
131
134
|
elif path := file.abs_src_path:
|
|
132
135
|
if path.endswith(".md"):
|
|
133
136
|
_ = self.repo().page(path)
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
from datetime import datetime, timedelta, timezone
|
|
2
2
|
from pathlib import Path
|
|
3
3
|
from typing import Any, Dict, List
|
|
4
|
+
import os
|
|
5
|
+
from contextlib import contextmanager
|
|
6
|
+
from typing import Any, Generator
|
|
7
|
+
from pathlib import Path
|
|
4
8
|
|
|
5
9
|
from mkdocs_git_authors_plugin.config import GitAuthorsPluginConfig
|
|
6
10
|
|
|
@@ -148,3 +152,26 @@ def page_authors(authors: List, path: str) -> List[Dict[str, Any]]:
|
|
|
148
152
|
}
|
|
149
153
|
for author in authors
|
|
150
154
|
]
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
@contextmanager
|
|
159
|
+
def working_directory(path) -> Generator[None, Any, None]:
|
|
160
|
+
"""
|
|
161
|
+
Temporarily change working directory.
|
|
162
|
+
A context manager which changes the working directory to the given
|
|
163
|
+
path, and then changes it back to its previous value on exit.
|
|
164
|
+
Usage:
|
|
165
|
+
```python
|
|
166
|
+
# Do something in original directory
|
|
167
|
+
with working_directory('/my/new/path'):
|
|
168
|
+
# Do something in new directory
|
|
169
|
+
# Back to old directory
|
|
170
|
+
```
|
|
171
|
+
"""
|
|
172
|
+
prev_cwd = os.getcwd()
|
|
173
|
+
os.chdir(path)
|
|
174
|
+
try:
|
|
175
|
+
yield
|
|
176
|
+
finally:
|
|
177
|
+
os.chdir(prev_cwd)
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: mkdocs-git-authors-plugin
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.3
|
|
4
4
|
Summary: Mkdocs plugin to display git authors of a page
|
|
5
|
-
|
|
6
|
-
Author: Tim Vink
|
|
7
|
-
Author-email: vinktim@gmail.com
|
|
5
|
+
Author-email: Tim Vink <vinktim@gmail.com>
|
|
8
6
|
License: MIT
|
|
9
|
-
|
|
7
|
+
Project-URL: Homepage, https://github.com/timvink/mkdocs-git-authors-plugin
|
|
8
|
+
Keywords: mkdocs,git,contributors,committers,authors,plugin
|
|
10
9
|
Classifier: Operating System :: OS Independent
|
|
11
10
|
Classifier: Programming Language :: Python
|
|
12
11
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=42", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "mkdocs-git-authors-plugin"
|
|
7
|
+
description = "Mkdocs plugin to display git authors of a page"
|
|
8
|
+
readme = { file = "README.md", content-type = "text/markdown" }
|
|
9
|
+
license = {text = "MIT"}
|
|
10
|
+
authors = [
|
|
11
|
+
{name = "Tim Vink", email = "vinktim@gmail.com"}
|
|
12
|
+
]
|
|
13
|
+
keywords = ["mkdocs", "git", "contributors", "committers", "authors", "plugin"]
|
|
14
|
+
urls = {Homepage = "https://github.com/timvink/mkdocs-git-authors-plugin"}
|
|
15
|
+
version = "0.9.3"
|
|
16
|
+
requires-python = ">=3.8"
|
|
17
|
+
dependencies = ["mkdocs>=1.0"]
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
"Programming Language :: Python",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.8",
|
|
23
|
+
"Programming Language :: Python :: 3.9",
|
|
24
|
+
"Programming Language :: Python :: 3.10",
|
|
25
|
+
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Programming Language :: Python :: 3.13",
|
|
28
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
29
|
+
"License :: OSI Approved :: MIT License",
|
|
30
|
+
"Topic :: Documentation",
|
|
31
|
+
"Topic :: Text Processing",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.entry-points."mkdocs.plugins"]
|
|
35
|
+
git-authors = "mkdocs_git_authors_plugin.plugin:GitAuthorsPlugin"
|
|
36
|
+
|
|
37
|
+
[dependency-groups]
|
|
38
|
+
dev = [
|
|
39
|
+
"click>=8.1.8",
|
|
40
|
+
"codecov>=2.1.13",
|
|
41
|
+
"gitpython>=3.1.44",
|
|
42
|
+
"mkapi!=2.0.*",
|
|
43
|
+
"mkdocs>=1.6.1",
|
|
44
|
+
"mkdocs-git-revision-date-localized-plugin>=1.4.4",
|
|
45
|
+
"mkdocs-macros-plugin>=1.3.7",
|
|
46
|
+
"mkdocs-material>=9.6.7",
|
|
47
|
+
"pytest>=8.3.5",
|
|
48
|
+
"pytest-cov>=5.0.0",
|
|
49
|
+
]
|
|
@@ -20,9 +20,7 @@ import os
|
|
|
20
20
|
import re
|
|
21
21
|
import shutil
|
|
22
22
|
import sys
|
|
23
|
-
from contextlib import contextmanager
|
|
24
23
|
from packaging.version import Version
|
|
25
|
-
from typing import Any, Generator
|
|
26
24
|
|
|
27
25
|
import git as gitpython
|
|
28
26
|
import mkdocs
|
|
@@ -31,6 +29,8 @@ from click.testing import CliRunner, Result
|
|
|
31
29
|
from git import Repo
|
|
32
30
|
from mkdocs.__main__ import build_command
|
|
33
31
|
|
|
32
|
+
from mkdocs_git_authors_plugin.util import working_directory
|
|
33
|
+
|
|
34
34
|
SITES_THAT_SHOULD_SUCCEED = [
|
|
35
35
|
"mkdocs.yml",
|
|
36
36
|
"mkdocs_complete_material.yml",
|
|
@@ -45,26 +45,6 @@ SITES_THAT_SHOULD_SUCCEED = [
|
|
|
45
45
|
]
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
@contextmanager
|
|
49
|
-
def working_directory(path) -> Generator[None, Any, None]:
|
|
50
|
-
"""
|
|
51
|
-
Temporarily change working directory.
|
|
52
|
-
A context manager which changes the working directory to the given
|
|
53
|
-
path, and then changes it back to its previous value on exit.
|
|
54
|
-
Usage:
|
|
55
|
-
```python
|
|
56
|
-
# Do something in original directory
|
|
57
|
-
with working_directory('/my/new/path'):
|
|
58
|
-
# Do something in new directory
|
|
59
|
-
# Back to old directory
|
|
60
|
-
```
|
|
61
|
-
"""
|
|
62
|
-
prev_cwd = os.getcwd()
|
|
63
|
-
os.chdir(path)
|
|
64
|
-
try:
|
|
65
|
-
yield
|
|
66
|
-
finally:
|
|
67
|
-
os.chdir(prev_cwd)
|
|
68
48
|
|
|
69
49
|
|
|
70
50
|
def build_docs_setup(mkdocs_path, output_path) -> Result:
|
|
@@ -373,3 +353,31 @@ def test_mkapi_v1(tmp_path) -> None:
|
|
|
373
353
|
r'<a href="\$api:src/mkdocs_git_authors_plugin.*" class="nav-link">API</a>',
|
|
374
354
|
contents,
|
|
375
355
|
)
|
|
356
|
+
|
|
357
|
+
def test_custom_docs_dir(tmp_path):
|
|
358
|
+
|
|
359
|
+
testproject_path = tmp_path / "testproject"
|
|
360
|
+
shutil.copytree("tests/custom_docs_dir", testproject_path)
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
# init git inside the docs directory
|
|
364
|
+
with working_directory(str(testproject_path / "documentation")):
|
|
365
|
+
# setup git history
|
|
366
|
+
repo = Repo.init(".")
|
|
367
|
+
assert not repo.bare
|
|
368
|
+
repo.git.add(all=True)
|
|
369
|
+
repo.index.commit("first commit")
|
|
370
|
+
|
|
371
|
+
with working_directory(str(testproject_path)):
|
|
372
|
+
result = build_docs_setup("mkdocs.yml", str(tmp_path / "site"))
|
|
373
|
+
|
|
374
|
+
assert (
|
|
375
|
+
result.exit_code == 0
|
|
376
|
+
), f"'mkdocs build' command failed. Error: {result.stdout}"
|
|
377
|
+
|
|
378
|
+
index_file = tmp_path / "site" / "index.html"
|
|
379
|
+
assert index_file.exists(), f"{index_file} does not exist"
|
|
380
|
+
|
|
381
|
+
contents = index_file.read_text()
|
|
382
|
+
assert re.search("<span class='git-page-authors", contents)
|
|
383
|
+
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
from setuptools import find_packages, setup
|
|
2
|
-
|
|
3
|
-
with open("README.md", "r") as fh:
|
|
4
|
-
long_description = fh.read()
|
|
5
|
-
|
|
6
|
-
setup(
|
|
7
|
-
name="mkdocs-git-authors-plugin",
|
|
8
|
-
version="0.9.1",
|
|
9
|
-
description="Mkdocs plugin to display git authors of a page",
|
|
10
|
-
long_description=long_description,
|
|
11
|
-
long_description_content_type="text/markdown",
|
|
12
|
-
keywords="mkdocs git contributors committers authors plugin",
|
|
13
|
-
url="https://github.com/timvink/mkdocs-git-authors-plugin",
|
|
14
|
-
author="Tim Vink",
|
|
15
|
-
author_email="vinktim@gmail.com",
|
|
16
|
-
license="MIT",
|
|
17
|
-
python_requires=">=3.8",
|
|
18
|
-
classifiers=[
|
|
19
|
-
"Operating System :: OS Independent",
|
|
20
|
-
"Programming Language :: Python",
|
|
21
|
-
"Programming Language :: Python :: 3",
|
|
22
|
-
"Programming Language :: Python :: 3.8",
|
|
23
|
-
"Programming Language :: Python :: 3.9",
|
|
24
|
-
"Programming Language :: Python :: 3.10",
|
|
25
|
-
"Programming Language :: Python :: 3.11",
|
|
26
|
-
"Programming Language :: Python :: 3.12",
|
|
27
|
-
"Programming Language :: Python :: 3.13",
|
|
28
|
-
"Programming Language :: Python :: 3 :: Only",
|
|
29
|
-
"License :: OSI Approved :: MIT License",
|
|
30
|
-
"Topic :: Documentation",
|
|
31
|
-
"Topic :: Text Processing",
|
|
32
|
-
],
|
|
33
|
-
install_requires=["mkdocs>=1.0"],
|
|
34
|
-
packages=find_packages(),
|
|
35
|
-
entry_points={
|
|
36
|
-
"mkdocs.plugins": [
|
|
37
|
-
"git-authors = mkdocs_git_authors_plugin.plugin:GitAuthorsPlugin"
|
|
38
|
-
]
|
|
39
|
-
},
|
|
40
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mkdocs_git_authors_plugin-0.9.1 → mkdocs_git_authors_plugin-0.9.3}/mkdocs_git_authors_plugin/ci.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|