Some utility functions for working with the Kaggle API.
Project description
cjm-kaggle-utils
Install
pip install cjm_kaggle_utils
How to use
save_kaggle_creds
from cjm_kaggle_utils.core import save_kaggle_creds
username = "name"
key = "12345"
save_kaggle_creds(username, key, overwrite=False)
Credentials already present. Set `overwrite=True` to replace them.
dl_kaggle
from cjm_kaggle_utils.core import dl_kaggle
from pathlib import Path
# Get the path to the directory where datasets are stored
dataset_dir = Path("./Datasets/")
dataset_dir.mkdir(parents=True, exist_ok=True)
print(f"Dataset Directory: {dataset_dir}")
# Create the path to the data directory
archive_dir = dataset_dir/'../Archive'
archive_dir.mkdir(parents=True, exist_ok=True)
print(f"Archive Directory: {archive_dir}")
Dataset Directory: Datasets
Archive Directory: Datasets/../Archive
# Set the name of the dataset
dataset_name = 'yolox-openvino-inference-demo-files'
# Construct the Kaggle dataset name by combining the username and dataset name
kaggle_dataset = f'innominate817/{dataset_name}'
# Create the path to the zip file that contains the dataset
archive_path = Path(f'{archive_dir}/{dataset_name}.zip')
print(f"Archive Path: {archive_path}")
# Create the path to the directory where the dataset will be extracted
dataset_path = Path(f'{dataset_dir}/{dataset_name}')
print(f"Dataset Path: {dataset_path}")
Archive Path: Datasets/../Archive/yolox-openvino-inference-demo-files.zip
Dataset Path: Datasets/yolox-openvino-inference-demo-files
dl_kaggle(kaggle_dataset, archive_path, dataset_path)
Dataset already downloaded
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
cjm-kaggle-utils-0.0.2.tar.gz
(5.5 kB
view hashes)
Built Distribution
Close
Hashes for cjm_kaggle_utils-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9621c2ecddb1e6599f557315bab1415ca5e39c4cdbe38a7ffb7027c859cbf319 |
|
MD5 | 6978261388c289bf81a8f4eead951aaf |
|
BLAKE2b-256 | 3b322c6fa9fb23fb8630e29f30b46dfdf9cbcd162bc3d713c3d2e559d4f7351b |