pluginify 1.0.0.post11.dev0__tar.gz → 1.0.0.post41.dev0__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.
- pluginify-1.0.0.post41.dev0/.github/ci-dependencies.yaml +6 -0
- pluginify-1.0.0.post41.dev0/.github/workflows/integ-test.yaml +54 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/.github/workflows/tag-and-release.yaml +1 -1
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/PKG-INFO +3 -1
- pluginify-1.0.0.post41.dev0/docs/source/releases/latest/docs-overhaul.yaml +61 -0
- pluginify-1.0.0.post41.dev0/docs/source/releases/latest/fix-concurrent-writes.yaml +16 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/docs/source/releases/latest/ignore-files-in-utils-directories.yaml +2 -2
- pluginify-1.0.0.post41.dev0/docs/source/releases/latest/remove-enforcement-of-family-for-datatree-plugins.yaml +16 -0
- pluginify-1.0.0.post41.dev0/pluginify/__init__.py +24 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/pluginify/_version.py +2 -2
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/pluginify/commandline_typer.py +21 -19
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/pluginify/config.py +18 -11
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/pluginify/create_plugin_registries.py +179 -111
- pluginify-1.0.0.post41.dev0/pluginify/errors.py +24 -0
- pluginify-1.0.0.post41.dev0/pluginify/interfaces/__init__.py +21 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/pluginify/interfaces/base.py +168 -100
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/pluginify/interfaces/class_based/data_modifiers.py +4 -1
- pluginify-1.0.0.post41.dev0/pluginify/interfaces/class_based_plugin.py +318 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/pluginify/interfaces/yaml_based/configs.py +2 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/pluginify/plugin_registry.py +213 -172
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/pluginify/plugins/classes/data_modifiers/cuboid.py +10 -8
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/pluginify/pydantic_models/v1/configs.py +8 -2
- pluginify-1.0.0.post41.dev0/pluginify/utils/__init__.py +82 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/pluginify/utils/context_managers.py +18 -6
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/pluginify/utils/validators.py +87 -14
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/pyproject.toml +5 -1
- pluginify-1.0.0.post11.dev0/pluginify/__init__.py +0 -11
- pluginify-1.0.0.post11.dev0/pluginify/errors.py +0 -16
- pluginify-1.0.0.post11.dev0/pluginify/interfaces/__init__.py +0 -12
- pluginify-1.0.0.post11.dev0/pluginify/interfaces/class_based_plugin.py +0 -214
- pluginify-1.0.0.post11.dev0/pluginify/utils/__init__.py +0 -62
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/.github/workflows/deploy-docs.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/.github/workflows/integ_test.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/.github/workflows/mypy.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/.github/workflows/package-and-publish.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/.github/workflows/status-check.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/LICENSE +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/README.md +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/docs/source/releases/1.0.0/1.0.0-no-bug-fixes-required-on-this-release.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/docs/source/releases/1.0.0/1.19.0-internal-release.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/docs/source/releases/1.0.0/1.19.0-open-source-upload.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/docs/source/releases/1.0.0/1.19.0-patch-internal-use-vars-runner.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/docs/source/releases/1.0.0/ci-fix-perms.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/docs/source/releases/1.0.0/copy-geoips-functionality.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/docs/source/releases/1.0.0/ignore-dot-files-and-dirs.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/docs/source/releases/1.0.0/module-to-class-updates.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/docs/source/releases/1.0.0/obp-plugin-registry-updates.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/docs/source/releases/1.0.0/pluginify-updates-jeremy-comments.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/docs/source/releases/1.0.0/pypi-publish-bug-fix.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/docs/source/releases/1.0.0/remove-all-geoips-references.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/docs/source/releases/1.0.0/replace-geoips-functionality.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/docs/source/releases/1.0.0/update-black-formatting.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/docs/source/releases/1.0.0/version-update.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/docs/source/releases/latest/atomic-registry-writes.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/docs/source/releases/latest/use-geoips-ci.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/pluginify/plugins/yaml/configs/stucco.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/tests/conftest.py +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/tests/unit_tests/config/test_config.py +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/tests/unit_tests/plugin_registries/files/bad/invalid_interfaces.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/tests/unit_tests/plugin_registries/files/bad/missing_lowest_keys.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/tests/unit_tests/plugin_registries/files/bad/missing_plugin_types.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/tests/unit_tests/plugin_registries/files/good/pluginify.yaml +0 -0
- {pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/tests/unit_tests/plugin_registries/test_plugin_registries.py +0 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Test-only dependency overrides, keyed by branch: only the entry of the branch under
|
|
2
|
+
# test applies (see "Testing against other branches or versions" in the geoips_ci README).
|
|
3
|
+
remove-enforcement-of-family-for-datatree-plugins:
|
|
4
|
+
packages:
|
|
5
|
+
# The sibling PR for these changes
|
|
6
|
+
geoips: geoips @ git+https://github.com/NRLMMD-GEOIPS/geoips@remove-enforcement-of-family-for-datatree-plugins
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
name: Integration Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, synchronize, reopened, ready_for_review]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
inputs:
|
|
8
|
+
dependency_overrides:
|
|
9
|
+
description: >
|
|
10
|
+
Test-only dependency overrides as YAML: one entry of
|
|
11
|
+
.github/ci-dependencies.yaml (python and/or repos, not keyed by branch),
|
|
12
|
+
used instead of that file (see geoips_ci README)
|
|
13
|
+
required: false
|
|
14
|
+
type: string
|
|
15
|
+
default: ""
|
|
16
|
+
|
|
17
|
+
defaults:
|
|
18
|
+
run:
|
|
19
|
+
shell: bash
|
|
20
|
+
|
|
21
|
+
concurrency:
|
|
22
|
+
group: integ-test-${{ github.ref }}
|
|
23
|
+
cancel-in-progress: true
|
|
24
|
+
|
|
25
|
+
permissions:
|
|
26
|
+
contents: read
|
|
27
|
+
packages: write
|
|
28
|
+
|
|
29
|
+
jobs:
|
|
30
|
+
integ-test-editable:
|
|
31
|
+
if: >-
|
|
32
|
+
github.event_name == 'workflow_dispatch'
|
|
33
|
+
|| github.event.pull_request.draft == false
|
|
34
|
+
name: integ-test (editable=true)
|
|
35
|
+
uses: NRLMMD-GEOIPS/geoips_ci/.github/workflows/reusable-ci.yaml@main
|
|
36
|
+
with:
|
|
37
|
+
pip_editable: true
|
|
38
|
+
dependency_overrides: ${{ inputs.dependency_overrides || '' }}
|
|
39
|
+
secrets:
|
|
40
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
41
|
+
docker_token: ${{ secrets.DOCKER_TOKEN }}
|
|
42
|
+
# Read-only token for the private plugin repos (see geoips_ci README,
|
|
43
|
+
# "Private plugin repositories"). Without it the image has public plugins only.
|
|
44
|
+
private_repos_token: ${{ secrets.GEOIPS_PRIVATE_REPOS_TOKEN }}
|
|
45
|
+
|
|
46
|
+
# integ-test-non-editable:
|
|
47
|
+
# needs: integ-test-editable
|
|
48
|
+
# name: integ-test (editable=false)
|
|
49
|
+
# uses: NRLMMD-GEOIPS/geoips_ci/.github/workflows/reusable-ci.yaml@main
|
|
50
|
+
# with:
|
|
51
|
+
# pip_editable: false
|
|
52
|
+
# secrets:
|
|
53
|
+
# token: ${{ secrets.GITHUB_TOKEN }}
|
|
54
|
+
# docker_token: ${{ secrets.DOCKER_TOKEN }}
|
{pluginify-1.0.0.post11.dev0 → pluginify-1.0.0.post41.dev0}/.github/workflows/tag-and-release.yaml
RENAMED
|
@@ -20,7 +20,7 @@ jobs:
|
|
|
20
20
|
# You do not appear to be able to use variables in the "uses" field.
|
|
21
21
|
uses: NRLMMD-GEOIPS/geoips_ci/.github/workflows/reusable-tag-and-release.yaml@main
|
|
22
22
|
# Only run this if the pull request was merged, not just closed.
|
|
23
|
-
if: github.event.pull_request.merged == true
|
|
23
|
+
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
|
|
24
24
|
permissions:
|
|
25
25
|
contents: write
|
|
26
26
|
secrets:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pluginify
|
|
3
|
-
Version: 1.0.0.
|
|
3
|
+
Version: 1.0.0.post41.dev0
|
|
4
4
|
Summary: Pluginify package
|
|
5
5
|
License: LICENSE
|
|
6
6
|
License-File: LICENSE
|
|
@@ -14,12 +14,14 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.14
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.15
|
|
16
16
|
Provides-Extra: doc
|
|
17
|
+
Requires-Dist: brassy (>=0.4.1) ; extra == "doc"
|
|
17
18
|
Requires-Dist: docstring_parser
|
|
18
19
|
Requires-Dist: jsonschema (>4.18.0)
|
|
19
20
|
Requires-Dist: lexeme-type
|
|
20
21
|
Requires-Dist: platformdirs
|
|
21
22
|
Requires-Dist: pydantic (>=2.10.0)
|
|
22
23
|
Requires-Dist: pyyaml
|
|
24
|
+
Requires-Dist: rich ; extra == "doc"
|
|
23
25
|
Requires-Dist: sphinxcontrib-typer ; extra == "doc"
|
|
24
26
|
Requires-Dist: typer
|
|
25
27
|
Project-URL: Repository, https://github.com/NRLMMD-GEOIPS/pluginify
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
documentation:
|
|
2
|
+
- title: 'Overhaul documentation and expand docstrings across the codebase'
|
|
3
|
+
description: |
|
|
4
|
+
Comprehensive documentation improvements:
|
|
5
|
+
|
|
6
|
+
* added pluginify-native CLI examples alongside GeoIPS ones
|
|
7
|
+
* fixed GeoIPS-specific language in functionality docs
|
|
8
|
+
* removed leftover HTML TODO comment from architecture docs
|
|
9
|
+
* replaced empty CHANGELOG with reference to docs/source/releases/
|
|
10
|
+
* cleaned template placeholder text from initial-commit release note
|
|
11
|
+
* added configuration system reference page (env vars, config.yaml, commands)
|
|
12
|
+
* added Pydantic model dispatch system reference page
|
|
13
|
+
* added class-based plugin API reference page
|
|
14
|
+
* updated concepts toctree with new pages
|
|
15
|
+
* reformatted all source docstrings to numpy style convention
|
|
16
|
+
* added mypy-style type hints across all public functions and methods
|
|
17
|
+
* improved module-level docstrings with package purpose descriptions
|
|
18
|
+
* normalized code blocks to backtick fences so MyST parses every block
|
|
19
|
+
* fixed the broken ``call-dispatch`` reference and removed duplicate section
|
|
20
|
+
links in favour of stable heading anchors (issue #12)
|
|
21
|
+
* fixed the duplicate ``modified`` key and unescaped glob in the utils
|
|
22
|
+
ignore-file release note that broke the brassy and Sphinx builds
|
|
23
|
+
files:
|
|
24
|
+
added:
|
|
25
|
+
- "docs/source/concepts/configuration/index.md"
|
|
26
|
+
- "docs/source/concepts/architecture/pydantic-models.md"
|
|
27
|
+
- "docs/source/concepts/architecture/class-based-plugins.md"
|
|
28
|
+
- "docs/source/releases/latest/docs-overhaul.yaml"
|
|
29
|
+
deleted:
|
|
30
|
+
- ""
|
|
31
|
+
modified:
|
|
32
|
+
- "docs/source/concepts/index.md"
|
|
33
|
+
- "docs/source/concepts/architecture/index.md"
|
|
34
|
+
- "docs/source/concepts/command_line/index.md"
|
|
35
|
+
- "docs/source/concepts/functionality/index.md"
|
|
36
|
+
- "docs/source/releases/latest/ignore-files-in-utils-directories.yaml"
|
|
37
|
+
- "pluginify/__init__.py"
|
|
38
|
+
- "pluginify/commandline_typer.py"
|
|
39
|
+
- "pluginify/config.py"
|
|
40
|
+
- "pluginify/create_plugin_registries.py"
|
|
41
|
+
- "pluginify/errors.py"
|
|
42
|
+
- "pluginify/interfaces/__init__.py"
|
|
43
|
+
- "pluginify/interfaces/base.py"
|
|
44
|
+
- "pluginify/interfaces/class_based/data_modifiers.py"
|
|
45
|
+
- "pluginify/interfaces/class_based_plugin.py"
|
|
46
|
+
- "pluginify/interfaces/yaml_based/configs.py"
|
|
47
|
+
- "pluginify/plugin_registry.py"
|
|
48
|
+
- "pluginify/plugins/classes/data_modifiers/cuboid.py"
|
|
49
|
+
- "pluginify/pydantic_models/v1/configs.py"
|
|
50
|
+
- "pluginify/utils/__init__.py"
|
|
51
|
+
- "pluginify/utils/context_managers.py"
|
|
52
|
+
- "pluginify/utils/validators.py"
|
|
53
|
+
- "pyproject.toml"
|
|
54
|
+
moved:
|
|
55
|
+
- ""
|
|
56
|
+
related-issue:
|
|
57
|
+
number: null
|
|
58
|
+
repo_url: ''
|
|
59
|
+
date:
|
|
60
|
+
start: null
|
|
61
|
+
finish: null
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
bug fix:
|
|
2
|
+
- title: "Use NamedTemporaryFile for safer writes"
|
|
3
|
+
description: |
|
|
4
|
+
Plugin registry temp files were still having conflicts when
|
|
5
|
+
written by threads in the same process. To fix this I switched
|
|
6
|
+
to using tempfile.NamedTemporaryFile which is guaranteed to
|
|
7
|
+
avoid conflicts.
|
|
8
|
+
files:
|
|
9
|
+
modified:
|
|
10
|
+
- pluginfiy/create_plugin_registries.py
|
|
11
|
+
related-issue:
|
|
12
|
+
number: null
|
|
13
|
+
repo_url: ''
|
|
14
|
+
date:
|
|
15
|
+
start: 2026-10-30
|
|
16
|
+
finish: 2026-10-30
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
bug fix:
|
|
2
|
-
- title: 'Force ignore files in directories named
|
|
3
|
-
description: 'Force ignore files in directories named
|
|
2
|
+
- title: 'Force ignore files in directories named ``*/utils/``'
|
|
3
|
+
description: 'Force ignore files in directories named ``*/utils/``'
|
|
4
4
|
files:
|
|
5
5
|
deleted:
|
|
6
6
|
- ''
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
enhancement:
|
|
2
|
+
- title: 'removed family enforcement of family attribute for data-tree class-based plugins'
|
|
3
|
+
description: |
|
|
4
|
+
Removed enforcement checks for the family attribute for data-tree class-based
|
|
5
|
+
plugins for GeoIPS V2.0. Corresponding PR in GeoIPS can be found at
|
|
6
|
+
https://github.com/NRLMMD-GEOIPS/geoips/pull/1526.
|
|
7
|
+
files:
|
|
8
|
+
modified:
|
|
9
|
+
- pluginify/create_plugin_registries.py
|
|
10
|
+
- pluginify/interfaces/base.py
|
|
11
|
+
related-issue:
|
|
12
|
+
number: null
|
|
13
|
+
repo_url: ''
|
|
14
|
+
date:
|
|
15
|
+
start: null
|
|
16
|
+
finish: null
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# # # This source code is subject to the license referenced at
|
|
2
|
+
# # # https://github.com/NRLMMD-GEOIPS.
|
|
3
|
+
|
|
4
|
+
"""Pluginify: plugin registry management for YAML and Python class plugins.
|
|
5
|
+
|
|
6
|
+
This package provides the ``PluginRegistry`` class and supporting infrastructure
|
|
7
|
+
for registering, retrieving, and creating plugin objects from YAML configuration
|
|
8
|
+
files and Python class definitions. It exposes:
|
|
9
|
+
|
|
10
|
+
- ``pluginify.interfaces`` — base classes for building custom plugin interfaces.
|
|
11
|
+
- ``pluginify.utils`` — utility functions (dict merging, validators).
|
|
12
|
+
|
|
13
|
+
Pluginify does not ship production plugins; it is a framework for packages that
|
|
14
|
+
build plugin-based infrastructure (e.g. GeoIPS).
|
|
15
|
+
|
|
16
|
+
Version information is auto-generated from git tags during build/install.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
# NOTE: _version.py is generated automatically during build/install
|
|
20
|
+
from pluginify._version import __version__, __version_tuple__
|
|
21
|
+
from pluginify import interfaces
|
|
22
|
+
from pluginify import utils
|
|
23
|
+
|
|
24
|
+
__all__ = ["interfaces", "utils", "__version__", "__version_tuple__"]
|
|
@@ -23,7 +23,7 @@ import os
|
|
|
23
23
|
from pathlib import Path
|
|
24
24
|
from platformdirs import user_config_dir
|
|
25
25
|
import sys
|
|
26
|
-
from typing import
|
|
26
|
+
from typing import Any, Callable, Literal
|
|
27
27
|
|
|
28
28
|
import docstring_parser
|
|
29
29
|
import typer
|
|
@@ -33,7 +33,7 @@ from pluginify.config import NAMESPACE
|
|
|
33
33
|
from pluginify.plugin_registry import PluginRegistry
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
def configure_logging(level=logging.INFO):
|
|
36
|
+
def configure_logging(level: int = logging.INFO) -> None:
|
|
37
37
|
"""Configure root logging for the command-line interface.
|
|
38
38
|
|
|
39
39
|
This function attaches a StreamHandler to the root logger so that all log
|
|
@@ -71,12 +71,12 @@ def configure_logging(level=logging.INFO):
|
|
|
71
71
|
root.addHandler(handler)
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
def update_existing_fields(new_data):
|
|
74
|
+
def update_existing_fields(new_data: dict) -> None:
|
|
75
75
|
"""Overwrite fields in pluginify's config file if they exist in 'new_data'.
|
|
76
76
|
|
|
77
77
|
Parameters
|
|
78
78
|
----------
|
|
79
|
-
new_data: dict
|
|
79
|
+
new_data : dict
|
|
80
80
|
A dictionary containing configuration key, value pairs to overwrite data in
|
|
81
81
|
config_path.
|
|
82
82
|
"""
|
|
@@ -118,11 +118,11 @@ class DocstringTyper(typer.Typer):
|
|
|
118
118
|
'--namespace' automatically generates a '-n' flag.
|
|
119
119
|
"""
|
|
120
120
|
|
|
121
|
-
def command(self, *args, **kwargs):
|
|
121
|
+
def command(self, *args: Any, **kwargs: Any) -> Callable:
|
|
122
122
|
"""Overridden typer.Typer:command decorator."""
|
|
123
123
|
decorator = super().command(*args, **kwargs)
|
|
124
124
|
|
|
125
|
-
def wrapper(func):
|
|
125
|
+
def wrapper(func: Callable) -> Callable:
|
|
126
126
|
"""Generate help messages and shorthand aliases for all args of func."""
|
|
127
127
|
sig = inspect.signature(func)
|
|
128
128
|
doc = docstring_parser.parse(func.__doc__ or "")
|
|
@@ -136,7 +136,9 @@ class DocstringTyper(typer.Typer):
|
|
|
136
136
|
|
|
137
137
|
# Keep examples portion in command's help output if specified
|
|
138
138
|
if doc.examples:
|
|
139
|
-
new_doc += "\n\nExamples\n--------\n" +
|
|
139
|
+
new_doc += "\n\nExamples\n--------\n" + (
|
|
140
|
+
doc.examples[0].description or ""
|
|
141
|
+
)
|
|
140
142
|
|
|
141
143
|
func.__doc__ = new_doc
|
|
142
144
|
|
|
@@ -164,7 +166,7 @@ class DocstringTyper(typer.Typer):
|
|
|
164
166
|
new_params.append(param.replace(default=option))
|
|
165
167
|
|
|
166
168
|
new_sig = sig.replace(parameters=new_params)
|
|
167
|
-
func.__signature__ = new_sig
|
|
169
|
+
func.__signature__ = new_sig # type: ignore[attr-defined]
|
|
168
170
|
|
|
169
171
|
return decorator(func)
|
|
170
172
|
|
|
@@ -202,7 +204,7 @@ config_app.add_typer(
|
|
|
202
204
|
@app.command()
|
|
203
205
|
def create(
|
|
204
206
|
namespace: str = NAMESPACE,
|
|
205
|
-
packages:
|
|
207
|
+
packages: list[str] | None = None,
|
|
206
208
|
save_type: Literal["json", "yaml"] = "json",
|
|
207
209
|
):
|
|
208
210
|
"""Create plugin registries.
|
|
@@ -239,12 +241,12 @@ def create(
|
|
|
239
241
|
|
|
240
242
|
Parameters
|
|
241
243
|
----------
|
|
242
|
-
namespace: str, default='pluginify.plugin_packages'
|
|
244
|
+
namespace : str, default='pluginify.plugin_packages'
|
|
243
245
|
The namespace which plugin packages are registered under.
|
|
244
|
-
packages:
|
|
246
|
+
packages : list[str] | None, default=None
|
|
245
247
|
A list of strings representing plugin packages to create registries for. If
|
|
246
248
|
None, create registry files for all plugin packages found under 'namespace'.
|
|
247
|
-
save_type: Literal['json', 'yaml'], default='json'
|
|
249
|
+
save_type : Literal['json', 'yaml'], default='json'
|
|
248
250
|
The file extension to save the registry files as. Defaults to 'json', 'yaml'
|
|
249
251
|
can be specified as well.
|
|
250
252
|
"""
|
|
@@ -255,7 +257,7 @@ def create(
|
|
|
255
257
|
@app.command()
|
|
256
258
|
def delete(
|
|
257
259
|
namespace: str = NAMESPACE,
|
|
258
|
-
packages:
|
|
260
|
+
packages: list[str] | None = None,
|
|
259
261
|
):
|
|
260
262
|
"""Delete plugin registries.
|
|
261
263
|
|
|
@@ -289,9 +291,9 @@ def delete(
|
|
|
289
291
|
|
|
290
292
|
Parameters
|
|
291
293
|
----------
|
|
292
|
-
namespace: str, default='pluginify.plugin_packages'
|
|
294
|
+
namespace : str, default='pluginify.plugin_packages'
|
|
293
295
|
The namespace which plugin packages are registered under.
|
|
294
|
-
packages:
|
|
296
|
+
packages : list[str] | None, default=None
|
|
295
297
|
A list of strings representing plugin packages to create registries for. If
|
|
296
298
|
None, create registry files for all plugin packages found under 'namespace'.
|
|
297
299
|
"""
|
|
@@ -305,7 +307,7 @@ def set_rebuild_registries(rebuild_registries: bool):
|
|
|
305
307
|
|
|
306
308
|
Parameters
|
|
307
309
|
----------
|
|
308
|
-
rebuild_registries: bool
|
|
310
|
+
rebuild_registries : bool
|
|
309
311
|
The default setting for whether or not pluginify should rebuild registries by
|
|
310
312
|
default. This will persist between terminal sessions if set.
|
|
311
313
|
"""
|
|
@@ -318,7 +320,7 @@ def set_namespace(namespace: str):
|
|
|
318
320
|
|
|
319
321
|
Parameters
|
|
320
322
|
----------
|
|
321
|
-
namespace: str
|
|
323
|
+
namespace : str
|
|
322
324
|
The default namespace you want to pluginify to operate on. This will persist
|
|
323
325
|
between terminal sessions if set.
|
|
324
326
|
"""
|
|
@@ -331,14 +333,14 @@ def set_registry_directory(registry_directory: Path):
|
|
|
331
333
|
|
|
332
334
|
Parameters
|
|
333
335
|
----------
|
|
334
|
-
registry_directory: Path
|
|
336
|
+
registry_directory : Path
|
|
335
337
|
The default path to the directory you want to write registry files to. This will
|
|
336
338
|
persist between terminal sessions if set.
|
|
337
339
|
"""
|
|
338
340
|
update_existing_fields({"REGISTRY_DIRECTORY": registry_directory})
|
|
339
341
|
|
|
340
342
|
|
|
341
|
-
def main():
|
|
343
|
+
def main() -> None:
|
|
342
344
|
"""Entrypoint function for pluginify's CLI."""
|
|
343
345
|
configure_logging(logging.INFO)
|
|
344
346
|
app()
|
|
@@ -3,13 +3,18 @@
|
|
|
3
3
|
|
|
4
4
|
"""Module containing configuration variables needed for pluginify to run."""
|
|
5
5
|
|
|
6
|
+
from __future__ import annotations
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _get_env_name() -> str:
|
|
8
13
|
"""Determine the name of the environment that this code is being executed under.
|
|
9
14
|
|
|
10
15
|
Returns
|
|
11
16
|
-------
|
|
12
|
-
env_name: str
|
|
17
|
+
env_name : str
|
|
13
18
|
The name of the environment which was active when this code was ran. If running
|
|
14
19
|
under the base environment, return 'base_env'.
|
|
15
20
|
"""
|
|
@@ -35,7 +40,7 @@ def _get_env_name():
|
|
|
35
40
|
return env_name
|
|
36
41
|
|
|
37
42
|
|
|
38
|
-
def _env_to_variable(name, default):
|
|
43
|
+
def _env_to_variable(name: str, default: Any) -> Any:
|
|
39
44
|
"""Convert an environment variable (str) to a python variable (Any).
|
|
40
45
|
|
|
41
46
|
If an environment variable under 'name' has been set, convert it to a python
|
|
@@ -44,14 +49,14 @@ def _env_to_variable(name, default):
|
|
|
44
49
|
|
|
45
50
|
Parameters
|
|
46
51
|
----------
|
|
47
|
-
name: str
|
|
52
|
+
name : str
|
|
48
53
|
The name of the environment variable to convert.
|
|
49
|
-
default: Any
|
|
54
|
+
default : Any
|
|
50
55
|
The default value for the environment variable named 'name'..
|
|
51
56
|
|
|
52
57
|
Returns
|
|
53
58
|
-------
|
|
54
|
-
converted: Any
|
|
59
|
+
converted : Any
|
|
55
60
|
- The converted value of the environment variable.
|
|
56
61
|
"""
|
|
57
62
|
# imports buried to avoid polluting this module's import namespace
|
|
@@ -72,7 +77,7 @@ def _env_to_variable(name, default):
|
|
|
72
77
|
return default
|
|
73
78
|
|
|
74
79
|
|
|
75
|
-
def _load_config_values():
|
|
80
|
+
def _load_config_values() -> tuple[str, bool, Path]:
|
|
76
81
|
"""Load and override pluginify configuration variables if they exist.
|
|
77
82
|
|
|
78
83
|
The configuration file for this package is expected to be found at
|
|
@@ -120,26 +125,28 @@ def _load_config_values():
|
|
|
120
125
|
return NAMESPACE, REBUILD_REGISTRIES, REGISTRY_DIRECTORY
|
|
121
126
|
|
|
122
127
|
|
|
128
|
+
# These module-level variables are resolved at import time from env vars,
|
|
129
|
+
# config file (~/.config/pluginify/config.yaml), and built-in defaults.
|
|
123
130
|
NAMESPACE, REBUILD_REGISTRIES, REGISTRY_DIRECTORY = _load_config_values()
|
|
124
131
|
|
|
125
132
|
|
|
126
|
-
def get_registry_cache_dir(namespace, package):
|
|
133
|
+
def get_registry_cache_dir(namespace: str, package: str) -> Path:
|
|
127
134
|
"""Return the path to the parent directory of where to write registry files to.
|
|
128
135
|
|
|
129
136
|
Where the path is formatted '~/.cache/{env_name}/{namespace}/{package}'.
|
|
130
137
|
|
|
131
138
|
Parameters
|
|
132
139
|
----------
|
|
133
|
-
namespace: str
|
|
140
|
+
namespace : str
|
|
134
141
|
Namespace that your plugin packages fall under. The argument parser defaults
|
|
135
142
|
this value to 'pluginify.plugin_packages', but a user can create separate
|
|
136
143
|
namespaces if developing interfaces outside of pluginify.
|
|
137
|
-
package: str
|
|
144
|
+
package : str
|
|
138
145
|
Name of a plugin package that is registered under 'namespace'.
|
|
139
146
|
|
|
140
147
|
Returns
|
|
141
148
|
-------
|
|
142
|
-
cache_dir: Path
|
|
149
|
+
cache_dir : Path
|
|
143
150
|
Full path to the parent directory in which registry files should be written
|
|
144
151
|
for a package under namespace.
|
|
145
152
|
"""
|