Skip to main content

CLI utility for uploading data to CUE (Cloud Upload Environment)

Project description

CUE Provider Utility (cue-upload)

Version: 0.1.0
License: Apache-2.0

Overview

The CUE Provider Utility (cue-upload) is a Python-based command-line interface (CLI) designed to facilitate the upload of files and entire folder structures to the CUE (Cloud Upload Environment) backend system. It is optimized for large files, provides a rich user experience, and ensures data integrity through robust error handling and checksum validation.

This tool is intended for users who need to transfer data to the CUE system from their local machines.

Features

  • Upload individual files or entire directories recursively.
  • Automatic handling of single-part vs. multipart uploads based on file size.
  • Concurrent uploads for multiple files within a folder and for parts of a single large file.
  • SHA256 checksum validation for data integrity.
  • User-friendly configuration via a config.toml file and interactive configure command.
  • Flexible authentication token management (CLI option, config file, environment variable, .netrc).
  • Support for different backend environments (prod, uat, sit, local).
  • Management of ignored file patterns (system defaults + user-defined).
  • Detailed logging to both console (with colors and progress bars via Rich) and a log file.
  • Cross-platform compatibility (Windows, macOS, Linux).

Prerequisites

  • Python: Version 3.10 or newer.
  • Poetry: Version 1.2+ is recommended for dependency management. Installation instructions can be found at python-poetry.org.

Installation

Clone the Repository:

git clone https://github.com/ghrcdaac/CUE-Provider-Utility.git
cd CUE-Provider-Utility

Install Dependencies using Poetry:
This command creates a virtual environment and installs all necessary packages.

poetry install

Configuration

The utility is configured via a file located at ~/.cue-upload/config.toml. This file is created automatically the first time you run the tool.

First-Time Setup

The recommended way to set up the CLI is to use the interactive configure command. This will guide you through setting up your API key storage.

cue-upload configure

This will guide you through each option, showing the current value and prompting for a new one. At the end, it will guide you through the API key setup.

Quickly Updating Your API Key

If you only need to update, change, or remove your stored API key without going through all the other settings, you can use the --key flag. This provides a fast and secure way to manage your credentials.

cue-upload configure --key

The prompt will detect if you already have a key stored and ask if you want to overwrite or delete it.

API Key Management

The CLI retrieves your API key from the following sources, in this order of priority:

  1. Command-Line Argument: The -t or --token option. (e.g., cue-upload --token YOUR_KEY ...)
  2. Environment Variable: The CUE_UPLOAD_API_TOKEN environment variable.
  3. .netrc File: A secure, permissions-controlled file in your home directory.
  4. config.toml File: The application's configuration file.

The CLI will print which source it is using when you start an upload.

Basic Usage

Activate the Virtual Environment

Before running any commands, activate the Poetry virtual environment:

poetry shell

General Help

cue-upload -h
cue-upload upload -h

Uploading Files or Folders

# Upload a single file
cue-upload upload -P /path/to/your/file.txt -c your_collection_name

# Upload a folder and specify a target sub-path in the collection
cue-upload upload -P /path/to/your/folder/ -c your_collection_name -tp remote/sub_path/

Managing Configuration

# Run the interactive configuration wizard
cue-upload configure

Viewing Logs

# View the entire log file
cue-upload logs

# View the last 100 lines
cue-upload logs -n 100

Managing Ignored File Patterns

# List all current ignore patterns
cue-upload ignore list

# Add a pattern to ignore all .log files
cue-upload ignore add "*.log"

# Remove a pattern
cue-upload ignore remove "*.log"

# Clear all user-defined patterns
cue-upload ignore reset

Global Options

  • -t, --token YOUR_TOKEN: Provide API key directly.
  • --env ENV_NAME: Target a specific backend environment (prod, uat, sit, local).
  • -v / -vv: Increase console verbosity. -vv includes full network logs.
  • -q: Quiet mode, showing only critical errors.
  • --config /path/to/config.toml: Use a custom configuration file.

Development

Running Tests

Tests are located in the tests/ directory and can be run with pytest.

# Run all tests
pytest

# Run tests with coverage report
pytest --cov=cue_provider_utility tests/

Linters and Formatters

This project uses black, isort, flake8, and mypy to maintain code quality.

black cue_provider_utility/ tests/
isort cue_provider_utility/ tests/
flake8 cue_provider_utility/ tests/
mypy cue_provider_utility/

License

This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cue_provider_utility-0.1.0.tar.gz (32.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cue_provider_utility-0.1.0-py3-none-any.whl (38.6 kB view details)

Uploaded Python 3

File details

Details for the file cue_provider_utility-0.1.0.tar.gz.

File metadata

  • Download URL: cue_provider_utility-0.1.0.tar.gz
  • Upload date:
  • Size: 32.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.10.12 Linux/6.6.87.2-microsoft-standard-WSL2

File hashes

Hashes for cue_provider_utility-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8053e824857b74fdfc7bf3f245a35655abdae65c9a5b3074a70335b5f062b2be
MD5 8e9bae1f5b1525f047a7ebd5fce1fba0
BLAKE2b-256 b708cc7f9c0717003677cd81c06f4f30746e5c4c33dc7489cc6115cdb49b7cc5

See more details on using hashes here.

File details

Details for the file cue_provider_utility-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cue_provider_utility-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 38.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.10.12 Linux/6.6.87.2-microsoft-standard-WSL2

File hashes

Hashes for cue_provider_utility-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 55d5eaab92ded3782bff1b9df786968d2ae23bc65bb33ee62aff7d1262516e8e
MD5 f5c67baadc10f1d2ba49cfe299f35438
BLAKE2b-256 b9c46bddcc3c368be4b956a87f83c9ddf46af56827d0c0bdf11955746bf0dab8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page