Skip to content

Commit 11c691b

Browse files
committed
chore: Update docs
1 parent bebc82a commit 11c691b

5 files changed

Lines changed: 91 additions & 13 deletions

File tree

docs/conf.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@
1414

1515
extensions = [
1616
"sphinx.ext.autodoc",
17-
"sphinx.ext.coverage",
1817
"sphinx.ext.napoleon",
1918
"sphinx.ext.viewcode",
20-
"sphinxcontrib.spelling",
2119
"recommonmark",
2220
]
2321

scripts/check-docs-spelling.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

scripts/gen-credits-data.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/env python
2+
3+
import json
4+
from itertools import chain
5+
from pathlib import Path
6+
7+
import requests
8+
import toml
9+
from pip._internal.commands.show import search_packages_info
10+
11+
12+
def add_vlz_url(p):
13+
try:
14+
with open(Path(__file__).parent / "templates" / "vlz" / (p["name"] + ".txt")) as stream:
15+
p["vlz-url"] = stream.read().rstrip("\n")
16+
except FileNotFoundError:
17+
pass
18+
return p
19+
20+
21+
def clean_info(p):
22+
p = add_vlz_url(p)
23+
return {k: v for k, v in p.items() if k in ("name", "home-page", "vlz-url")}
24+
25+
26+
metadata = toml.load(Path(__file__).parent.parent / "pyproject.toml")["tool"]["poetry"]
27+
direct_dependencies = sorted(
28+
[_.lower() for _ in chain(metadata["dependencies"].keys(), metadata["dev-dependencies"].keys())]
29+
)
30+
direct_dependencies.remove("python")
31+
32+
lock_data = toml.load(Path(__file__).parent.parent / "poetry.lock")
33+
indirect_dependencies = sorted([p["name"] for p in lock_data["package"] if p["name"] not in direct_dependencies])
34+
35+
# poetry.lock seems to always use lowercase for packages names
36+
package_info = {p["name"]: clean_info(p) for p in search_packages_info(direct_dependencies + indirect_dependencies)}
37+
38+
for dependency in direct_dependencies + indirect_dependencies:
39+
if dependency not in [_.lower() for _ in package_info.keys()]:
40+
info = requests.get(f"https://pypi.python.org/pypi/{dependency}/json").json()["info"]
41+
package_info[info["name"]] = add_vlz_url(
42+
{"name": info["name"], "home-page": info["home_page"] or info["project_url"] or info["package_url"]}
43+
)
44+
45+
lower_package_info = {}
46+
for package_name, package in package_info.items():
47+
lower = package_name.lower()
48+
if lower != package_name:
49+
lower_package_info[lower] = package
50+
51+
package_info.update(lower_package_info)
52+
53+
json_output = json.dumps(
54+
{
55+
"direct_dependencies": direct_dependencies,
56+
"indirect_dependencies": indirect_dependencies,
57+
"package_info": package_info,
58+
}
59+
)
60+
print(json_output)

scripts/templates/CREDITS.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!--
2+
IMPORTANT:
3+
This file is generated from the template at 'scripts/templates/CREDITS.md'.
4+
Please update the template instead of this file.
5+
-->
6+
7+
# Credits
8+
These projects were used to build {{ cookiecutter.project_name }}. **Thank you!**
9+
10+
[![`python`](https://www.vectorlogo.zone/logos/python/python-ar21.svg)](https://www.python.org/) |
11+
[`poetry`](https://poetry.eustace.io/) |
12+
[`cookie-poetry`](https://github.com/pawamoy/cookie-poetry)
13+
14+
### Direct dependencies
15+
{% raw %}{%- for dep in direct_dependencies -%}
16+
{%- with package = package_info.get(dep, {}) %}
17+
[{% if package.get("vlz-url") %}![{% endif %}`{{ package.get("name", dep) }}`]{% if package.get("vlz-url") %}({{ package["vlz-url"] }})]{% endif %}({{ package.get("home-page", "") }}){% if not loop.last %} |{% endif %}
18+
{%- endwith -%}
19+
{%- endfor %}{% endraw %}
20+
21+
### Indirect dependencies
22+
{% raw %}{%- for dep in indirect_dependencies -%}
23+
{%- with package = package_info.get(dep, {}) %}
24+
[{% if package.get("vlz-url") %}![{% endif %}`{{ package.get("name", dep) }}`]{% if package.get("vlz-url") %}({{ package["vlz-url"] }})]{% endif %}({{ package.get("home-page", "") }}){% if not loop.last %} |{% endif %}
25+
{%- endwith -%}
26+
{%- endfor %}{% endraw %}
27+
28+
**[More credits from the author](http://pawamoy.github.io/credits/)**
29+
30+
*See one of your project without the logo? Make sure it's available on [VectorLogoZone](https://www.vectorlogo.zone/)
31+
([GitHub repo](https://github.com/VectorLogoZone/vectorlogozone)) and open an issue or send a pull/merge request!*

scripts/update-spelling-wordlist.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)