Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added to_flow capability for Code #13

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions me.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
uv run syftbox/client/client.py --config_path=./users/me.json --sync_folder=./users/me [email protected] --port=8085 --server=http://localhost:5001
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencies = [
"markdown>=3.7",
"pandas>=2.2.2",
"setuptools>=75.1.0",
"postmarker>=1.0",
]

[build-system]
Expand Down
21 changes: 12 additions & 9 deletions syftbox/client/plugins/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
)

CLIENT_CHANGELOG_FOLDER = "syft_changelog"
IGNORE_FOLDERS = [CLIENT_CHANGELOG_FOLDER]
STAGING = "staging"
IGNORE_FOLDERS = [CLIENT_CHANGELOG_FOLDER, STAGING]


# write operations
Expand Down Expand Up @@ -125,8 +126,9 @@ def filter_changes(
valid_changes.append(change)
valid_change_files.append(change.sub_path)
continue
# todo we need to handle this properly
if perm_file_at_path.read == [user_email]:
if change.internal_path[-10:] == "_.syftperm":
if change.internal_path.endswith("_.syftperm"):
# include changes for syft_perm file even if only we have read perms.
valid_changes.append(change)
valid_change_files.append(change.sub_path)
Expand Down Expand Up @@ -192,9 +194,9 @@ def pull_changes(client_config, changes):
data = None

if response.status_code == 200:
print(
f"> {client_config.email} /read {change.kind} {change.internal_path}",
)
# print(
# f"> {client_config.email} /read {change.kind} {change.internal_path}",
# )
remote_changes.append((ok_change, data))
else:
print(
Expand Down Expand Up @@ -259,7 +261,7 @@ def ascii_for_change(changes) -> str:
pipe = "├──"
if count == len(changes):
pipe = "└──"
change_text += pipe + change
change_text += pipe + change + "\n"
return change_text


Expand Down Expand Up @@ -308,6 +310,7 @@ def sync_up(client_config):

# send val changes
results = push_changes(client_config, val)

deleted_files = []
changed_files = []
for result in results:
Expand All @@ -320,10 +323,12 @@ def sync_up(client_config):

# combine successful changes qwith old dir state
combined_tree = old_dir_state.tree

# add new successful changes
combined_tree.update(synced_dir_state.tree)
synced_dir_state.tree = combined_tree

synced_dir_state = delete_files(new_dir_state, deleted_files)
synced_dir_state = delete_files(synced_dir_state, deleted_files)

change_text = ""
if len(changed_files):
Expand All @@ -334,8 +339,6 @@ def sync_up(client_config):
change_text += f"❌ Syncing Up {len(deleted_files)} Deletes\n"
change_text += ascii_for_change(deleted_files)

print(change_text)

synced_dir_state.save(dir_filename)
n_changes += len(changed_files) + len(deleted_files)

Expand Down
Loading