invoke-tasklib 0.0.6__tar.gz → 0.0.8__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: invoke-tasklib
3
- Version: 0.0.6
3
+ Version: 0.0.8
4
4
  Summary: Reusable Invoke tasks shared across Python projects.
5
5
  Project-URL: Homepage, https://github.com/durandtibo/invoke-tasklib
6
6
  Project-URL: Repository, https://github.com/durandtibo/invoke-tasklib
@@ -128,7 +128,7 @@ tasklib:
128
128
 
129
129
  ```shell
130
130
  invoke --list
131
- invoke format.check-python lint.check-lint
131
+ invoke format.check-python lint.check-python
132
132
  invoke test.unit
133
133
  ```
134
134
 
@@ -152,10 +152,10 @@ Tasks are grouped into namespaces, one per module. Each task either
152
152
  | `format` | `format.fix-docstrings` | Format docstrings with docformatter | ✅ |
153
153
  | `format` | `format.check-shell` | Check shell scripts with shellcheck | ❌ |
154
154
  | `format` | `format.fix-shell` | Format shell scripts with shfmt | ✅ |
155
- | `lint` | `lint.check-lint` | Check linting with ruff | ❌ |
156
- | `lint` | `lint.fix` | Fix auto-fixable linting issues with ruff | ✅ |
155
+ | `lint` | `lint.check-python` | Check linting with ruff | ❌ |
156
+ | `lint` | `lint.fix-python` | Fix auto-fixable linting issues with ruff | ✅ |
157
157
  | `imports` | `imports.check-cycles` | Check for cyclic import dependencies | ❌ |
158
- | `types` | `types.check` | Check type hints with pyright | ❌ |
158
+ | `types` | `types.check` | Check type hints with ty | ❌ |
159
159
  | `test` | `test.doctest` | Run doctests on source code and markdown files | ❌ |
160
160
  | `test` | `test.doctest-src` | Run doctests on source code | ❌ |
161
161
  | `test` | `test.doctest-markdown` | Run doctests on Python examples in markdown files | ❌ |
@@ -100,7 +100,7 @@ tasklib:
100
100
 
101
101
  ```shell
102
102
  invoke --list
103
- invoke format.check-python lint.check-lint
103
+ invoke format.check-python lint.check-python
104
104
  invoke test.unit
105
105
  ```
106
106
 
@@ -124,10 +124,10 @@ Tasks are grouped into namespaces, one per module. Each task either
124
124
  | `format` | `format.fix-docstrings` | Format docstrings with docformatter | ✅ |
125
125
  | `format` | `format.check-shell` | Check shell scripts with shellcheck | ❌ |
126
126
  | `format` | `format.fix-shell` | Format shell scripts with shfmt | ✅ |
127
- | `lint` | `lint.check-lint` | Check linting with ruff | ❌ |
128
- | `lint` | `lint.fix` | Fix auto-fixable linting issues with ruff | ✅ |
127
+ | `lint` | `lint.check-python` | Check linting with ruff | ❌ |
128
+ | `lint` | `lint.fix-python` | Fix auto-fixable linting issues with ruff | ✅ |
129
129
  | `imports` | `imports.check-cycles` | Check for cyclic import dependencies | ❌ |
130
- | `types` | `types.check` | Check type hints with pyright | ❌ |
130
+ | `types` | `types.check` | Check type hints with ty | ❌ |
131
131
  | `test` | `test.doctest` | Run doctests on source code and markdown files | ❌ |
132
132
  | `test` | `test.doctest-src` | Run doctests on source code | ❌ |
133
133
  | `test` | `test.doctest-markdown` | Run doctests on Python examples in markdown files | ❌ |
@@ -11,17 +11,24 @@ and an ``invoke.yaml`` at the project root::
11
11
  name: my_package
12
12
 
13
13
  To compose a custom subset of tasks instead of using the default
14
- ``ns``, import individual task modules::
14
+ ``ns``, import individual task modules:
15
15
 
16
- from invoke import Collection
17
- from invoke_tasklib import lint, test
16
+ ```pycon
17
+ >>> from invoke.collection import Collection
18
+ >>> from invoke_tasklib import lint, test
19
+ >>> ns = Collection(lint, test)
20
+ >>> sorted(ns.task_names)
21
+ ['lint.check-python', 'lint.fix-python', 'test.all', 'test.benchmark',
22
+ 'test.coverage-report', 'test.doctest', 'test.doctest-markdown',
23
+ 'test.doctest-src', 'test.functional', 'test.integration', 'test.unit']
18
24
 
19
- ns = Collection(lint, test)
25
+ ```
20
26
  """
21
27
 
22
28
  from __future__ import annotations
23
29
 
24
30
  from invoke.collection import Collection
31
+ from invoke.tasks import Task
25
32
 
26
33
  from invoke_tasklib import (
27
34
  clean,
@@ -60,4 +67,5 @@ ns.add_collection(Collection.from_module(env), name="env")
60
67
  ns.add_collection(Collection.from_module(release), name="release")
61
68
  ns.add_collection(Collection.from_module(doc), name="doc")
62
69
  ns.add_collection(Collection.from_module(security), name="security")
63
- ns.add_task(clean.all, name="clean")
70
+ ns.add_task(clean.all, name="clean") # ty: ignore[invalid-argument-type]
71
+ ns.add_task(Task(clean.pycache, name="clean-pycache"))
@@ -43,6 +43,14 @@ def all(c: Context) -> None: # noqa: A001, ARG001 (task name/signature required
43
43
  logger.info("✅ Cleanup complete")
44
44
 
45
45
 
46
+ def pycache(c: Context) -> None: # noqa: ARG001 (task signature required by invoke)
47
+ r"""Remove all ``__pycache__`` directories."""
48
+ logger.info("🧹 Cleaning __pycache__ directories...")
49
+ for p in Path().glob("**/__pycache__"):
50
+ _remove_dir(p)
51
+ logger.info("✅ Cleanup complete")
52
+
53
+
46
54
  def _remove_dir(path: Path) -> None:
47
55
  if path.is_dir():
48
56
  logger.info(f"🗑️ Removing {path}")
@@ -88,6 +88,23 @@ def get_config(c: Context) -> TasklibConfig:
88
88
 
89
89
  Raises:
90
90
  ValueError: If ``tasklib.package.name`` is not set.
91
+
92
+ Example usage:
93
+
94
+ ```pycon
95
+ >>> from invoke.config import Config
96
+ >>> from invoke.context import Context
97
+ >>> from invoke_tasklib.config import get_config
98
+ >>> c = Context(config=Config(overrides={"tasklib": {"package": {"name": "mypkg"}}}))
99
+ >>> cfg = get_config(c)
100
+ >>> cfg["package"]
101
+ {'name': 'mypkg', 'python_version': '3.14'}
102
+ >>> cfg["paths"]["src"]
103
+ 'src/mypkg'
104
+ >>> cfg["groups"]
105
+ {'install': 'dev', 'update': 'dev,docs'}
106
+
107
+ ```
91
108
  """
92
109
  user = dict(c.config.get("tasklib", {}))
93
110
  package = {**DEFAULT_PACKAGE, **user.get("package", {})}
@@ -110,15 +127,17 @@ def get_config(c: Context) -> TasklibConfig:
110
127
  paths["benchmarks"] = f"{paths['tests']}/benchmarks"
111
128
 
112
129
  return {
113
- "package": PackageConfig(name=package["name"], python_version=package["python_version"]),
130
+ "package": PackageConfig(
131
+ name=package["name"], python_version=str(package["python_version"])
132
+ ),
114
133
  "paths": PathsConfig(
115
- src=paths["src"],
116
- tests=paths["tests"],
117
- unit_tests=paths["unit_tests"],
118
- integration_tests=paths["integration_tests"],
119
- functional_tests=paths["functional_tests"],
120
- benchmarks=paths["benchmarks"],
121
- docs_config=paths["docs_config"],
134
+ src=str(paths["src"]),
135
+ tests=str(paths["tests"]),
136
+ unit_tests=str(paths["unit_tests"]),
137
+ integration_tests=str(paths["integration_tests"]),
138
+ functional_tests=str(paths["functional_tests"]),
139
+ benchmarks=str(paths["benchmarks"]),
140
+ docs_config=str(paths["docs_config"]),
122
141
  ),
123
142
  "groups": GroupsConfig(install=groups["install"], update=groups["update"]),
124
143
  }
@@ -14,7 +14,7 @@ logger: logging.Logger = logging.getLogger(__name__)
14
14
 
15
15
 
16
16
  @task
17
- def check_lint(c: Context) -> None:
17
+ def check_python(c: Context) -> None:
18
18
  r"""Check code linting with ruff."""
19
19
  logger.info("🔍 Checking code linting with ruff...")
20
20
  c.run("ruff check --output-format=github .", pty=True)
@@ -22,7 +22,7 @@ def check_lint(c: Context) -> None:
22
22
 
23
23
 
24
24
  @task
25
- def fix(c: Context) -> None:
25
+ def fix_python(c: Context) -> None:
26
26
  r"""Fix auto-fixable linting issues in place with ruff.
27
27
 
28
28
  Note:
@@ -7,8 +7,6 @@ from typing import TYPE_CHECKING
7
7
 
8
8
  from invoke.tasks import task
9
9
 
10
- from invoke_tasklib.config import get_config
11
-
12
10
  if TYPE_CHECKING:
13
11
  from invoke.context import Context
14
12
 
@@ -17,9 +15,7 @@ logger: logging.Logger = logging.getLogger(__name__)
17
15
 
18
16
  @task
19
17
  def check(c: Context) -> None:
20
- r"""Check type hints with pyright."""
21
- cfg = get_config(c)
22
- name = cfg["package"]["name"]
23
- logger.info("🔬 Checking type hints with pyright...")
24
- c.run(f"pyright --verifytypes {name} --ignoreexternal", pty=True)
18
+ r"""Check type hints with ty."""
19
+ logger.info("🔬 Checking type hints with ty...")
20
+ c.run("ty check", pty=True)
25
21
  logger.info("✅ Type check passed")
@@ -10,7 +10,7 @@ only-include = ["src"]
10
10
 
11
11
  [project]
12
12
  name = "invoke-tasklib"
13
- version = "0.0.6"
13
+ version = "0.0.8"
14
14
  description = "Reusable Invoke tasks shared across Python projects."
15
15
  readme = "README.md"
16
16
  authors = [
@@ -43,14 +43,14 @@ dev = [
43
43
  "docformatter[tomli]>=1.7.8,<2.0",
44
44
  "feu[all]>=0.8.1,<1.0",
45
45
  "invoke>=3.0,<4.0",
46
- "pre-commit>=4.6,<5.0",
47
46
  "pip-audit>=2.10,<3.0",
47
+ "pre-commit>=4.6,<5.0",
48
48
  "pygments>=2.20,<3.0",
49
- "pyright>=1.1.411,<2.0",
50
- "pytest>=9.1,<10.0",
51
49
  "pytest-cov>=7.1,<8.0",
52
50
  "pytest-timeout>=2.4,<3.0",
51
+ "pytest>=9.1,<10.0",
53
52
  "ruff>=0.16,<1.0",
53
+ "ty>=0.0.1",
54
54
  "xdoctest>=1.3,<2.0",
55
55
  ]
56
56
  docs = [
@@ -273,7 +273,5 @@ force-sort-within-sections = false
273
273
  combine-as-imports = true
274
274
  known-first-party = ["src"]
275
275
 
276
- [tool.pyright]
276
+ [tool.ty.src]
277
277
  include = ["src"]
278
- venvPath = "."
279
- venv = ".venv"
File without changes