-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
141 additions
and
103 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: test stage call | ||
name: test and build docs | ||
|
||
on: push | ||
|
||
|
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# collection | ||
|
||
Maintains the resources displayed on bioimage.io (Successor to collection-bioimage-io) |
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,3 @@ | ||
{ | ||
"version": "0.1.0" | ||
} |
File renamed without changes.
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,55 @@ | ||
import os | ||
from typing import Literal, Optional | ||
|
||
import fire | ||
from bioimageio.spec.model.v0_5 import WeightsFormat | ||
from dotenv import load_dotenv | ||
|
||
from .backup import backup | ||
from .run_dynamic_tests import run_dynamic_tests | ||
from .utils.remote_resource import PublishedVersion, RemoteResource, StagedVersion | ||
from .utils.s3_client import Client | ||
from .validate_format import validate_format | ||
|
||
_ = load_dotenv() | ||
|
||
|
||
class BackOffice: | ||
def __init__(self) -> None: | ||
super().__init__() | ||
self.client = Client() | ||
|
||
def stage(self, resource_id: str, package_url: str): | ||
resource = RemoteResource(client=Client(), id=resource_id) | ||
staged = resource.stage_new_version(package_url) | ||
validate_format(staged) | ||
|
||
def test( | ||
self, | ||
resource_id: str, | ||
version: int, | ||
weight_format: Optional[WeightsFormat] = None, | ||
create_env_outcome: Literal["success", ""] = "success", | ||
): | ||
staged = StagedVersion(self.client, resource_id, version) | ||
run_dynamic_tests( | ||
staged=staged, | ||
weight_format=weight_format, | ||
create_env_outcome=create_env_outcome, | ||
) | ||
|
||
def await_review(self, resource_id: str, version: int): | ||
staged = StagedVersion(self.client, resource_id, version) | ||
staged.await_review() | ||
|
||
def publish(self, resource_id: str, stage_nr: int): | ||
staged = StagedVersion(client=self.client, id=resource_id, version=stage_nr) | ||
published = staged.publish() | ||
assert isinstance(published, PublishedVersion) | ||
|
||
def backup(self): | ||
_ = backup(self.client, os.environ["ZENODO_URL"]) | ||
|
||
|
||
if __name__ == "__main__": | ||
fire.Fire(BackOffice) |
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 |
---|---|---|
@@ -1,25 +1,19 @@ | ||
import os | ||
|
||
import typer | ||
from dotenv import load_dotenv | ||
from loguru import logger | ||
from utils.s3_client import Client | ||
|
||
from backoffice.utils.s3_client import Client | ||
|
||
_ = load_dotenv() | ||
|
||
|
||
def backup(): | ||
def backup(client: Client, destination: str): | ||
"""backup collection | ||
Returns: | ||
list of folders and file names backed up | ||
""" | ||
client = Client() | ||
content_to_backup = list(client.ls("")) | ||
destination = os.environ["ZENODO_URL"] | ||
logger.error("Backup to '{}': {}", destination, content_to_backup) | ||
logger.error("Not implemented: Backup to '{}': {}", destination, content_to_backup) | ||
return content_to_backup | ||
|
||
|
||
if __name__ == "__main__": | ||
typer.run(backup) |
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
Empty file.
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
File renamed without changes.
File renamed without changes.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,50 @@ | ||
import json | ||
from pathlib import Path | ||
|
||
from setuptools import find_packages, setup | ||
|
||
# Get the long description from the README file | ||
ROOT_DIR = Path(__file__).parent.resolve() | ||
long_description = (ROOT_DIR / "README.md").read_text(encoding="utf-8") | ||
VERSION_FILE = ROOT_DIR / "backoffice" / "VERSION" | ||
VERSION = json.loads(VERSION_FILE.read_text(encoding="utf-8"))["version"] | ||
|
||
|
||
setup( | ||
name="backoffice", | ||
version=VERSION, | ||
description="backoffice to control bioimage.io collection", | ||
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
url="https://github.com/bioimage-io/collection", | ||
author="bioimage.io Team", | ||
classifiers=[ | ||
"Development Status :: 3 - Alpha", | ||
"Intended Audience :: Developers", | ||
"Programming Language :: Python :: 3.12", | ||
], | ||
packages=find_packages(exclude=["tests"]), | ||
install_requires=[ | ||
"bioimageio.core @ git+https://github.com/bioimage-io/core-bioimage-io-python@3a7875b5debc2d52b2fc87f6579afe217e1c7280", # TODO: change to released version | ||
"bioimageio.spec @ git+https://github.com/bioimage-io/spec-bioimage-io@19105665ad779014e03c7b311c0b4003ab08f752", # TODO: change to released version | ||
"fire", | ||
"loguru", | ||
"minio==7.2.3", | ||
"ruyaml", | ||
"tqdm", | ||
], | ||
extras_require={ | ||
"dev": [ | ||
"black", | ||
"pdoc", | ||
"pre-commit", | ||
"pyright", | ||
"pytest", | ||
] | ||
}, | ||
entry_points={"console_scripts": ["backoffice = backoffice.__main__"]}, | ||
project_urls={ | ||
"Bug Reports": "https://github.com/bioimage-io/collection/issues", | ||
"Source": "https://github.com/bioimage-io/collection", | ||
}, | ||
) |
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
7 changes: 2 additions & 5 deletions
7
.../test_scripts/test_utils/test_s3client.py → tests/test_utils/test_s3client.py
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