Skip to content

Commit

Permalink
Moving version to specific file, and exposing uploader utils
Browse files Browse the repository at this point in the history
Signed-off-by: Cédric Foellmi <[email protected]>
  • Loading branch information
onekiloparsec committed Apr 28, 2024
1 parent 941e90b commit 605d9a2
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 12 deletions.
7 changes: 3 additions & 4 deletions arcsecond/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .api import ArcsecondAPI, ArcsecondConfig, ArcsecondAPIEndpoint
from .errors import ArcsecondError
from .uploader import UploadContext, FileUploader
from .uploader import UploadContext, FileUploader, walk_folder_and_upload

name = 'arcsecond'

Expand All @@ -9,6 +9,5 @@
"ArcsecondConfig",
"ArcsecondAPIEndpoint",
"UploadContext",
"FileUploader"]

__version__ = '3.2.0'
"FileUploader",
"walk_folder_and_upload"]
1 change: 1 addition & 0 deletions arcsecond/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '3.2.0'
8 changes: 4 additions & 4 deletions arcsecond/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .uploader.context import UploadContext
from .uploader.errors import ArcsecondError
from .uploader.utils import display_command_summary
from .uploader.walker import walk
from .uploader.walker import walk_folder_and_upload

pass_state = click.make_pass_decorator(State, ensure=True)

Expand All @@ -22,14 +22,14 @@
@click.pass_context
def main(ctx, version=False, v=False, h=False):
if version or v:
click.echo(__version__)
click.echo(__version__.__version__)
elif ctx.invoked_subcommand is None:
click.echo(ctx.get_help())


@main.command(help=VERSION_HELP_STRING)
def version():
click.echo(__version__)
click.echo(__version__.__version__)


@main.command(help='Login to your Arcsecond account.')
Expand Down Expand Up @@ -165,4 +165,4 @@ def upload(state, folder, dataset=None, telescope=None, portal=None):
display_command_summary(context, [folder, ])
ok = input('\n ----> OK? (Press Enter) ')
if ok.strip() == '':
walk(context, folder)
walk_folder_and_upload(context, folder)
4 changes: 3 additions & 1 deletion arcsecond/uploader/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from .context import UploadContext
from .uploader import FileUploader
from .walker import walk_folder_and_upload

__all__ = ["UploadContext",
"FileUploader"]
"FileUploader",
"walk_folder_and_upload"]
2 changes: 1 addition & 1 deletion arcsecond/uploader/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from requests_toolbelt import MultipartEncoder, MultipartEncoderMonitor

from arcsecond import ArcsecondAPI
from arcsecond import __version__
from arcsecond.__version__ import __version__
from .constants import Status, Substatus
from .context import UploadContext
from .errors import UploadRemoteDatasetCheckError, UploadRemoteFileError, UploadRemoteFileTagsError
Expand Down
2 changes: 1 addition & 1 deletion arcsecond/uploader/walker.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __walk_second_pass(context: UploadContext, root_path: Path, file_paths: list
return uploads


def walk(context: UploadContext, folder_string: str):
def walk_folder_and_upload(context: UploadContext, folder_string: str):
logger = get_logger()
log_prefix = '[Walker]'
root_path = Path(folder_string).resolve()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from setuptools import find_packages, setup

_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('arcsecond/__init__.py', 'rb') as f:
with open('arcsecond/__version__.py', 'rb') as f:
__version__ = str(ast.literal_eval(_version_re.search(f.read().decode('utf-8')).group(1)))

_directory = os.path.abspath(os.path.dirname(__file__))
Expand Down

0 comments on commit 605d9a2

Please sign in to comment.