pyprojkit 0.1.1__tar.gz → 0.2.0__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.4
2
2
  Name: pyprojkit
3
- Version: 0.1.1
3
+ Version: 0.2.0
4
4
  Summary: Development workflow toolkit for Python projects: pyproject.toml sync, doit tasks, nox sessions
5
5
  Author: mm21
6
6
  Author-email: mm21 <mm21.dev@gmail.com>
@@ -277,6 +277,7 @@ All tasks share the same layout:
277
277
  - `__cache__/`: caches (doit db, pytest cache, coverage data, nox envs)
278
278
  - `__out__/`: generated artifacts (`test/` coverage + JUnit results, `doc/html`, `analysis/`, `uv/` build artifacts)
279
279
  - `badges/`: generated badge SVGs
280
+ - `src/<package>`: package sources consumed by the `init` and `analysis` tasks; the containing directory is configurable via `ProjectConfig.packages_dir` (default `"src"`)
280
281
 
281
282
  ## Custom profiles
282
283
 
@@ -234,6 +234,7 @@ All tasks share the same layout:
234
234
  - `__cache__/`: caches (doit db, pytest cache, coverage data, nox envs)
235
235
  - `__out__/`: generated artifacts (`test/` coverage + JUnit results, `doc/html`, `analysis/`, `uv/` build artifacts)
236
236
  - `badges/`: generated badge SVGs
237
+ - `src/<package>`: package sources consumed by the `init` and `analysis` tasks; the containing directory is configurable via `ProjectConfig.packages_dir` (default `"src"`)
237
238
 
238
239
  ## Custom profiles
239
240
 
@@ -27,7 +27,7 @@ license-files = ["LICENSE"]
27
27
  name = "pyprojkit"
28
28
  readme = "README.md"
29
29
  requires-python = ">=3.12,<3.15" # managed by pyprojkit
30
- version = "0.1.1"
30
+ version = "0.2.0"
31
31
 
32
32
  [project.optional-dependencies]
33
33
  all = [
@@ -5,6 +5,7 @@ Project-wide configuration, declared in a project's `pyprojconf.py`.
5
5
  from __future__ import annotations
6
6
 
7
7
  from dataclasses import dataclass, field
8
+ from pathlib import Path
8
9
  from typing import Any, Sequence
9
10
 
10
11
  from .. import _paths
@@ -81,6 +82,7 @@ class MkinitConfig:
81
82
  Arguments passed to mkinit.
82
83
  """
83
84
 
85
+
84
86
  @dataclass(kw_only=True)
85
87
  class SphinxConfig:
86
88
  """
@@ -98,6 +100,7 @@ class SphinxConfig:
98
100
  built documentation when the doc task is run with `--copy`.
99
101
  """
100
102
 
103
+
101
104
  @dataclass(kw_only=True)
102
105
  class DocConfig:
103
106
  """
@@ -114,11 +117,13 @@ class DocConfig:
114
117
  Enables the `doc` task; opt-in.
115
118
  """
116
119
 
120
+
117
121
  @dataclass(kw_only=True)
118
122
  class AnalysisConfig:
119
123
  """
120
124
  Static analysis configuration.
121
125
  """
126
+
122
127
  mypy: MypyConfig | None = field(default_factory=MypyConfig)
123
128
  pyright: bool = True
124
129
 
@@ -128,11 +133,14 @@ class PublishConfig:
128
133
  """
129
134
  Configuration for building and publishing via uv.
130
135
  """
136
+
131
137
  out_dir: str = str(_paths.UV_PATH)
132
138
  """
133
139
  Directory for build artifacts; cleaned before each build so stale artifacts are
134
140
  never published.
135
141
  """
142
+
143
+
136
144
  @dataclass(kw_only=True)
137
145
  class ToolsConfig:
138
146
  """
@@ -142,6 +150,7 @@ class ToolsConfig:
142
150
  `pyprojkit.config.profiles`. The default instance corresponds to the default
143
151
  profile.
144
152
  """
153
+
145
154
  formatting: FormattingConfig = field(default_factory=FormattingConfig.default)
146
155
  test: TestConfig | None = field(default_factory=TestConfig)
147
156
  doit: DoitConfig = field(default_factory=DoitConfig)
@@ -157,6 +166,7 @@ class ToolsConfig:
157
166
 
158
167
  A key not otherwise managed creates a new managed table.
159
168
  """
169
+
160
170
  @classmethod
161
171
  def default(cls) -> ToolsConfig:
162
172
  """
@@ -174,6 +184,7 @@ class ProjectConfig:
174
184
 
175
185
  A project's `pyprojconf.py` must define a module-level instance named `config`.
176
186
  """
187
+
177
188
  package: str
178
189
  """
179
190
  Import name of the package, e.g. `"trilium_alchemy"`.
@@ -182,13 +193,23 @@ class ProjectConfig:
182
193
  """
183
194
  Supported Python versions.
184
195
  """
196
+ packages_dir: str = "src"
197
+ """
198
+ Directory containing packages, relative to the project root.
199
+ """
185
200
  format_paths: Sequence[str] = ("src", "test", "doc", "examples")
186
201
  """
187
202
  Directories to format (those which exist), in addition to `*.py` and `*.toml` files
188
203
  at the project root.
189
204
  """
190
-
191
205
  tools: ToolsConfig = field(default_factory=ToolsConfig.default)
192
206
  """
193
207
  Tool configurations.
194
208
  """
209
+
210
+ @property
211
+ def package_path(self) -> Path:
212
+ """
213
+ Path to the package directory, relative to the project root.
214
+ """
215
+ return Path(self.packages_dir) / self.package
@@ -236,13 +236,13 @@ class TaskFactory:
236
236
  Create `init` task which generates `__init__.py` files using mkinit.
237
237
  """
238
238
  mkinit = self._require(self._config.tools.doc.mkinit, "tools.doc.mkinit")
239
- package = self._config.package
239
+ package_path = self._config.package_path
240
240
 
241
241
  def task_init() -> Task:
242
242
  return Task(
243
243
  "init",
244
244
  actions=[
245
- (run, (["mkinit", f"src/{package}", *mkinit.args],)),
245
+ (run, (["mkinit", str(package_path), *mkinit.args],)),
246
246
  ],
247
247
  targets=[],
248
248
  file_dep=[],
@@ -324,7 +324,7 @@ class TaskFactory:
324
324
  Create `analysis` task which runs static analysis tools.
325
325
  """
326
326
  analysis = self._require(self._config.tools.analysis, "tools.analysis")
327
- package = self._config.package
327
+ package_path = self._config.package_path
328
328
 
329
329
  def task_analysis() -> Task:
330
330
  actions = []
@@ -340,14 +340,14 @@ class TaskFactory:
340
340
  str(_paths.MYPY_HTML_PATH),
341
341
  "--cobertura-xml-report",
342
342
  str(_paths.MYPY_XML_PATH),
343
- package,
343
+ str(package_path),
344
344
  ],
345
345
  ),
346
346
  )
347
347
  )
348
348
 
349
349
  if analysis.pyright:
350
- actions.append((run, (["pyright", package],)))
350
+ actions.append((run, (["pyright", str(package_path)],)))
351
351
 
352
352
  return Task(
353
353
  "analysis",
@@ -24,6 +24,7 @@ Updated along with pyprojkit releases; individual projects can override via
24
24
  `PythonVersions.patch_overrides`.
25
25
  """
26
26
 
27
+
27
28
  @dataclass(frozen=True)
28
29
  class PythonVersions:
29
30
  """
File without changes
@@ -39,8 +39,8 @@ def _default_formatting() -> FormattingConfig:
39
39
  formatters=(
40
40
  AutoflakeConfig(),
41
41
  IsortConfig(),
42
- BlackConfig(),
43
42
  DocformatterConfig(),
43
+ BlackConfig(),
44
44
  TomlSortConfig(),
45
45
  )
46
46
  )