A Python library for managing UHM Ocean BGC Group Dropbox paths in your research code.
When working with shared Dropbox folders in a research group, hardcoding paths can lead to:
- Code that breaks when folder structures change
- Non-portable scripts that don't work on colleagues' machines
- Difficult-to-maintain codebases with scattered path definitions
mydropbox centralizes all your common Dropbox paths in one place, making your code cleaner and more maintainable.
# Install directly from GitHub
pip install git+https://github.com/raphaelbajon/mydropbox.git
# Or clone and install
git clone https://github.com/raphaelbajon/mydropbox.git
cd mydropbox
pip install -e .from mydropbox import get_dropbox
# Initialize with your personal folder name
db = get_dropbox(personal_folder="Your Name")
# Access your personal folders
data_file = db.personal.datasets / "my_ocean_data.nc"
code_dir = db.personal.mycode / "analysis_scripts"
paper_draft = db.personal.papers / "carbon_cycle_2026.docx"
# Access group folders (works without personal_folder too)
group_data = db.group.datasets / "shared_observations.nc"
meeting_notes = db.group.group_notes / "2026-01-meeting.md"Option 1: Direct specification (simplest)
from mydropbox import get_dropbox
db = get_dropbox(personal_folder="Raphaël Bajon")Option 2: Using a config file (recommended for privacy)
# 1. Copy mydropbox_config_template.py to mydropbox_config.py
# 2. Edit mydropbox_config.py and set your name
from config.mydropbox_config import PERSONAL_FOLDER
from mydropbox import get_dropbox
db = get_dropbox(personal_folder=PERSONAL_FOLDER)Option 3: Group access only (no personal paths)
from mydropbox import dropbox
# Only group paths are available
shared_data = dropbox.group.datasets / "observations.nc"
# dropbox.personal is NoneThe library uses Python's pathlib.Path objects, which are more powerful than strings:
# Read a file
readme = (dropbox.personal.projects / "README.md").read_text()
# Create subdirectories
new_project = dropbox.personal.projects / "new_analysis"
new_project.mkdir(exist_ok=True)If your Dropbox is in a non-standard location:
from mydropbox import get_dropbox
db = get_dropbox("/custom/path/to/UHM_Ocean_BGC_Group Dropbox")
print(db.personal.datasets)admin- Administrative documentsdatasets- Your personal datasetsmeeting- Meeting notes and agendasmycode- Your code repositorypapers- Research papers and manuscriptsphd- PhD-related materialsprojects- Research projectsslides- Presentation slidessoc_tools- Southern Ocean Carbon toolsteam- Team collaboration filesutils- Utility scripts and tools
assorted_content- Miscellaneous shared contentcollaborative_projects- Group collaborative projectsdatasets- Shared group datasetsgroup_notes- Group meeting notes and documentationlab_field_data- Laboratory and field dataocean_reports- Ocean observation reports
😏 MyDropbox includes a powerful project management module to create standardized research project structures. See the Projects Guide for all the explanations of this feature!
from mydropbox import get_dropbox, create_project
# Initialize
db = get_dropbox(personal_folder="Your Name")
# Create a new project with standardized structure
project = create_project(
base_path=db.personal.projects,
name="Project_01",
template="full", # or "simple" or "minimal"
description="Description of Project_01",
author="Your Name"
)
# Use the project structure to access your paths within your project in a few words!
project.data.raw # raw data
project.data.processed # processed data
project.notebooks # notebooks
project.src # source code
project.plots.explanatory # explanatory figures
project.plots.publication # figures for publication
# and many more..Projects follow data science best practices with:
- data/ - Raw, interim, and processed data (separate folders)
- src/ - Reusable source code (data, features, models, visualization)
- notebooks/ - Jupyter notebooks for exploration
- plots/ - Exploratory and publication-ready figures
- docs/ - Documentation
- reports/ - Generated reports
- results/ - Model outputs and predictions
- config/ - Configuration files
Auto-generated files:
README.md- Project documentation template.gitignore- Configured for data science (excludes large data files)project_metadata.json- Automated metadata tracking
For detailed project management documentation, see PROJECTS_GUIDE.md
from mydropbox import get_dropbox
import xarray as xr
import matplotlib.pyplot as plt
# Initialize with your personal folder
db = get_dropbox(personal_folder="Your Name")
# Load data
ds = xr.open_dataset(db.personal.datasets / "soc_carbon_flux.nc")
# Analyze
flux_mean = ds.carbon_flux.mean(dim='time')
# Save figure
fig_path = db.personal.projects / "flux_analysis" / "mean_flux.png"
fig_path.parent.mkdir(exist_ok=True)
plt.figure()
flux_mean.plot()
plt.savefig(fig_path)
print(f"Figure saved to {fig_path}")from mydropbox import get_dropbox
# Initialize once at the top of your script
db = get_dropbox(personal_folder="Your Name")
# Create a consistent project structure
project_name = "antarctic_upwelling_2026"
project_dir = db.personal.projects / project_name
# Create subdirectories
(project_dir / "data").mkdir(parents=True, exist_ok=True)
(project_dir / "figures").mkdir(exist_ok=True)
(project_dir / "notebooks").mkdir(exist_ok=True)
(project_dir / "scripts").mkdir(exist_ok=True)
print(f"Project structure created at {project_dir}")You can easily share code with collaborators!
- Use Path objects: They handle cross-platform differences automatically
- Check existence: Always verify files exist before opening them
- Create directories: Use
path.mkdir(parents=True, exist_ok=True)to avoid errors - Relative paths: Build paths dynamically for maximum flexibility
You can easily add new paths or helper functions:
# In mydropbox/__init__.py
class PersonalPaths:
def __init__(self, base_path: Path):
self.base = base_path
# Add your new paths here
self.new_folder = self.base / "new_folder_name"MIT License - Feel free to modify for your research needs.
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
To contribute:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
See CHANGELOG.md for version history and changes.
- Issues: Open an issue on GitHub
- Group discussions: Bring it up in lab meetings
- Questions: Check the examples or documentation
Developed for the UHM Ocean BGC Group for Southern Ocean Carbon cycle research.
Current Version: 0.1.0
Last Updated: January 28, 2026