stratafs 0.2.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.
- stratafs/__init__.py +3 -0
- stratafs/cli.py +15 -0
- stratafs/download.py +112 -0
- stratafs-0.2.0.dist-info/METADATA +42 -0
- stratafs-0.2.0.dist-info/RECORD +8 -0
- stratafs-0.2.0.dist-info/WHEEL +5 -0
- stratafs-0.2.0.dist-info/entry_points.txt +2 -0
- stratafs-0.2.0.dist-info/top_level.txt +1 -0
stratafs/__init__.py
ADDED
stratafs/cli.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""CLI entry point that delegates to the native StrataFS binary."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
from stratafs.download import ensure_binary
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def main():
|
|
10
|
+
binary = ensure_binary()
|
|
11
|
+
os.execv(binary, [binary] + sys.argv[1:])
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
if __name__ == "__main__":
|
|
15
|
+
main()
|
stratafs/download.py
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"""Download and cache the StrataFS native binary."""
|
|
2
|
+
|
|
3
|
+
import hashlib
|
|
4
|
+
import os
|
|
5
|
+
import platform
|
|
6
|
+
import stat
|
|
7
|
+
import sys
|
|
8
|
+
import tarfile
|
|
9
|
+
import urllib.request
|
|
10
|
+
import zipfile
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
DEFAULT_VERSION = "0.2.0"
|
|
14
|
+
GITHUB_RELEASES_URL = "https://github.com/neul-labs/stratafs/releases/download"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def get_platform():
|
|
18
|
+
"""Return the platform name used in release assets."""
|
|
19
|
+
system = platform.system().lower()
|
|
20
|
+
if system == "darwin":
|
|
21
|
+
return "darwin"
|
|
22
|
+
if system == "windows":
|
|
23
|
+
return "windows"
|
|
24
|
+
return "linux"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def get_arch():
|
|
28
|
+
"""Return the architecture name used in release assets."""
|
|
29
|
+
machine = platform.machine().lower()
|
|
30
|
+
if machine in ("amd64", "x86_64"):
|
|
31
|
+
return "amd64"
|
|
32
|
+
if machine in ("arm64", "aarch64"):
|
|
33
|
+
return "arm64"
|
|
34
|
+
return machine
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def get_binary_dir():
|
|
38
|
+
"""Return the directory where the binary should be cached."""
|
|
39
|
+
cache_dir = os.path.expanduser("~/.stratafs/bin")
|
|
40
|
+
os.makedirs(cache_dir, exist_ok=True)
|
|
41
|
+
return cache_dir
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def get_binary_path():
|
|
45
|
+
"""Return the path to the cached StrataFS binary."""
|
|
46
|
+
binary_name = "stratafs.exe" if get_platform() == "windows" else "stratafs"
|
|
47
|
+
return os.path.join(get_binary_dir(), binary_name)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def download_binary(version=None):
|
|
51
|
+
"""Download the StrataFS binary for the current platform."""
|
|
52
|
+
if version is None:
|
|
53
|
+
version = os.environ.get("STRATAFS_VERSION", DEFAULT_VERSION)
|
|
54
|
+
|
|
55
|
+
plat = get_platform()
|
|
56
|
+
arch = get_arch()
|
|
57
|
+
binary_dir = get_binary_dir()
|
|
58
|
+
binary_path = get_binary_path()
|
|
59
|
+
|
|
60
|
+
archive_name = f"stratafs-v{version}-{plat}-{arch}"
|
|
61
|
+
if plat == "windows":
|
|
62
|
+
archive_ext = "zip"
|
|
63
|
+
else:
|
|
64
|
+
archive_ext = "tar.gz"
|
|
65
|
+
|
|
66
|
+
url = f"{GITHUB_RELEASES_URL}/v{version}/{archive_name}.{archive_ext}"
|
|
67
|
+
archive_path = os.path.join(binary_dir, f"{archive_name}.{archive_ext}")
|
|
68
|
+
|
|
69
|
+
if os.path.exists(binary_path):
|
|
70
|
+
return binary_path
|
|
71
|
+
|
|
72
|
+
print(f"Downloading StrataFS {version} for {plat}/{arch}...")
|
|
73
|
+
print(f"URL: {url}")
|
|
74
|
+
|
|
75
|
+
try:
|
|
76
|
+
urllib.request.urlretrieve(url, archive_path)
|
|
77
|
+
except Exception as exc:
|
|
78
|
+
raise RuntimeError(
|
|
79
|
+
f"Failed to download StrataFS binary from {url}: {exc}"
|
|
80
|
+
) from exc
|
|
81
|
+
|
|
82
|
+
if archive_ext == "zip":
|
|
83
|
+
with zipfile.ZipFile(archive_path, "r") as zf:
|
|
84
|
+
for member in zf.namelist():
|
|
85
|
+
if member.endswith("stratafs.exe"):
|
|
86
|
+
zf.extract(member, binary_dir)
|
|
87
|
+
extracted = os.path.join(binary_dir, member)
|
|
88
|
+
os.rename(extracted, binary_path)
|
|
89
|
+
break
|
|
90
|
+
else:
|
|
91
|
+
with tarfile.open(archive_path, "r:gz") as tf:
|
|
92
|
+
for member in tf.getmembers():
|
|
93
|
+
if member.name.endswith("stratafs"):
|
|
94
|
+
tf.extract(member, binary_dir)
|
|
95
|
+
extracted = os.path.join(binary_dir, member.name)
|
|
96
|
+
os.rename(extracted, binary_path)
|
|
97
|
+
break
|
|
98
|
+
|
|
99
|
+
os.chmod(binary_path, os.stat(binary_path).st_mode | stat.S_IEXEC)
|
|
100
|
+
|
|
101
|
+
# Cleanup archive
|
|
102
|
+
os.remove(archive_path)
|
|
103
|
+
|
|
104
|
+
return binary_path
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def ensure_binary():
|
|
108
|
+
"""Ensure the binary is available, downloading if necessary."""
|
|
109
|
+
binary_path = get_binary_path()
|
|
110
|
+
if not os.path.exists(binary_path):
|
|
111
|
+
binary_path = download_binary()
|
|
112
|
+
return binary_path
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stratafs
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: StrataFS - A semantic filesystem for AI agents
|
|
5
|
+
Author: StrataFS Contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: Development Status :: 4 - Beta
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: System :: Filesystems
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
|
+
Requires-Python: >=3.8
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# StrataFS Python Wrapper
|
|
23
|
+
|
|
24
|
+
This package provides a Python wrapper for the StrataFS native binary.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install stratafs
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
After installation, the `stratafs` command is available:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
stratafs --version
|
|
38
|
+
stratafs config init
|
|
39
|
+
stratafs serve
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The native binary is automatically downloaded from GitHub releases on first use.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
stratafs/__init__.py,sha256=nTgMZDepv0bf04qwTZUdswi04XZguGWfzXIbxJowl-A,54
|
|
2
|
+
stratafs/cli.py,sha256=Uf2-HiAy-vpFgfLL87C0PWe_h4y81OVwU1PnfwV4I5s,264
|
|
3
|
+
stratafs/download.py,sha256=r3lDwCfTEzSk0zE45irm8kFnAKr6iPJ99YM8EIuzvwA,3332
|
|
4
|
+
stratafs-0.2.0.dist-info/METADATA,sha256=cwJIEby1E2zjXkBsYTiWSKEAXwxASKGKTgDgWXuvpuM,1182
|
|
5
|
+
stratafs-0.2.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
6
|
+
stratafs-0.2.0.dist-info/entry_points.txt,sha256=SgUyB_Ie8fRhTjymH-jkkGwOXsz3uCF-lJ4EqWeQajM,47
|
|
7
|
+
stratafs-0.2.0.dist-info/top_level.txt,sha256=lpuRoGbyDRp1-tAGAaJBovegwR2CFgtYB3ohExAOMVs,9
|
|
8
|
+
stratafs-0.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
stratafs
|