pluginify 1.0.0__py3-none-any.whl → 1.0.0.post16.dev0__py3-none-any.whl

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.
pluginify/_version.py CHANGED
@@ -3,5 +3,5 @@
3
3
 
4
4
  # DO NOT EDIT
5
5
  # managed by poetry-dynamic-versioning
6
- __version__ = "1.0.0"
7
- __version_tuple__ = (1, 0, 0)
6
+ __version__ = "1.0.0.post16.dev0"
7
+ __version_tuple__ = (1, 0, 0, "post16", "dev0")
@@ -17,7 +17,7 @@ import logging
17
17
  from importlib import metadata, resources, util, import_module
18
18
  from inspect import signature
19
19
  import json
20
- from os import makedirs, remove
20
+ from os import makedirs, remove, replace
21
21
  from os.path import (
22
22
  basename,
23
23
  dirname,
@@ -29,6 +29,7 @@ from os.path import (
29
29
  )
30
30
  from pathlib import Path
31
31
  import re
32
+ import tempfile
32
33
  import warnings
33
34
 
34
35
  import yaml
@@ -317,14 +318,33 @@ def write_registered_plugins(pkg_dir, plugins, save_type):
317
318
  """
318
319
  if save_type == "yaml":
319
320
  reg_plug_abspath = os_join(pkg_dir, "registered_plugins.yaml")
320
- with open(reg_plug_abspath, "w") as plugin_registry:
321
- LOG.info("Writing %s", reg_plug_abspath)
322
- yaml.safe_dump(plugins, plugin_registry, default_flow_style=False)
323
321
  else:
324
322
  reg_plug_abspath = os_join(pkg_dir, "registered_plugins.json")
325
- with open(reg_plug_abspath, "w") as plugin_registry:
326
- LOG.info("Writing %s", reg_plug_abspath)
327
- json.dump(plugins, plugin_registry, indent=4)
323
+ LOG.info("Writing %s", reg_plug_abspath)
324
+ # Write to a temporary file and move it into place, so that other processes
325
+ # reading the registry (for example parallel test workers) never see a
326
+ # partially written file.
327
+ tmp_abspath = None
328
+ try:
329
+ with tempfile.NamedTemporaryFile(
330
+ mode="w",
331
+ dir=dirname(reg_plug_abspath),
332
+ suffix=".tmp",
333
+ delete=False,
334
+ ) as plugin_registry:
335
+ tmp_abspath = plugin_registry.name
336
+ if save_type == "yaml":
337
+ yaml.safe_dump(plugins, plugin_registry, default_flow_style=False)
338
+ else:
339
+ json.dump(plugins, plugin_registry, indent=4)
340
+
341
+ replace(tmp_abspath, reg_plug_abspath)
342
+ finally:
343
+ if tmp_abspath is not None:
344
+ try:
345
+ remove(tmp_abspath)
346
+ except FileNotFoundError:
347
+ pass
328
348
 
329
349
 
330
350
  def create_plugin_registries(plugin_packages, save_type, namespace):
@@ -934,6 +954,15 @@ def add_class_plugin(package, relpath, plugins):
934
954
  # __version.py, etc.
935
955
  return error_message
936
956
 
957
+ if "utils" in Path(relpath).parts:
958
+ # Ignore helper modules that live under plugin trees. These files are not
959
+ # plugins and should not be imported or validated for PLUGIN_CLASS.
960
+ LOG.info(
961
+ f"Skipping module at relpath {relpath} from {package}, "
962
+ "found under a utils directory"
963
+ )
964
+ return error_message
965
+
937
966
  module_name = splitext(basename(relpath))[0]
938
967
  # We need the full path to the module in order
939
968
  # for relative imports to work within modules.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pluginify
3
- Version: 1.0.0
3
+ Version: 1.0.0.post16.dev0
4
4
  Summary: Pluginify package
5
5
  License: LICENSE
6
6
  License-File: LICENSE
@@ -12,6 +12,7 @@ Classifier: Programming Language :: Python :: 3.11
12
12
  Classifier: Programming Language :: Python :: 3.12
13
13
  Classifier: Programming Language :: Python :: 3.13
14
14
  Classifier: Programming Language :: Python :: 3.14
15
+ Classifier: Programming Language :: Python :: 3.15
15
16
  Provides-Extra: doc
16
17
  Requires-Dist: docstring_parser
17
18
  Requires-Dist: jsonschema (>4.18.0)
@@ -1,8 +1,8 @@
1
1
  pluginify/__init__.py,sha256=NvdicJtfy-dZZ8tWjR74lDBHGV6rlaH8pAJ7UHyTTog,391
2
- pluginify/_version.py,sha256=_A4laf9sZrPdPuY5EXul3a2Vg5lnQ6haJUkOc9eNta8,209
2
+ pluginify/_version.py,sha256=imnhJ-_dm5JxhJEQNyiL-oXxluDKdxh2Iv533XHd1Ok,239
3
3
  pluginify/commandline_typer.py,sha256=i0aVQEABfS8oL6ATUmzMqgtQQLhw0nMQmYzwpPzTF8k,11361
4
4
  pluginify/config.py,sha256=ffmzSyAjPNePkSZrqinu20ZJkbmG-L4TREgRfFmPL4M,4997
5
- pluginify/create_plugin_registries.py,sha256=TTYwRd2gxvsMV1l_1nTat_zkAIHTjHJZIoAwdRtcHtg,49447
5
+ pluginify/create_plugin_registries.py,sha256=LokHQRfNPKeIYIAFaNSNhNZWxy1_fX5-N7YJ5BD4U5k,50382
6
6
  pluginify/errors.py,sha256=kkdipLfxvj8f-Pp53SD3RPnD9QS3samBLlQBjBskZP8,373
7
7
  pluginify/interfaces/__init__.py,sha256=OkhHHE8WUEh12n3VrAWfMUv2-AAz7wfy5OcEyY-KtTc,461
8
8
  pluginify/interfaces/base.py,sha256=CMgPG2NpodrECXXJbayTIVt8Vqrrxd_QADAgGM5qgUk,26749
@@ -16,8 +16,8 @@ pluginify/pydantic_models/v1/configs.py,sha256=KfWsIveOqPOi_J53odFFY6gFOHNYPpwQd
16
16
  pluginify/utils/__init__.py,sha256=gdy4E4yEI9lrHbWPeBn0Bspj7iz4z6r8BAjbmHf_hpM,2088
17
17
  pluginify/utils/context_managers.py,sha256=1-bREbijNNc5PrqMIihKqxlxNaK-YZ3hj5XGpHiYmfw,926
18
18
  pluginify/utils/validators.py,sha256=ssfcUsvUlYfhWt5AjncU66KD4qDSv0N1BdR99ytvQjY,7681
19
- pluginify-1.0.0.dist-info/METADATA,sha256=07HolU0DI13d7WhKAOhs5rI4JVLSNYc6nkpBNM8raek,2116
20
- pluginify-1.0.0.dist-info/WHEEL,sha256=eY7nduwzv-ldUxpzbRlxwvC693Hg6PX8bWDjEHjZ_dk,88
21
- pluginify-1.0.0.dist-info/entry_points.txt,sha256=kCm7HOEEzSnPyDpy98W-LYYmlLYyTnRqOj40UqxX6-w,111
22
- pluginify-1.0.0.dist-info/licenses/LICENSE,sha256=sIBqTiU78gw5bC9MZMySNxzCE7DIlOcDqUWdmflkDsY,7266
23
- pluginify-1.0.0.dist-info/RECORD,,
19
+ pluginify-1.0.0.post16.dev0.dist-info/METADATA,sha256=KJc6Hg4VEUOYgjeTLS2RVoGObQn5Z5a9FYe8k9Z-gCU,2179
20
+ pluginify-1.0.0.post16.dev0.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
21
+ pluginify-1.0.0.post16.dev0.dist-info/entry_points.txt,sha256=kCm7HOEEzSnPyDpy98W-LYYmlLYyTnRqOj40UqxX6-w,111
22
+ pluginify-1.0.0.post16.dev0.dist-info/licenses/LICENSE,sha256=sIBqTiU78gw5bC9MZMySNxzCE7DIlOcDqUWdmflkDsY,7266
23
+ pluginify-1.0.0.post16.dev0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.4.1
2
+ Generator: poetry-core 2.5.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any