databutton 0.37.8__tar.gz → 0.38.0__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.
- {databutton-0.37.8 → databutton-0.38.0}/PKG-INFO +2 -2
- databutton-0.38.0/databutton/experimental/__init__.py +3 -0
- databutton-0.38.0/databutton/experimental/folder/__init__.py +3 -0
- databutton-0.38.0/databutton/experimental/folder/folder.py +44 -0
- {databutton-0.37.8 → databutton-0.38.0}/databutton/version.py +1 -1
- {databutton-0.37.8 → databutton-0.38.0}/pyproject.toml +3 -3
- databutton-0.37.8/databutton/experimental/__init__.py +0 -3
- {databutton-0.37.8 → databutton-0.38.0}/LICENSE +0 -0
- {databutton-0.37.8 → databutton-0.38.0}/README.md +0 -0
- {databutton-0.37.8 → databutton-0.38.0}/databutton/__init__.py +0 -0
- {databutton-0.37.8 → databutton-0.38.0}/databutton/cachetools.py +0 -0
- {databutton-0.37.8 → databutton-0.38.0}/databutton/experimental/auth/__init__.py +0 -0
- {databutton-0.37.8 → databutton-0.38.0}/databutton/experimental/auth/get_user.py +0 -0
- {databutton-0.37.8 → databutton-0.38.0}/databutton/internal/__init__.py +0 -0
- {databutton-0.37.8 → databutton-0.38.0}/databutton/internal/auth.py +0 -0
- {databutton-0.37.8 → databutton-0.38.0}/databutton/internal/byteutils.py +0 -0
- {databutton-0.37.8 → databutton-0.38.0}/databutton/internal/dbapiclient.py +0 -0
- {databutton-0.37.8 → databutton-0.38.0}/databutton/internal/httpxclient.py +0 -0
- {databutton-0.37.8 → databutton-0.38.0}/databutton/internal/performedby.py +0 -0
- {databutton-0.37.8 → databutton-0.38.0}/databutton/internal/retries.py +0 -0
- {databutton-0.37.8 → databutton-0.38.0}/databutton/jobs/__init__.py +0 -0
- {databutton-0.37.8 → databutton-0.38.0}/databutton/jobs/run.py +0 -0
- {databutton-0.37.8 → databutton-0.38.0}/databutton/notify/__init__.py +0 -0
- {databutton-0.37.8 → databutton-0.38.0}/databutton/notify/email.py +0 -0
- {databutton-0.37.8 → databutton-0.38.0}/databutton/notify/send.py +0 -0
- {databutton-0.37.8 → databutton-0.38.0}/databutton/pydantic_v1/__init__.py +0 -0
- {databutton-0.37.8 → databutton-0.38.0}/databutton/rag/__init__.py +0 -0
- {databutton-0.37.8 → databutton-0.38.0}/databutton/rag/chroma.py +0 -0
- {databutton-0.37.8 → databutton-0.38.0}/databutton/secrets/__init__.py +0 -0
- {databutton-0.37.8 → databutton-0.38.0}/databutton/secrets/secrets.py +0 -0
- {databutton-0.37.8 → databutton-0.38.0}/databutton/storage/__init__.py +0 -0
- {databutton-0.37.8 → databutton-0.38.0}/databutton/storage/storage.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: databutton
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.38.0
|
4
4
|
Summary: The CLI for databutton.com
|
5
5
|
License: Databutton
|
6
6
|
Author: Databutton
|
@@ -16,7 +16,7 @@ Requires-Dist: certifi (>=2022.12.7,<2023.0.0)
|
|
16
16
|
Requires-Dist: chromadb (>=0.4.22,<0.5.0)
|
17
17
|
Requires-Dist: cryptography (>=40.0.1,<41.0.0)
|
18
18
|
Requires-Dist: httpx (>=0.20.0,<1)
|
19
|
-
Requires-Dist: pandas (>=0.25,<3)
|
19
|
+
Requires-Dist: pandas[feather] (>=0.25,<3)
|
20
20
|
Requires-Dist: pydantic (>=1,<3)
|
21
21
|
Requires-Dist: tenacity (>=8.0.0,<9.0.0)
|
22
22
|
Description-Content-Type: text/markdown
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import io
|
2
|
+
import os
|
3
|
+
import zipfile
|
4
|
+
|
5
|
+
import databutton as db
|
6
|
+
|
7
|
+
|
8
|
+
def zip_folder_to_bytes(folder_path: str) -> bytes:
|
9
|
+
"""Zip the contents of a folder and return as bytes."""
|
10
|
+
zip_bytes = io.BytesIO() # Use BytesIO as a buffer
|
11
|
+
with zipfile.ZipFile(zip_bytes, "w", zipfile.ZIP_DEFLATED) as zipf:
|
12
|
+
for root, _, files in os.walk(folder_path):
|
13
|
+
for file in files:
|
14
|
+
file_path = os.path.join(root, file)
|
15
|
+
zipf.write(
|
16
|
+
file_path,
|
17
|
+
os.path.relpath(file_path, os.path.join(folder_path, "..")),
|
18
|
+
)
|
19
|
+
zip_bytes.seek(0) # Go to the start of the BytesIO buffer
|
20
|
+
return zip_bytes.getvalue()
|
21
|
+
|
22
|
+
|
23
|
+
def unzip_bytes_to_folder(bytes_data: bytes, extract_path: str):
|
24
|
+
"""Unzip bytes into a folder."""
|
25
|
+
# Ensure the extraction path exists
|
26
|
+
os.makedirs(extract_path, exist_ok=True)
|
27
|
+
zip_bytes = io.BytesIO(bytes_data)
|
28
|
+
with zipfile.ZipFile(zip_bytes, "r") as zip_ref:
|
29
|
+
zip_ref.extractall(extract_path)
|
30
|
+
|
31
|
+
|
32
|
+
def upload(key: str, folder_path: str):
|
33
|
+
"""Zip and upload a folder to blob storage."""
|
34
|
+
zipped_bytes = zip_folder_to_bytes(folder_path)
|
35
|
+
db.storage.binary.put(key, zipped_bytes)
|
36
|
+
|
37
|
+
|
38
|
+
def download(key: str, folder_path: str):
|
39
|
+
"""Download and unzip a folder from blob storage."""
|
40
|
+
zipped_bytes = db.storage.binary.get(key)
|
41
|
+
if zipped_bytes is not None:
|
42
|
+
# Ensure the target folder exists before extraction
|
43
|
+
os.makedirs(folder_path, exist_ok=True)
|
44
|
+
unzip_bytes_to_folder(zipped_bytes, folder_path)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "databutton"
|
3
|
-
version = "0.
|
3
|
+
version = "0.38.0"
|
4
4
|
description = "The CLI for databutton.com"
|
5
5
|
authors = ["Databutton <hi@databutton.io>"]
|
6
6
|
license = "Databutton"
|
@@ -10,7 +10,7 @@ packages = [{ include = "databutton" }]
|
|
10
10
|
[tool.poetry.dependencies]
|
11
11
|
python = ">=3.10,<3.12"
|
12
12
|
httpx = ">=0.20.0,<1"
|
13
|
-
pandas = "<3,>=0.25"
|
13
|
+
pandas = { extras = ["feather"], version = "<3,>=0.25" }
|
14
14
|
pydantic = ">=1,<3"
|
15
15
|
PyJWT = "^2.2.0"
|
16
16
|
PyYAML = "^6.0"
|
@@ -30,7 +30,7 @@ isort = "^5.12.0"
|
|
30
30
|
python-semantic-release = "7.28.1"
|
31
31
|
pytest-mock = "^3.7.0"
|
32
32
|
pandas-stubs = "^1.5.2.221124"
|
33
|
-
ruff = "^0.
|
33
|
+
ruff = "^0.3.0"
|
34
34
|
types-pyjwt = "^1.7.1"
|
35
35
|
|
36
36
|
[build-system]
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|