miblab.osf_upload#
- miblab.osf_upload(folder: str, dataset: str, project: str = 'un5ct', token: str | None = None, verbose: bool = True, overwrite: bool = True)[source]#
Upload a file to OSF (Open Science Framework) using osfclient.
This function uploads a single local file to a specified path inside an OSF project. Intermediate folders must already exist in the OSF project; osfclient does not create them. If the file already exists, it can be overwritten or skipped.
- Parameters:
folder (str) – Path to the local file to upload.
dataset (str) – OSF path where the file should be placed (e.g., “Testing/filename.txt”).
project (str) – OSF project ID (default: “un5ct”).
token (str) – OSF personal token for private/write access.
verbose (bool) – Whether to print progress messages (default True).
overwrite (bool) – Whether to replace an existing file if it already exists (default True).
- Raises:
FileNotFoundError – If the file does not exist.
NotImplementedError – If osfclient is not installed.
RuntimeError – If upload fails for any reason.
Example
>>> from miblab import osf_upload >>> osf_upload( ... folder='data/results.csv', ... dataset='Testing/results.csv', ... project='un5ct', ... token='your-osf-token', ... verbose=True, ... overwrite=True ... )