Skip to main content

A lightweight CLI and Python library to synchronise local research data, results and analysis artifacts with Zenodo

Project description

zenodo-sync

PyPI version Python Support License: MIT

A lightweight CLI and Python library to synchronise local research data, results and analysis artifacts with Zenodo. Designed for reproducible science and seamless data publishing workflows.

Status

🚧 Active Development - This repository is currently in active development. The core functionality is being implemented and the API may change.

The package is available on PyPI as a placeholder to reserve the name. Full functionality will be available in upcoming releases.

Features (Planned)

  • 📤 Upload & Publish: Upload metadata, READMEs, and digital assets from local filesystem to Zenodo
  • 📥 Download: Download published datasets to local filesystem for reproducible research
  • 🔄 Sync: Bidirectional synchronization between local directories and Zenodo records
  • 🔐 Authentication: Secure API token-based authentication with Zenodo
  • 🧪 Sandbox Support: Test your workflows safely with Zenodo's sandbox environment
  • 🎯 Semantic Versioning: Built-in support for semantic versioning of your research outputs
  • 🐍 Python API: Comprehensive Python API for integration into existing workflows
  • ⌨️ CLI Interface: Easy-to-use command-line interface for quick operations

Installation

From PyPI (Recommended)

pip install zenodo-sync

Development Installation

# Clone the repository
git clone https://github.com/causaliq/zenodo-sync.git
cd zenodo-sync

# Set up development environment (Windows)
scripts\setup-dev.bat

# Set up development environment (Unix/Linux/macOS)
chmod +x scripts/setup-dev.sh
./scripts/setup-dev.sh

# Or manually:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -e ".[dev,test]"

Quick Start

1. Get Your Zenodo API Token

  1. Visit Zenodo (or Zenodo Sandbox for testing)
  2. Go to Account Settings → Applications → Personal access tokens
  3. Create a new token with appropriate scopes

2. Configure Authentication

# Set environment variable
export ZENODO_TOKEN="your-api-token-here"

# Or create a .env file
cp .env.example .env
# Edit .env and add your token

3. Use the CLI

# Upload a file (to sandbox by default)
zenodo-sync upload my-dataset.csv

# Download files from a record
zenodo-sync download 12345 ./downloads/

# Sync a directory with Zenodo
zenodo-sync sync ./my-research-project/

4. Use the Python API

from zenodo_sync import ZenodoSync

# Initialize (uses sandbox by default for safety)
sync = ZenodoSync(token="your-token", sandbox=True)

# Upload a file
result = sync.upload_file("my-dataset.csv")

# Download files
files = sync.download_file("12345", "./downloads/")

# Sync directory
result = sync.sync_directory("./my-project/")

Configuration

You can configure zenodo-sync using:

  1. Environment variables:

    • ZENODO_TOKEN: Your Zenodo API token
    • ZENODO_SANDBOX: Use sandbox (default: true)
  2. Configuration file (.env):

    ZENODO_TOKEN=your_token_here
    ZENODO_SANDBOX=true
    
  3. Command-line arguments:

    zenodo-sync --token your-token --production upload file.txt
    

Development

Requirements

  • Python 3.9 or higher
  • pip (latest version recommended)

Development Setup

# Clone and setup
git clone https://github.com/causaliq/zenodo-sync.git
cd zenodo-sync

# Quick setup using task runner
python tasks.py setup

# Or manual setup
pip install -e ".[dev,test]"
pre-commit install

Running Tests

# Run all tests with coverage
python tasks.py test

# Quick tests (no coverage)
python tasks.py test-quick

# Or directly with pytest
pytest -v

Code Quality

# Run all checks (lint, type-check, test)
python tasks.py check

# Format code
python tasks.py format

# Run linting only
python tasks.py lint

# Type checking
python tasks.py type-check

Building and Publishing

# Build package
python tasks.py build

# Using the build script (Windows)
scripts\build-and-publish.bat

# Manual build and upload
python -m build
twine upload --repository testpypi dist/*  # Test PyPI
twine upload dist/*  # Production PyPI

Contributing

We welcome contributions! Please see our contributing guidelines for details.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run tests (python tasks.py check)
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Changelog

See CHANGELOG.md for a detailed list of changes and version history.

Support

Acknowledgments

  • Built for the research community
  • Powered by the Zenodo platform
  • Inspired by the need for reproducible science

Supported Python Versions: 3.9, 3.10, 3.11, 3.12
Default Python Version: 3.11

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

zenodo_sync-0.1.0.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

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

zenodo_sync-0.1.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: zenodo_sync-0.1.0.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for zenodo_sync-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2f36f667d480e3e16ab995edbbcafbd077dd6dee090158f550c6b53953b403ab
MD5 e6ec71d9e796dab3bc056753eb76f428
BLAKE2b-256 67f013b19bfaebd8376daa9d1aa74659c7ec83de3201385f164b89dc6b44849c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: zenodo_sync-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for zenodo_sync-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 593cc80ab280cd0aab074db7b1222032edef9adb22284d49dcda9a37bfbc162e
MD5 b1403ea7b68c348561d7db426cb7094c
BLAKE2b-256 a53acfc02050d22d5bb92673dd8fd0b947f30658c769a56a1504833f4e012e78

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