pluginify 1.0.0__py3-none-any.whl → 1.0.0.post11.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.post11.dev0"
7
+ __version_tuple__ = (1, 0, 0, "post11", "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 getpid, makedirs, remove, replace
21
21
  from os.path import (
22
22
  basename,
23
23
  dirname,
@@ -317,14 +317,24 @@ def write_registered_plugins(pkg_dir, plugins, save_type):
317
317
  """
318
318
  if save_type == "yaml":
319
319
  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
320
  else:
324
321
  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)
322
+ LOG.info("Writing %s", reg_plug_abspath)
323
+ # Write to a temporary file and move it into place, so that other processes
324
+ # reading the registry (for example parallel test workers) never see a
325
+ # partially written file.
326
+ tmp_abspath = f"{reg_plug_abspath}.{getpid()}.tmp"
327
+ try:
328
+ with open(tmp_abspath, "w") as plugin_registry:
329
+ if save_type == "yaml":
330
+ yaml.safe_dump(plugins, plugin_registry, default_flow_style=False)
331
+ else:
332
+ json.dump(plugins, plugin_registry, indent=4)
333
+ replace(tmp_abspath, reg_plug_abspath)
334
+ except BaseException:
335
+ if exists(tmp_abspath):
336
+ remove(tmp_abspath)
337
+ raise
328
338
 
329
339
 
330
340
  def create_plugin_registries(plugin_packages, save_type, namespace):
@@ -934,6 +944,15 @@ def add_class_plugin(package, relpath, plugins):
934
944
  # __version.py, etc.
935
945
  return error_message
936
946
 
947
+ if "utils" in Path(relpath).parts:
948
+ # Ignore helper modules that live under plugin trees. These files are not
949
+ # plugins and should not be imported or validated for PLUGIN_CLASS.
950
+ LOG.info(
951
+ f"Skipping module at relpath {relpath} from {package}, "
952
+ "found under a utils directory"
953
+ )
954
+ return error_message
955
+
937
956
  module_name = splitext(basename(relpath))[0]
938
957
  # We need the full path to the module in order
939
958
  # 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.post11.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=z-TefoSzduIgcBbfoVxyeFyvyIbCCdwT7xLpUydY-EI,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=n5yBp5KHCqHPlfXrFe-Ad16UXRQnGGDU5c81UuBoGOw,50167
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.post11.dev0.dist-info/METADATA,sha256=N-m8NbZksZDJkcsM5rWQy93pUqDbCyze1F4E-s1PSuE,2179
20
+ pluginify-1.0.0.post11.dev0.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
21
+ pluginify-1.0.0.post11.dev0.dist-info/entry_points.txt,sha256=kCm7HOEEzSnPyDpy98W-LYYmlLYyTnRqOj40UqxX6-w,111
22
+ pluginify-1.0.0.post11.dev0.dist-info/licenses/LICENSE,sha256=sIBqTiU78gw5bC9MZMySNxzCE7DIlOcDqUWdmflkDsY,7266
23
+ pluginify-1.0.0.post11.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