forge-shadow 4.5.0__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.
forge/__init__.py
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"""Deprecated: ``forge`` is now ``bladekit`` (Blade AI Fabric, PAAS-771).
|
|
2
|
+
|
|
3
|
+
This package is a shim kept for code written against the old name::
|
|
4
|
+
|
|
5
|
+
import forge # -> bladekit, with a DeprecationWarning
|
|
6
|
+
from forge import App, Image # same objects as bladekit.App, ...
|
|
7
|
+
from forge.exceptions import ForgeError # bladekit.exceptions.FabricError
|
|
8
|
+
import forge._app # IS bladekit._app (same module object)
|
|
9
|
+
|
|
10
|
+
Every ``forge.<sub>`` module resolves to the already-imported
|
|
11
|
+
``bladekit.<sub>`` module object rather than a second copy of it, so
|
|
12
|
+
classes compare identical (``isinstance``, ``except``) and pickles that name
|
|
13
|
+
``forge.*`` — written by an older client, or by code still importing ``forge``
|
|
14
|
+
— load against ``bladekit``.
|
|
15
|
+
|
|
16
|
+
Shipped by the ``forge-shadow`` compatibility distribution, never by
|
|
17
|
+
``bladekit`` itself. New code should ``import bladekit``.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
from __future__ import annotations
|
|
21
|
+
|
|
22
|
+
import importlib
|
|
23
|
+
import importlib.abc
|
|
24
|
+
import importlib.util
|
|
25
|
+
import sys
|
|
26
|
+
import warnings
|
|
27
|
+
from typing import Any, List
|
|
28
|
+
|
|
29
|
+
import bladekit as _target
|
|
30
|
+
|
|
31
|
+
_PREFIX = __name__ + "."
|
|
32
|
+
_TARGET = _target.__name__
|
|
33
|
+
|
|
34
|
+
warnings.warn(
|
|
35
|
+
"the `forge` package is deprecated: use `import bladekit` "
|
|
36
|
+
"(pip install bladekit). `forge` is a compatibility alias.",
|
|
37
|
+
DeprecationWarning,
|
|
38
|
+
stacklevel=2,
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class _AliasLoader(importlib.abc.Loader):
|
|
43
|
+
"""Load ``forge.X`` as the very module object ``bladekit.X``."""
|
|
44
|
+
|
|
45
|
+
def __init__(self, target_name: str) -> None:
|
|
46
|
+
self._target_name = target_name
|
|
47
|
+
self._own_spec: Any = None
|
|
48
|
+
|
|
49
|
+
def create_module(self, spec): # type: ignore[no-untyped-def]
|
|
50
|
+
module = importlib.import_module(self._target_name)
|
|
51
|
+
self._own_spec = module.__spec__
|
|
52
|
+
return module
|
|
53
|
+
|
|
54
|
+
def exec_module(self, module) -> None: # type: ignore[no-untyped-def]
|
|
55
|
+
# The import system stamped the alias spec onto the shared module
|
|
56
|
+
# object between create_module and here; give it back its own so
|
|
57
|
+
# bladekit.X stays reloadable and module.__spec__.name keeps
|
|
58
|
+
# saying bladekit.
|
|
59
|
+
if self._own_spec is not None:
|
|
60
|
+
module.__spec__ = self._own_spec
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class _AliasFinder(importlib.abc.MetaPathFinder):
|
|
64
|
+
def find_spec(self, fullname, path=None, target=None): # type: ignore[no-untyped-def]
|
|
65
|
+
if not fullname.startswith(_PREFIX):
|
|
66
|
+
return None
|
|
67
|
+
target_name = _TARGET + "." + fullname[len(_PREFIX):]
|
|
68
|
+
if importlib.util.find_spec(target_name) is None:
|
|
69
|
+
return None
|
|
70
|
+
return importlib.util.spec_from_loader(fullname, _AliasLoader(target_name))
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
if not any(isinstance(f, _AliasFinder) for f in sys.meta_path):
|
|
74
|
+
sys.meta_path.insert(0, _AliasFinder())
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def __getattr__(name: str) -> Any:
|
|
78
|
+
from bladekit import exceptions as _exceptions
|
|
79
|
+
|
|
80
|
+
if name in _exceptions.DEPRECATED_ALIASES:
|
|
81
|
+
# forge.ForgeError -> FabricError, warning at the caller's line.
|
|
82
|
+
return _exceptions.resolve_deprecated(name)
|
|
83
|
+
return getattr(_target, name) # forge.App, forge.Image, ...
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def __dir__() -> List[str]:
|
|
87
|
+
return sorted(set(globals()) | set(dir(_target)))
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
__all__ = list(getattr(_target, "__all__", [])) + ["ForgeError"]
|
|
91
|
+
__version__ = _target.__version__
|
forge_shadow/__init__.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""Entry point of the ``forge`` command (forge-shadow compatibility distribution).
|
|
2
|
+
|
|
3
|
+
``forge`` is ``blade`` under its pre-PAAS-771 name. It lives outside the
|
|
4
|
+
``forge`` package so running the command does not trip the shim's
|
|
5
|
+
import-time DeprecationWarning; a one-line notice on stderr says it instead.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import sys
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def main() -> None:
|
|
14
|
+
sys.stderr.write("`forge` is now `blade` — this alias will be removed in a future release.\n")
|
|
15
|
+
sys.stderr.flush()
|
|
16
|
+
from bladekit.cli import app
|
|
17
|
+
|
|
18
|
+
app(prog_name="forge")
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: forge-shadow
|
|
3
|
+
Version: 4.5.0
|
|
4
|
+
Summary: Deprecated name of bladekit (Blade AI Fabric SDK): installs it plus the `forge` import shim and command.
|
|
5
|
+
Author: Blade AI Fabric team
|
|
6
|
+
License: Proprietary
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Requires-Dist: bladekit==4.5.0
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
|
|
11
|
+
# forge-shadow (deprecated name)
|
|
12
|
+
|
|
13
|
+
The Forge SDK is now **Blade AI Fabric**: install `bladekit`, import
|
|
14
|
+
`bladekit`, run `blade`.
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install bladekit
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
This `forge-shadow` distribution only exists so existing installs, scripts and
|
|
21
|
+
container images keep working. It installs `bladekit` at the same version,
|
|
22
|
+
plus:
|
|
23
|
+
|
|
24
|
+
- a `forge` import package that forwards to `bladekit` (`import forge`
|
|
25
|
+
emits a `DeprecationWarning`);
|
|
26
|
+
- a `forge` command, an alias of `blade`.
|
|
27
|
+
|
|
28
|
+
Migration notes: see the `bladekit` README, section "Migrating from forge".
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
forge/__init__.py,sha256=GlVfBCZgjeQtkrdD6Wjw6RjmDI4jisJtjNaqL9AU8L4,3225
|
|
2
|
+
forge_shadow/__init__.py,sha256=Fn4TJG3kcH0lov3IaTfAcv0QBFXCeQ3RdjCBz3VB6Ik,559
|
|
3
|
+
forge_shadow-4.5.0.dist-info/METADATA,sha256=QEkwuDv6Y8ecJ67FRx6Xb5F-G9-KF4eaqpkmMqlb4wY,863
|
|
4
|
+
forge_shadow-4.5.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
|
|
5
|
+
forge_shadow-4.5.0.dist-info/entry_points.txt,sha256=CLZfHaWznfW89OdIW0EtGjb-amWaglbeoGZQCm1xILY,44
|
|
6
|
+
forge_shadow-4.5.0.dist-info/RECORD,,
|