pelican-avatar 1.0.5__tar.gz → 1.0.9__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.
- {pelican_avatar-1.0.5 → pelican_avatar-1.0.9}/CHANGELOG.md +26 -0
- {pelican_avatar-1.0.5 → pelican_avatar-1.0.9}/PKG-INFO +13 -11
- {pelican_avatar-1.0.5 → pelican_avatar-1.0.9}/README.md +4 -2
- {pelican_avatar-1.0.5 → pelican_avatar-1.0.9}/pelican/plugins/avatar/avatar.py +15 -11
- {pelican_avatar-1.0.5 → pelican_avatar-1.0.9}/pyproject.toml +62 -35
- pelican_avatar-1.0.5/.editorconfig +0 -15
- pelican_avatar-1.0.5/.github/FUNDING.yml +0 -5
- pelican_avatar-1.0.5/.github/workflows/main.yml +0 -97
- pelican_avatar-1.0.5/.gitignore +0 -2
- pelican_avatar-1.0.5/.pre-commit-config.yaml +0 -31
- pelican_avatar-1.0.5/RELEASE.md +0 -3
- pelican_avatar-1.0.5/tasks.py +0 -99
- pelican_avatar-1.0.5/tox.ini +0 -3
- {pelican_avatar-1.0.5 → pelican_avatar-1.0.9}/CONTRIBUTING.md +0 -0
- {pelican_avatar-1.0.5 → pelican_avatar-1.0.9}/LICENSE +0 -0
- {pelican_avatar-1.0.5 → pelican_avatar-1.0.9}/avatar-example.png +0 -0
- {pelican_avatar-1.0.5 → pelican_avatar-1.0.9}/pelican/plugins/avatar/__init__.py +0 -0
- {pelican_avatar-1.0.5 → pelican_avatar-1.0.9}/pelican/plugins/avatar/test_avatar.py +0 -0
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
CHANGELOG
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
+
1.0.9 - 2024-04-14
|
|
5
|
+
------------------
|
|
6
|
+
|
|
7
|
+
Ensure plugin is included in sdist build
|
|
8
|
+
|
|
9
|
+
1.0.8 - 2024-04-11
|
|
10
|
+
------------------
|
|
11
|
+
|
|
12
|
+
Maintainance release (no user visible changes)
|
|
13
|
+
|
|
14
|
+
* Add acknowledgments to Lucas Cimon and Christian Clauss
|
|
15
|
+
* Update list of Copyright years
|
|
16
|
+
|
|
17
|
+
1.0.7 - 2024-04-11
|
|
18
|
+
------------------
|
|
19
|
+
|
|
20
|
+
Code improvement (no user visible changes)
|
|
21
|
+
|
|
22
|
+
1.0.6 - 2024-04-07
|
|
23
|
+
------------------
|
|
24
|
+
|
|
25
|
+
Maintainance release (no user visible changes)
|
|
26
|
+
|
|
27
|
+
* Add Python 3.12 to CI test matrix
|
|
28
|
+
* Switch build system from Hatchling to PDM
|
|
29
|
+
|
|
4
30
|
1.0.5 - 2023-10-30
|
|
5
31
|
------------------
|
|
6
32
|
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pelican-avatar
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.9
|
|
4
4
|
Summary: Libravatar/Gravatar plugin for Pelican
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Project-URL: Funding, https://donate.getpelican.com/
|
|
8
|
-
Author-email: Rafael Laboissière <rafael@laboissiere.net>
|
|
5
|
+
Keywords: pelican,plugin,libravatar,gravatar
|
|
6
|
+
Author-Email: =?utf-8?q?Rafael_Laboissi=C3=A8re?= <rafael@laboissiere.net>
|
|
9
7
|
License: AGPL-3.0
|
|
10
|
-
License-File: LICENSE
|
|
11
|
-
Keywords: gravatar,libravatar,pelican,plugin
|
|
12
8
|
Classifier: Development Status :: 5 - Production/Stable
|
|
13
9
|
Classifier: Environment :: Console
|
|
14
10
|
Classifier: Framework :: Pelican
|
|
@@ -21,15 +17,19 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
21
17
|
Classifier: Programming Language :: Python :: 3.9
|
|
22
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
23
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
21
|
Classifier: Topic :: Internet :: WWW/HTTP
|
|
25
22
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Project-URL: Homepage, https://github.com/pelican-plugins/avatar
|
|
24
|
+
Project-URL: Issue tracker, https://github.com/pelican-plugins/avatar/issues
|
|
25
|
+
Project-URL: Funding, https://donate.getpelican.com/
|
|
26
26
|
Requires-Python: <4.0,>=3.8.1
|
|
27
|
-
Requires-Dist: libgravatar>=0.2.5
|
|
28
27
|
Requires-Dist: pelican>=4.5
|
|
28
|
+
Requires-Dist: libgravatar>=0.2.5
|
|
29
29
|
Requires-Dist: py3dns>=3.2
|
|
30
30
|
Requires-Dist: pylibravatar>=1.7
|
|
31
|
+
Requires-Dist: markdown>=3.4; extra == "markdown"
|
|
31
32
|
Provides-Extra: markdown
|
|
32
|
-
Requires-Dist: markdown>=3.4; extra == 'markdown'
|
|
33
33
|
Description-Content-Type: text/markdown
|
|
34
34
|
|
|
35
35
|
Avatar: A Plugin for Pelican
|
|
@@ -157,15 +157,17 @@ To start contributing to this plugin, review the [Contributing to Pelican][] doc
|
|
|
157
157
|
Acknowledgments
|
|
158
158
|
---------------
|
|
159
159
|
|
|
160
|
-
Thanks to [Justin Mayer][] for helping with migration of this plugin under the Pelican Plugins organization
|
|
160
|
+
Thanks to [Justin Mayer][] for helping with migration of this plugin under the Pelican Plugins organization, to [Troy Curtis][] for adding support for page generator and global generator context and for making improvements in the Poetry workflow, to [Lucas Cimon][] for fixes in the test suit and in the CI support, and to [Christian Clauss][] for Python 3 porting.
|
|
161
161
|
|
|
162
162
|
[Justin Mayer]: https://github.com/justinmayer
|
|
163
163
|
[Troy Curtis]: https://github.com/troycurtisjr
|
|
164
|
+
[Lucas Cimon]: https://github.com/Lucas-C
|
|
165
|
+
[Christian Clauss]: https://github.com/cclauss
|
|
164
166
|
|
|
165
167
|
Author
|
|
166
168
|
------
|
|
167
169
|
|
|
168
|
-
Copyright (C) 2015, 2021-
|
|
170
|
+
Copyright (C) 2015, 2021-2024 Rafael Laboissière (<rafael@laboissiere.net>)
|
|
169
171
|
|
|
170
172
|
License
|
|
171
173
|
-------
|
|
@@ -123,15 +123,17 @@ To start contributing to this plugin, review the [Contributing to Pelican][] doc
|
|
|
123
123
|
Acknowledgments
|
|
124
124
|
---------------
|
|
125
125
|
|
|
126
|
-
Thanks to [Justin Mayer][] for helping with migration of this plugin under the Pelican Plugins organization
|
|
126
|
+
Thanks to [Justin Mayer][] for helping with migration of this plugin under the Pelican Plugins organization, to [Troy Curtis][] for adding support for page generator and global generator context and for making improvements in the Poetry workflow, to [Lucas Cimon][] for fixes in the test suit and in the CI support, and to [Christian Clauss][] for Python 3 porting.
|
|
127
127
|
|
|
128
128
|
[Justin Mayer]: https://github.com/justinmayer
|
|
129
129
|
[Troy Curtis]: https://github.com/troycurtisjr
|
|
130
|
+
[Lucas Cimon]: https://github.com/Lucas-C
|
|
131
|
+
[Christian Clauss]: https://github.com/cclauss
|
|
130
132
|
|
|
131
133
|
Author
|
|
132
134
|
------
|
|
133
135
|
|
|
134
|
-
Copyright (C) 2015, 2021-
|
|
136
|
+
Copyright (C) 2015, 2021-2024 Rafael Laboissière (<rafael@laboissiere.net>)
|
|
135
137
|
|
|
136
138
|
License
|
|
137
139
|
-------
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Avatar plugin for Pelican."""
|
|
2
2
|
|
|
3
|
-
# Copyright (C) 2015, 2021-
|
|
3
|
+
# Copyright (C) 2015, 2021-2024 Rafael Laboissière <rafael@laboissiere.net>
|
|
4
4
|
#
|
|
5
5
|
# This program is free software: you can redistribute it and/or modify it
|
|
6
6
|
# under the terms of the GNU General Affero Public License as published by
|
|
@@ -40,19 +40,23 @@ def gen_avatar_url(settings, email):
|
|
|
40
40
|
email = email.lower()
|
|
41
41
|
# Compose URL
|
|
42
42
|
if settings.get("AVATAR_USE_GRAVATAR"):
|
|
43
|
-
|
|
43
|
+
params = {}
|
|
44
|
+
if missing:
|
|
45
|
+
params["default"] = missing
|
|
46
|
+
if size:
|
|
47
|
+
params["size"] = size
|
|
48
|
+
url = Gravatar(email).get_image(**params)
|
|
44
49
|
else:
|
|
45
50
|
url = libravatar_url(email)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
if missing or size:
|
|
52
|
+
url = url + "?"
|
|
53
|
+
if missing:
|
|
54
|
+
url = url + "d=" + missing
|
|
55
|
+
if size:
|
|
56
|
+
url = url + "&"
|
|
52
57
|
if size:
|
|
53
|
-
url = url + "
|
|
54
|
-
|
|
55
|
-
url = url + "s=" + str(size)
|
|
58
|
+
url = url + "s=" + str(size)
|
|
59
|
+
|
|
56
60
|
return url
|
|
57
61
|
|
|
58
62
|
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "pelican-avatar"
|
|
3
|
-
version = "1.0.
|
|
3
|
+
version = "1.0.9"
|
|
4
4
|
description = "Libravatar/Gravatar plugin for Pelican"
|
|
5
|
-
authors = [
|
|
6
|
-
|
|
5
|
+
authors = [
|
|
6
|
+
{ name = "Rafael Laboissière", email = "rafael@laboissiere.net" },
|
|
7
|
+
]
|
|
7
8
|
readme = "README.md"
|
|
8
|
-
keywords = [
|
|
9
|
+
keywords = [
|
|
10
|
+
"pelican",
|
|
11
|
+
"plugin",
|
|
12
|
+
"libravatar",
|
|
13
|
+
"gravatar",
|
|
14
|
+
]
|
|
9
15
|
classifiers = [
|
|
10
16
|
"Development Status :: 5 - Production/Stable",
|
|
11
17
|
"Environment :: Console",
|
|
@@ -19,6 +25,7 @@ classifiers = [
|
|
|
19
25
|
"Programming Language :: Python :: 3.9",
|
|
20
26
|
"Programming Language :: Python :: 3.10",
|
|
21
27
|
"Programming Language :: Python :: 3.11",
|
|
28
|
+
"Programming Language :: Python :: 3.12",
|
|
22
29
|
"Topic :: Internet :: WWW/HTTP",
|
|
23
30
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
24
31
|
]
|
|
@@ -30,13 +37,18 @@ dependencies = [
|
|
|
30
37
|
"pylibravatar>=1.7",
|
|
31
38
|
]
|
|
32
39
|
|
|
40
|
+
[project.license]
|
|
41
|
+
text = "AGPL-3.0"
|
|
42
|
+
|
|
33
43
|
[project.urls]
|
|
34
44
|
Homepage = "https://github.com/pelican-plugins/avatar"
|
|
35
45
|
"Issue Tracker" = "https://github.com/pelican-plugins/avatar/issues"
|
|
36
46
|
Funding = "https://donate.getpelican.com/"
|
|
37
47
|
|
|
38
48
|
[project.optional-dependencies]
|
|
39
|
-
markdown = [
|
|
49
|
+
markdown = [
|
|
50
|
+
"markdown>=3.4",
|
|
51
|
+
]
|
|
40
52
|
|
|
41
53
|
[tool.pdm.dev-dependencies]
|
|
42
54
|
lint = [
|
|
@@ -51,6 +63,18 @@ test = [
|
|
|
51
63
|
"pytest-sugar>=0.9.7",
|
|
52
64
|
]
|
|
53
65
|
|
|
66
|
+
[tool.pdm.build]
|
|
67
|
+
source-includes = [
|
|
68
|
+
"CHANGELOG.md",
|
|
69
|
+
"CONTRIBUTING.md",
|
|
70
|
+
"avatar-example.png",
|
|
71
|
+
]
|
|
72
|
+
includes = [
|
|
73
|
+
"pelican/",
|
|
74
|
+
]
|
|
75
|
+
excludes = [
|
|
76
|
+
"tasks.py",
|
|
77
|
+
]
|
|
54
78
|
|
|
55
79
|
[tool.autopub]
|
|
56
80
|
project-name = "Avatar"
|
|
@@ -60,42 +84,45 @@ append-github-contributor = true
|
|
|
60
84
|
|
|
61
85
|
[tool.ruff]
|
|
62
86
|
select = [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
"B",
|
|
88
|
+
"BLE",
|
|
89
|
+
"C4",
|
|
90
|
+
"D",
|
|
91
|
+
"E",
|
|
92
|
+
"F",
|
|
93
|
+
"I",
|
|
94
|
+
"ICN",
|
|
95
|
+
"ISC",
|
|
96
|
+
"PGH",
|
|
97
|
+
"PL",
|
|
98
|
+
"RET",
|
|
99
|
+
"RUF",
|
|
100
|
+
"SIM",
|
|
101
|
+
"T10",
|
|
102
|
+
"T20",
|
|
103
|
+
"TID",
|
|
104
|
+
"TRY",
|
|
105
|
+
"UP",
|
|
106
|
+
"W",
|
|
107
|
+
"YTT",
|
|
84
108
|
]
|
|
85
|
-
|
|
86
109
|
ignore = [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
110
|
+
"D100",
|
|
111
|
+
"D102",
|
|
112
|
+
"D104",
|
|
113
|
+
"D203",
|
|
114
|
+
"D213",
|
|
90
115
|
]
|
|
91
116
|
|
|
92
|
-
target-version = "py38"
|
|
93
|
-
|
|
94
117
|
[tool.ruff.isort]
|
|
95
118
|
combine-as-imports = true
|
|
96
119
|
force-sort-within-sections = true
|
|
97
|
-
known-first-party = [
|
|
120
|
+
known-first-party = [
|
|
121
|
+
"pelican",
|
|
122
|
+
]
|
|
98
123
|
|
|
99
124
|
[build-system]
|
|
100
|
-
requires = [
|
|
101
|
-
|
|
125
|
+
requires = [
|
|
126
|
+
"pdm-backend",
|
|
127
|
+
]
|
|
128
|
+
build-backend = "pdm.backend"
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
name: build
|
|
2
|
-
|
|
3
|
-
on: [push, pull_request]
|
|
4
|
-
|
|
5
|
-
env:
|
|
6
|
-
PYTEST_ADDOPTS: "--color=yes"
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
test:
|
|
10
|
-
name: Test - ${{ matrix.python-version }}
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
strategy:
|
|
13
|
-
matrix:
|
|
14
|
-
python-version: ["3.8", "3.9", "3.10", "3.11"]
|
|
15
|
-
|
|
16
|
-
steps:
|
|
17
|
-
- uses: actions/checkout@v3
|
|
18
|
-
|
|
19
|
-
- name: Set up Python ${{ matrix.python-version }} & PDM
|
|
20
|
-
uses: pdm-project/setup-pdm@v3
|
|
21
|
-
with:
|
|
22
|
-
python-version: ${{ matrix.python-version }}
|
|
23
|
-
cache: true
|
|
24
|
-
cache-dependency-path: ./pyproject.toml
|
|
25
|
-
|
|
26
|
-
- name: Install dependencies
|
|
27
|
-
run: pdm install
|
|
28
|
-
|
|
29
|
-
- name: Run tests
|
|
30
|
-
run: pdm run invoke tests
|
|
31
|
-
|
|
32
|
-
lint:
|
|
33
|
-
name: Lint
|
|
34
|
-
runs-on: ubuntu-latest
|
|
35
|
-
|
|
36
|
-
steps:
|
|
37
|
-
- uses: actions/checkout@v3
|
|
38
|
-
|
|
39
|
-
- name: Validate links in Markdown files
|
|
40
|
-
uses: JustinBeckwith/linkinator-action@v1
|
|
41
|
-
with:
|
|
42
|
-
retry: true
|
|
43
|
-
linksToSkip: "https://pypi.org/project/pelican-avatar/"
|
|
44
|
-
|
|
45
|
-
- name: Set up Python & PDM
|
|
46
|
-
uses: pdm-project/setup-pdm@v3
|
|
47
|
-
with:
|
|
48
|
-
python-version: "3.10"
|
|
49
|
-
cache: true
|
|
50
|
-
cache-dependency-path: ./pyproject.toml
|
|
51
|
-
|
|
52
|
-
- name: Install dependencies
|
|
53
|
-
run: pdm install
|
|
54
|
-
|
|
55
|
-
- name: Run linters
|
|
56
|
-
run: pdm run invoke lint --diff
|
|
57
|
-
|
|
58
|
-
deploy:
|
|
59
|
-
name: Deploy
|
|
60
|
-
environment: Deployment
|
|
61
|
-
needs: [test, lint]
|
|
62
|
-
runs-on: ubuntu-latest
|
|
63
|
-
if: github.ref=='refs/heads/main' && github.event_name!='pull_request'
|
|
64
|
-
|
|
65
|
-
permissions:
|
|
66
|
-
contents: write
|
|
67
|
-
id-token: write
|
|
68
|
-
|
|
69
|
-
steps:
|
|
70
|
-
- uses: actions/checkout@v3
|
|
71
|
-
with:
|
|
72
|
-
token: ${{ secrets.GH_TOKEN }}
|
|
73
|
-
|
|
74
|
-
- name: Set up Python
|
|
75
|
-
uses: actions/setup-python@v4
|
|
76
|
-
with:
|
|
77
|
-
python-version: "3.10"
|
|
78
|
-
|
|
79
|
-
- name: Check release
|
|
80
|
-
id: check_release
|
|
81
|
-
run: |
|
|
82
|
-
python -m pip install autopub[github]
|
|
83
|
-
autopub check
|
|
84
|
-
|
|
85
|
-
- name: Publish
|
|
86
|
-
if: ${{ steps.check_release.outputs.autopub_release=='true' }}
|
|
87
|
-
env:
|
|
88
|
-
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
89
|
-
run: |
|
|
90
|
-
autopub prepare
|
|
91
|
-
autopub commit
|
|
92
|
-
autopub build
|
|
93
|
-
autopub githubrelease
|
|
94
|
-
|
|
95
|
-
- name: Upload package to PyPI
|
|
96
|
-
if: ${{ steps.check_release.outputs.autopub_release=='true' }}
|
|
97
|
-
uses: pypa/gh-action-pypi-publish@release/v1
|
pelican_avatar-1.0.5/.gitignore
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
ci:
|
|
3
|
-
autoupdate_schedule: quarterly
|
|
4
|
-
|
|
5
|
-
# See https://pre-commit.com/hooks.html for info on hooks
|
|
6
|
-
repos:
|
|
7
|
-
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
8
|
-
rev: v4.4.0
|
|
9
|
-
hooks:
|
|
10
|
-
- id: check-added-large-files
|
|
11
|
-
- id: check-ast
|
|
12
|
-
- id: check-case-conflict
|
|
13
|
-
- id: check-docstring-first
|
|
14
|
-
- id: check-merge-conflict
|
|
15
|
-
- id: check-toml
|
|
16
|
-
- id: check-yaml
|
|
17
|
-
- id: debug-statements
|
|
18
|
-
- id: detect-private-key
|
|
19
|
-
- id: end-of-file-fixer
|
|
20
|
-
- id: forbid-new-submodules
|
|
21
|
-
- id: trailing-whitespace
|
|
22
|
-
|
|
23
|
-
- repo: https://github.com/psf/black
|
|
24
|
-
rev: 23.9.1
|
|
25
|
-
hooks:
|
|
26
|
-
- id: black
|
|
27
|
-
|
|
28
|
-
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
29
|
-
rev: v0.1.3
|
|
30
|
-
hooks:
|
|
31
|
-
- id: ruff
|
pelican_avatar-1.0.5/RELEASE.md
DELETED
pelican_avatar-1.0.5/tasks.py
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
from inspect import cleandoc
|
|
2
|
-
import logging
|
|
3
|
-
import os
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
from shutil import which
|
|
6
|
-
|
|
7
|
-
from invoke import task
|
|
8
|
-
|
|
9
|
-
logger = logging.getLogger(__name__)
|
|
10
|
-
|
|
11
|
-
PKG_NAME = "avatar"
|
|
12
|
-
PKG_PATH = Path(f"pelican/plugins/{PKG_NAME}")
|
|
13
|
-
|
|
14
|
-
ACTIVE_VENV = os.environ.get("VIRTUAL_ENV", None)
|
|
15
|
-
VENV_HOME = Path(os.environ.get("WORKON_HOME", "~/.local/share/virtualenvs"))
|
|
16
|
-
VENV_PATH = Path(ACTIVE_VENV) if ACTIVE_VENV else (VENV_HOME.expanduser() / PKG_NAME)
|
|
17
|
-
VENV = str(VENV_PATH.expanduser())
|
|
18
|
-
BIN_DIR = "bin" if os.name != "nt" else "Scripts"
|
|
19
|
-
VENV_BIN = Path(VENV) / Path(BIN_DIR)
|
|
20
|
-
|
|
21
|
-
TOOLS = ("pdm", "pre-commit")
|
|
22
|
-
PDM = which("pdm") if which("pdm") else (VENV_BIN / "pdm")
|
|
23
|
-
CMD_PREFIX = f"{VENV_BIN}/" if ACTIVE_VENV else f"{PDM} run "
|
|
24
|
-
PRECOMMIT = which("pre-commit") if which("pre-commit") else f"{CMD_PREFIX}pre-commit"
|
|
25
|
-
PTY = os.name != "nt"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
@task
|
|
29
|
-
def tests(c, deprecations=False):
|
|
30
|
-
"""Run the test suite, optionally with `--deprecations`."""
|
|
31
|
-
deprecations_flag = "" if deprecations else "-W ignore::DeprecationWarning"
|
|
32
|
-
c.run(f"{CMD_PREFIX}pytest {deprecations_flag}", pty=PTY)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
@task
|
|
36
|
-
def black(c, check=False, diff=False):
|
|
37
|
-
"""Run Black auto-formatter, optionally with `--check` or `--diff`."""
|
|
38
|
-
check_flag, diff_flag = "", ""
|
|
39
|
-
if check:
|
|
40
|
-
check_flag = "--check"
|
|
41
|
-
if diff:
|
|
42
|
-
diff_flag = "--diff"
|
|
43
|
-
c.run(f"{CMD_PREFIX}black {check_flag} {diff_flag} {PKG_PATH} tasks.py", pty=PTY)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
@task
|
|
47
|
-
def ruff(c, fix=False, diff=False):
|
|
48
|
-
"""Run Ruff to ensure code meets project standards."""
|
|
49
|
-
diff_flag, fix_flag = "", ""
|
|
50
|
-
if fix:
|
|
51
|
-
fix_flag = "--fix"
|
|
52
|
-
if diff:
|
|
53
|
-
diff_flag = "--diff"
|
|
54
|
-
c.run(f"{CMD_PREFIX}ruff check {diff_flag} {fix_flag} .", pty=PTY)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
@task
|
|
58
|
-
def lint(c, fix=False, diff=False):
|
|
59
|
-
"""Check code style via linting tools."""
|
|
60
|
-
ruff(c, fix=fix, diff=diff)
|
|
61
|
-
black(c, check=(not fix), diff=diff)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
@task
|
|
65
|
-
def tools(c):
|
|
66
|
-
"""Install development tools in the virtual environment if not already on PATH."""
|
|
67
|
-
for tool in TOOLS:
|
|
68
|
-
if not which(tool):
|
|
69
|
-
logger.info(f"** Installing {tool} **")
|
|
70
|
-
c.run(f"{CMD_PREFIX}pip install {tool}")
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
@task
|
|
74
|
-
def precommit(c):
|
|
75
|
-
"""Install pre-commit hooks to .git/hooks/pre-commit."""
|
|
76
|
-
logger.info("** Installing pre-commit hooks **")
|
|
77
|
-
c.run(f"{PRECOMMIT} install")
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
@task
|
|
81
|
-
def setup(c):
|
|
82
|
-
"""Set up the development environment."""
|
|
83
|
-
if which("pdm") or ACTIVE_VENV:
|
|
84
|
-
tools(c)
|
|
85
|
-
c.run(f"{CMD_PREFIX}python -m pip install --upgrade pip", pty=PTY)
|
|
86
|
-
c.run(f"{PDM} update --dev", pty=PTY)
|
|
87
|
-
precommit(c)
|
|
88
|
-
logger.info("\nDevelopment environment should now be set up and ready!\n")
|
|
89
|
-
else:
|
|
90
|
-
error_message = """
|
|
91
|
-
PDM is not installed, and there is no active virtual environment available.
|
|
92
|
-
You can either manually create and activate a virtual environment, or you can
|
|
93
|
-
install PDM via:
|
|
94
|
-
|
|
95
|
-
curl -sSL https://raw.githubusercontent.com/pdm-project/pdm/main/install-pdm.py | python3 -
|
|
96
|
-
|
|
97
|
-
Once you have taken one of the above two steps, run `invoke setup` again.
|
|
98
|
-
""" # noqa: E501
|
|
99
|
-
raise SystemExit(cleandoc(error_message))
|
pelican_avatar-1.0.5/tox.ini
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|