Skip to content

Commit

Permalink
version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
aj-ya committed Apr 22, 2024
1 parent 73dfe3d commit 808d304
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 21 deletions.
9 changes: 3 additions & 6 deletions outpostcli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
from outpostkit import Client, Endpoint
from outpostkit.exceptions import OutpostError, OutpostHTTPException

from outpostcli.lfs.commands import lfs

from .config_utils import (
purge_config_file,
remove_details_from_config_file,
write_details_to_config_file,
)

from .constants import cli_version
from .endpoints import endpoints
from .lfs.commands import lfs
from .exceptions import NotLoggedInError
from .utils import add_options, api_token_opt, check_token, click_group, entity_opt

Expand Down Expand Up @@ -126,8 +126,5 @@ def outpost():
click.echo(f"""APIException: - {error}""", err=True)





if __name__ == '__main__':
outpostcli()
outpostcli()
2 changes: 1 addition & 1 deletion outpostcli/constants.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
cli_version = "0.0.17"
cli_version = "0.0.18"
CLI_BINARY_NAME = "outpostcli"
7 changes: 3 additions & 4 deletions outpostcli/lfs/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
import os
import subprocess
import sys
from argparse import _SubParsersAction
from typing import Any, Dict, List, Optional
from typing import Dict, Optional

import click
import httpx
from outpostkit import Client

from outpostcli.constants import CLI_BINARY_NAME
from outpostcli.lfs.utils import HTTPException, SliceFileObj, _raise_for_status
from outpostcli.log import Logger
from outpostcli.utils import click_group

# from huggingface_hub.commands import BaseHuggingfaceCLICommand
# from huggingface_hub.lfs import LFS_MULTIPART_UPLOAD_COMMAND, SliceFileObj
Expand All @@ -21,7 +20,7 @@
# logger = logging.get_logger(__name__)


@click.group()
@click_group()
def lfs():
pass

Expand Down
19 changes: 11 additions & 8 deletions outpostcli/lfs/utils.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
from contextlib import AbstractContextManager
from json import JSONDecodeError
from typing import TYPE_CHECKING, BinaryIO, Dict, Iterable, List, Optional, Tuple, TypedDict
import io
import os
from contextlib import AbstractContextManager
from json import JSONDecodeError
from typing import (
BinaryIO,
Optional,
)

import httpx


class SliceFileObj(AbstractContextManager):
"""
Utility context manager to read a *slice* of a seekable file-like object as a seekable, file-like object.
Expand Down Expand Up @@ -95,8 +100,6 @@ def __iter__(self):
yield self.read(n=4 * 1024 * 1024)




class HTTPException(Exception):
"""A base class for all Outpost exceptions."""

Expand All @@ -116,8 +119,6 @@ def __str__(self) -> str:
return f"status: {self.status_code}, message: {self.code + ' - '+ self.message if self.code else self.message}"




def _raise_for_status(resp: httpx.Response):
if 400 <= resp.status_code < 600:
content_type, _, _ = resp.headers["content-type"].partition(";")
Expand Down Expand Up @@ -149,7 +150,9 @@ def _raise_for_status(resp: httpx.Response):
),
) from None
except JSONDecodeError as e:
raise HTTPException("Failed to decode json body.") from e
raise HTTPException(
message="Failed to decode json body.", status_code=500
) from e
elif content_type == "text/plain":
raise HTTPException(
status_code=resp.status_code, message=resp.text
Expand Down
2 changes: 1 addition & 1 deletion outpostcli/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from typing import Dict, Literal, Optional, Union
from typing import Dict, Union

import click
from outpostkit._types.endpoint import EndpointAutogeneratedTemplateConfigDetails
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "outpostcli"
version = "0.0.17"
version = "0.0.18"
description = "CLI for Outpost"
readme = "README.md"
license = { file = "LICENSE" }
Expand Down

0 comments on commit 808d304

Please sign in to comment.