click-async-plugins 0.7.3__tar.gz → 0.7.4__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.
- {click_async_plugins-0.7.3 → click_async_plugins-0.7.4}/.gitignore +1 -0
- {click_async_plugins-0.7.3 → click_async_plugins-0.7.4}/.pre-commit-config.yaml +2 -2
- {click_async_plugins-0.7.3 → click_async_plugins-0.7.4}/PKG-INFO +8 -6
- {click_async_plugins-0.7.3 → click_async_plugins-0.7.4}/README.md +6 -4
- click_async_plugins-0.7.4/_version.py +24 -0
- {click_async_plugins-0.7.3 → click_async_plugins-0.7.4}/click_async_plugins/util.py +7 -1
- {click_async_plugins-0.7.3 → click_async_plugins-0.7.4}/pyproject.toml +10 -4
- click_async_plugins-0.7.3/.github/workflows/python-package.yml +0 -88
- {click_async_plugins-0.7.3 → click_async_plugins-0.7.4}/LICENSE +0 -0
- {click_async_plugins-0.7.3 → click_async_plugins-0.7.4}/click_async_plugins/__init__.py +0 -0
- {click_async_plugins-0.7.3 → click_async_plugins-0.7.4}/click_async_plugins/command.py +0 -0
- {click_async_plugins-0.7.3 → click_async_plugins-0.7.4}/click_async_plugins/core.py +0 -0
- {click_async_plugins-0.7.3 → click_async_plugins-0.7.4}/click_async_plugins/debug.py +0 -0
- {click_async_plugins-0.7.3 → click_async_plugins-0.7.4}/click_async_plugins/group.py +0 -0
- {click_async_plugins-0.7.3 → click_async_plugins-0.7.4}/click_async_plugins/itc.py +0 -0
- {click_async_plugins-0.7.3 → click_async_plugins-0.7.4}/click_async_plugins/py.typed +0 -0
- {click_async_plugins-0.7.3 → click_async_plugins-0.7.4}/click_async_plugins/typedefs.py +0 -0
- {click_async_plugins-0.7.3 → click_async_plugins-0.7.4}/demo.py +0 -0
- {click_async_plugins-0.7.3 → click_async_plugins-0.7.4}/tests/test_typedefs.py +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# See https://pre-commit.com/hooks.html for more hooks
|
|
3
3
|
repos:
|
|
4
4
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
5
|
-
rev:
|
|
5
|
+
rev: v2.3.1
|
|
6
6
|
hooks:
|
|
7
7
|
- id: mypy
|
|
8
8
|
additional_dependencies:
|
|
@@ -10,7 +10,7 @@ repos:
|
|
|
10
10
|
- pytest
|
|
11
11
|
- pytest-asyncio
|
|
12
12
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
13
|
-
rev: v0.
|
|
13
|
+
rev: v0.16.4
|
|
14
14
|
hooks:
|
|
15
15
|
- id: ruff-check
|
|
16
16
|
args: [--show-fixes]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: click-async-plugins
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.4
|
|
4
4
|
Summary: An architecture to easily run asyncio tasks from Click
|
|
5
5
|
Author-email: "martin f. krafft" <click-async-plugins@pobox.madduck.net>
|
|
6
6
|
License-File: LICENSE
|
|
@@ -21,7 +21,7 @@ Requires-Dist: pytest-ruff; extra == 'dev'
|
|
|
21
21
|
Requires-Dist: ruff; extra == 'dev'
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
23
|
|
|
24
|
-
[](https://github.com/madduck/click-async-plugins/actions/workflows/0-testing.yml)
|
|
25
25
|
|
|
26
26
|
# click-async-plugins
|
|
27
27
|
|
|
@@ -37,7 +37,7 @@ async def myplugin(sleep: float) -> PluginLifespan:
|
|
|
37
37
|
|
|
38
38
|
# code to set things up goes here
|
|
39
39
|
|
|
40
|
-
async def long_running_task(*, sleep: float):
|
|
40
|
+
async def long_running_task(*, sleep: float) -> None:
|
|
41
41
|
# task initialisation can happen here
|
|
42
42
|
|
|
43
43
|
try:
|
|
@@ -94,6 +94,8 @@ its running via key presses. Hit `?` to get an overview of commands available.
|
|
|
94
94
|
|
|
95
95
|
Looking forward to your feedback.
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
## TODO
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
Test coverage… yeah, there's none right now :(
|
|
100
|
+
|
|
101
|
+
© 2025–26 martin f. krafft <<click-async-plugins@pobox.madduck.net>>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[](https://github.com/madduck/click-async-plugins/actions/workflows/0-testing.yml)
|
|
2
2
|
|
|
3
3
|
# click-async-plugins
|
|
4
4
|
|
|
@@ -14,7 +14,7 @@ async def myplugin(sleep: float) -> PluginLifespan:
|
|
|
14
14
|
|
|
15
15
|
# code to set things up goes here
|
|
16
16
|
|
|
17
|
-
async def long_running_task(*, sleep: float):
|
|
17
|
+
async def long_running_task(*, sleep: float) -> None:
|
|
18
18
|
# task initialisation can happen here
|
|
19
19
|
|
|
20
20
|
try:
|
|
@@ -71,6 +71,8 @@ its running via key presses. Hit `?` to get an overview of commands available.
|
|
|
71
71
|
|
|
72
72
|
Looking forward to your feedback.
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
## TODO
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
Test coverage… yeah, there's none right now :(
|
|
77
|
+
|
|
78
|
+
© 2025–26 martin f. krafft <<click-async-plugins@pobox.madduck.net>>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# file generated by vcs-versioning
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
"__version__",
|
|
7
|
+
"__version_tuple__",
|
|
8
|
+
"version",
|
|
9
|
+
"version_tuple",
|
|
10
|
+
"__commit_id__",
|
|
11
|
+
"commit_id",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
version: str
|
|
15
|
+
__version__: str
|
|
16
|
+
__version_tuple__: tuple[int | str, ...]
|
|
17
|
+
version_tuple: tuple[int | str, ...]
|
|
18
|
+
commit_id: str | None
|
|
19
|
+
__commit_id__: str | None
|
|
20
|
+
|
|
21
|
+
__version__ = version = '0.7.4'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 7, 4)
|
|
23
|
+
|
|
24
|
+
__commit_id__ = commit_id = None
|
|
@@ -11,6 +11,12 @@ import click
|
|
|
11
11
|
from .itc import ITC
|
|
12
12
|
from .typedefs import PluginFactory, PluginTask
|
|
13
13
|
|
|
14
|
+
try:
|
|
15
|
+
from inspect import iscoroutine
|
|
16
|
+
except ImportError:
|
|
17
|
+
# fall back to legacy implementation
|
|
18
|
+
from asyncio import iscoroutine # type: ignore[assignment]
|
|
19
|
+
|
|
14
20
|
logger = logging.getLogger(__name__)
|
|
15
21
|
|
|
16
22
|
|
|
@@ -41,7 +47,7 @@ def create_plugin_task[T](
|
|
|
41
47
|
) -> asyncio.Task[T]:
|
|
42
48
|
async def task_wrapper() -> None:
|
|
43
49
|
try:
|
|
44
|
-
if
|
|
50
|
+
if iscoroutine(task.task):
|
|
45
51
|
logger.debug(f"Scheduling task for '{task.name}'")
|
|
46
52
|
await task.task
|
|
47
53
|
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["hatchling"]
|
|
2
|
+
requires = ["hatchling", "hatch-vcs"]
|
|
3
3
|
build-backend = "hatchling.build"
|
|
4
4
|
|
|
5
|
-
[tool.
|
|
6
|
-
|
|
5
|
+
[tool.hatch.build.hooks.vcs]
|
|
6
|
+
version-file = "_version.py"
|
|
7
|
+
|
|
8
|
+
[tool.hatch.version]
|
|
9
|
+
source = "vcs"
|
|
10
|
+
|
|
11
|
+
[tool.hatch.build.targets.sdist]
|
|
12
|
+
exclude = [".direnv", ".gitignore", ".github"]
|
|
7
13
|
|
|
8
14
|
[project]
|
|
9
15
|
name = "click-async-plugins"
|
|
10
|
-
|
|
16
|
+
dynamic = ["version"]
|
|
11
17
|
authors = [
|
|
12
18
|
{ name = "martin f. krafft", email = "click-async-plugins@pobox.madduck.net" },
|
|
13
19
|
]
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
name: Style and unit tests
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: ["main"]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: ["main"]
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
test-and-build:
|
|
11
|
-
name: Setup test & build environment
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
strategy:
|
|
14
|
-
fail-fast: false
|
|
15
|
-
matrix:
|
|
16
|
-
python-version: ["3.13", "3.14"]
|
|
17
|
-
|
|
18
|
-
steps:
|
|
19
|
-
- name: Check out the source
|
|
20
|
-
uses: actions/checkout@v6
|
|
21
|
-
with:
|
|
22
|
-
persist-credentials: false
|
|
23
|
-
|
|
24
|
-
- name: Set up Python ${{ matrix.python-version }}
|
|
25
|
-
uses: actions/setup-python@v6
|
|
26
|
-
with:
|
|
27
|
-
python-version: ${{ matrix.python-version }}
|
|
28
|
-
|
|
29
|
-
- name: Install dependencies
|
|
30
|
-
run: |
|
|
31
|
-
python -m pip install --upgrade pip
|
|
32
|
-
pip install .
|
|
33
|
-
pip install .[dev]
|
|
34
|
-
|
|
35
|
-
- name: Style and formatting (ruff)
|
|
36
|
-
run: |
|
|
37
|
-
ruff check .
|
|
38
|
-
|
|
39
|
-
- name: Unit and integration tests (pytest)
|
|
40
|
-
run: |
|
|
41
|
-
pytest
|
|
42
|
-
|
|
43
|
-
- name: Mypy Check
|
|
44
|
-
uses: jpetrucciani/mypy-check@master
|
|
45
|
-
with:
|
|
46
|
-
python_version: ${{ matrix.python-version }}
|
|
47
|
-
requirements: ". .[dev]"
|
|
48
|
-
|
|
49
|
-
- name: Upgrade pip
|
|
50
|
-
run: |
|
|
51
|
-
python3 -m pip install --upgrade pip
|
|
52
|
-
|
|
53
|
-
- name: Install pypa/build
|
|
54
|
-
run: python3 -m pip install build --user
|
|
55
|
-
|
|
56
|
-
- name: Build a binary wheel and a source tarball
|
|
57
|
-
run: python3 -m build
|
|
58
|
-
|
|
59
|
-
- name: Store the distribution packages
|
|
60
|
-
uses: actions/upload-artifact@v5
|
|
61
|
-
with:
|
|
62
|
-
name: dist-${{ matrix.python-version }}
|
|
63
|
-
path: dist/
|
|
64
|
-
|
|
65
|
-
publish-to-pypi:
|
|
66
|
-
name: Publish module to PyPI
|
|
67
|
-
# if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
|
|
68
|
-
needs:
|
|
69
|
-
- test-and-build
|
|
70
|
-
runs-on: ubuntu-latest
|
|
71
|
-
environment: pypi
|
|
72
|
-
# name: pypi
|
|
73
|
-
# url: https://pypi.org/p/click-async-plugins
|
|
74
|
-
permissions:
|
|
75
|
-
id-token: write
|
|
76
|
-
strategy:
|
|
77
|
-
matrix:
|
|
78
|
-
python-version: ["3.13"]
|
|
79
|
-
|
|
80
|
-
steps:
|
|
81
|
-
- name: Download all the dists
|
|
82
|
-
uses: actions/download-artifact@v6
|
|
83
|
-
with:
|
|
84
|
-
name: dist-${{ matrix.python-version }}
|
|
85
|
-
path: dist/
|
|
86
|
-
|
|
87
|
-
- name: Push to PyPI
|
|
88
|
-
uses: pypa/gh-action-pypi-publish@release/v1
|
|
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
|