Version: 0.1.0
License: Apache-2.0
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.
- 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 interactiveconfigure
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).
- Python: Version 3.10 or newer.
- Poetry: Version 1.2+ is recommended for dependency management. Installation instructions can be found at python-poetry.org.
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
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.
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.
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.
The CLI retrieves your API key from the following sources, in this order of priority:
- Command-Line Argument: The
-t
or--token
option. (e.g.,cue-upload --token YOUR_KEY ...
) - Environment Variable: The
CUE_UPLOAD_API_TOKEN
environment variable. - .netrc File: A secure, permissions-controlled file in your home directory.
- config.toml File: The application's configuration file.
The CLI will print which source it is using when you start an upload.
Before running any commands, activate the Poetry virtual environment:
poetry shell
cue-upload -h
cue-upload upload -h
# 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/
# Run the interactive configuration wizard
cue-upload configure
# View the entire log file
cue-upload logs
# View the last 100 lines
cue-upload logs -n 100
# 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
-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.
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/
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/
This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details.