-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #522 from OpenMined/release_document
Added new release document
- Loading branch information
Showing
16 changed files
with
208 additions
and
40 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import argparse | ||
import json | ||
|
||
from packaging.version import Version | ||
|
||
parser = argparse.ArgumentParser("upgrade_version_matrix") | ||
parser.add_argument("upgrade_type", choices=["major", "minor", "patch"]) | ||
parser.add_argument("--breaking_changes", action="store_true") | ||
|
||
args = parser.parse_args() | ||
print(args.upgrade_type) | ||
print(args.breaking_changes) | ||
|
||
with open("../syftbox/server2client_version.json") as json_file: | ||
version_matrix = json.load(json_file) | ||
|
||
versions = list(version_matrix.keys()) | ||
versions.sort(key=Version) | ||
last_version = versions[-1] | ||
version_numbers = last_version.split(".") | ||
|
||
if args.upgrade_type == "patch": | ||
if args.breaking_changes: | ||
raise Exception( | ||
"Patch upgrades imply no breaking changes. If you have breaking changes please consider a minor version upgrade" | ||
) | ||
version_numbers[2] = str(int(version_numbers[2]) + 1) | ||
new_version = ".".join(version_numbers) | ||
# new_version = last_version | ||
version_matrix[new_version] = version_matrix[last_version] | ||
elif args.upgrade_type == "minor": | ||
version_numbers[1] = str(int(version_numbers[1]) + 1) | ||
version_numbers[2] = "0" | ||
new_version = ".".join(version_numbers) | ||
if args.breaking_changes: | ||
version_matrix[new_version] = [new_version, ""] | ||
for version in versions: | ||
version_range = version_matrix[version] | ||
if version_range[1] == "": | ||
version_range[1] = new_version | ||
version_matrix[version] = version_range | ||
else: | ||
version_matrix[new_version] = version_matrix[last_version] | ||
|
||
elif args.upgrade_type == "major": | ||
raise NotImplementedError | ||
|
||
with open("../syftbox/server2client_version.json", "w") as json_file: | ||
# json.dump(version_matrix, json_file, indent=4) | ||
json_file.write("{\n") | ||
json_file.write( | ||
",\n".join( | ||
[ | ||
f"""\t"{key}": ["{version_range[0]}", "{version_range[1]}"]""" | ||
for key, version_range in version_matrix.items() | ||
] | ||
) | ||
) | ||
json_file.write("\n}\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import json | ||
from os.path import dirname | ||
from typing import Dict, List | ||
|
||
|
||
def get_version_dict() -> Dict[str, List[str]]: | ||
print(dirname(dirname(__file__))) | ||
with open(dirname(dirname(__file__)) + "/server2client_version.json") as json_file: | ||
version_matrix = json.load(json_file) | ||
return version_matrix | ||
|
||
|
||
def get_range_for_version(version_string: str) -> List[str]: | ||
print(f"{version_string=}") | ||
return get_version_dict()[version_string] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"0.1.0": ["0.1.0", "0.2.0"], | ||
"0.1.1": ["0.1.0", "0.2.0"], | ||
"0.1.2": ["0.1.0", "0.2.0"], | ||
"0.1.3": ["0.1.0", "0.2.0"], | ||
"0.1.4": ["0.1.0", "0.2.0"], | ||
"0.1.5": ["0.1.0", "0.2.0"], | ||
"0.1.6": ["0.1.0", "0.2.0"], | ||
"0.1.7": ["0.1.0", "0.2.0"], | ||
"0.1.8": ["0.1.0", "0.2.0"], | ||
"0.1.9": ["0.1.0", "0.2.0"], | ||
"0.1.10": ["0.1.0", "0.2.0"], | ||
"0.1.11": ["0.1.0", "0.2.0"], | ||
"0.1.12": ["0.1.0", "0.2.0"], | ||
"0.1.13": ["0.1.0", "0.2.0"], | ||
"0.1.14": ["0.1.0", "0.2.0"], | ||
"0.1.15": ["0.1.0", "0.2.0"], | ||
"0.1.16": ["0.1.0", "0.2.0"], | ||
"0.1.17": ["0.1.0", "0.2.0"], | ||
"0.1.18": ["0.1.0", "0.2.0"], | ||
"0.1.19": ["0.1.0", "0.2.0"], | ||
"0.1.20": ["0.1.0", "0.2.0"], | ||
"0.1.21": ["0.1.0", "0.2.0"], | ||
"0.1.22": ["0.1.0", "0.2.0"], | ||
"0.1.23": ["0.1.0", "0.2.0"], | ||
"0.1.24": ["0.1.0", "0.2.0"], | ||
"0.2.0": ["0.2.0", ""], | ||
"0.2.1": ["0.2.0", ""], | ||
"0.2.2": ["0.2.0", ""], | ||
"0.2.3": ["0.2.0", ""], | ||
"0.2.4": ["0.2.0", ""], | ||
"0.2.5": ["0.2.0", ""], | ||
"0.2.6": ["0.2.0", ""], | ||
"0.2.7": ["0.2.0", ""], | ||
"0.2.8": ["0.2.0", ""], | ||
"0.2.9": ["0.2.0", ""], | ||
"0.2.10": ["0.2.0", ""], | ||
"0.2.11": ["0.2.0", ""] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,11 +6,13 @@ | |
from fastapi import FastAPI | ||
from fastapi.testclient import TestClient | ||
|
||
from syftbox import __version__ | ||
from syftbox.client.base import PluginManagerInterface, SyftBoxContextInterface | ||
from syftbox.client.core import SyftBoxContext | ||
from syftbox.client.server_client import SyftBoxClient | ||
from syftbox.lib.client_config import SyftClientConfig | ||
from syftbox.lib.datasite import create_datasite | ||
from syftbox.lib.http import HEADER_SYFTBOX_VERSION | ||
from syftbox.lib.workspace import SyftWorkspace | ||
from syftbox.server.migrations import run_migrations | ||
from syftbox.server.server import app as server_app | ||
|
@@ -23,6 +25,7 @@ def authenticate_testclient(client: TestClient, email: str) -> None: | |
access_token = get_access_token(client, email) | ||
client.headers["email"] = email | ||
client.headers["Authorization"] = f"Bearer {access_token}" | ||
client.headers[HEADER_SYFTBOX_VERSION] = __version__ | ||
|
||
|
||
class MockPluginManager(PluginManagerInterface): | ||
|
@@ -74,17 +77,20 @@ def server_app_with_lifespan(tmp_path: Path) -> FastAPI: | |
def datasite_1(tmp_path: Path, server_app_with_lifespan: FastAPI) -> SyftBoxContextInterface: | ||
email = "[email protected]" | ||
with TestClient(server_app_with_lifespan) as client: | ||
client.headers[HEADER_SYFTBOX_VERSION] = __version__ | ||
return setup_datasite(tmp_path, client, email) | ||
|
||
|
||
@pytest.fixture() | ||
def datasite_2(tmp_path: Path, server_app_with_lifespan: FastAPI) -> SyftBoxContextInterface: | ||
email = "[email protected]" | ||
with TestClient(server_app_with_lifespan) as client: | ||
client.headers[HEADER_SYFTBOX_VERSION] = __version__ | ||
return setup_datasite(tmp_path, client, email) | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def server_client(server_app_with_lifespan: FastAPI) -> Generator[TestClient, None, None]: | ||
with TestClient(server_app_with_lifespan) as client: | ||
client.headers[HEADER_SYFTBOX_VERSION] = __version__ | ||
yield client |
Oops, something went wrong.