Skip to main content

Utility functions for Jupyter/Colab notebooks

Project description

🧰 tsilva-notebook-utils

🔬 Handy utilities for enhancing your Jupyter and Google Colab notebooks

📖 Overview

tsilva-notebook-utils is a collection of utility functions designed to make working with Jupyter and Google Colab notebooks more efficient. It provides tools for video rendering, notification systems, and Colab-specific features like automatic disconnection after idle periods.

🛠️ Usage

Video Rendering

from tsilva_notebook_utils import render_video

# Render a simple video from frames
frames = [frame1, frame2, frame3]  # List of numpy arrays
video = render_video(frames, fps=30, scale=1.5)
display(video)

# Render frames with labels
labeled_frames = [(frame1, "Start"), (frame2, "Middle"), (frame3, "End")]
video = render_video(labeled_frames, fps=24)
display(video)

# Compare multiple videos side by side
from tsilva_notebook_utils import render_videos
render_videos([(video1_frames, "Original"), (video2_frames, "Processed")])

Google Colab Utilities

from tsilva_notebook_utils import disconnect_after_timeout

# Automatically disconnect Colab after 5 minutes of inactivity
disconnect_after_timeout(timeout_seconds=300)

Notifications

Send notifications to PopDesk notification server:

from tsilva_notebook_utils import send_popdesk_notification

# Send a notification when your long-running notebook task completes
send_popdesk_notification(
    url="https://your-popdesk-url",
    auth_token="your-auth-token",
    title="Training Complete",
    message="Your model has finished training with 95% accuracy"
)

� Development & Releases

Development Setup

# Clone the repository
git clone https://github.com/tsilva/tsilva-notebook-utils.git
cd tsilva-notebook-utils

# Install in development mode
pip install -e .

# Run tests
python -m pytest tests/

Version Management

This project uses automated version bumping with bump2version. Version numbers are automatically updated across all relevant files.

Local Version Bumping

Use the provided scripts for local development:

# Bump patch version (0.0.115 → 0.0.118)
make bump-patch
# or
python bump_version.py patch

# Bump minor version (0.0.115 → 0.1.0)
make bump-minor
# or
python bump_version.py minor

# Bump major version (0.0.115 → 1.0.0)
make bump-major
# or
python bump_version.py major

Automated Releases

🎯 Recommended: GitHub Actions Release Workflow

  1. Go to the GitHub Actions tab
  2. Select "Release and Publish" workflow
  3. Click "Run workflow"
  4. Choose your release type:
    • patch: Bug fixes (0.0.115 → 0.0.118)
    • minor: New features (0.0.115 → 0.1.0)
    • major: Breaking changes (0.0.115 → 1.0.0)
    • prerelease: Beta versions (0.0.115 → 0.0.118-alpha.1)
  5. Click "Run workflow"

What happens automatically:

  • ✅ Version bumped in pyproject.toml and __init__.py
  • ✅ Git commit created with version bump message
  • ✅ Git tag created (e.g., v0.0.118)
  • ✅ Package built and published to PyPI
  • ✅ GitHub release created with release notes

Manual Release Process

If you prefer manual control:

# 1. Bump version locally
make bump-patch  # or bump-minor, bump-major

# 2. Build the package
make build

# 3. Publish to PyPI (requires PYPI_API_TOKEN)
make publish

Release Notes

Recent releases can be found on the Releases page.

Version History

  • v0.0.115: Current version with automated release workflow
  • v0.0.114: Previous stable version

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run tests (make test)
  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

Available Make Commands

make help          # Show all available commands
make install       # Install package in development mode
make test          # Run tests
make bump-patch    # Bump patch version
make bump-minor    # Bump minor version
make bump-major    # Bump major version
make build         # Build the package
make publish       # Build and publish to PyPI
make clean         # Clean build artifacts

�📄 License

This project is licensed under the MIT License.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tsilva_notebook_utils-0.0.119.tar.gz (36.7 kB view details)

Uploaded Source

Built Distribution

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

tsilva_notebook_utils-0.0.119-py3-none-any.whl (33.6 kB view details)

Uploaded Python 3

File details

Details for the file tsilva_notebook_utils-0.0.119.tar.gz.

File metadata

  • Download URL: tsilva_notebook_utils-0.0.119.tar.gz
  • Upload date:
  • Size: 36.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tsilva_notebook_utils-0.0.119.tar.gz
Algorithm Hash digest
SHA256 0f010112c0ae8ef6b1ab6e3efb01ba8deeeac5cf9f29cb9f2423af0330a880b4
MD5 f35f02df0c8c7c3c0d12fb79dee68801
BLAKE2b-256 c0ccb3021f11d5f5893092e6f05cf920545798e8eb9e50dce8420179cb57eff6

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsilva_notebook_utils-0.0.119.tar.gz:

Publisher: release.yml on tsilva/tsilva-notebook-utils

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tsilva_notebook_utils-0.0.119-py3-none-any.whl.

File metadata

File hashes

Hashes for tsilva_notebook_utils-0.0.119-py3-none-any.whl
Algorithm Hash digest
SHA256 302fc07e82fd60751af21c6d89c3767ed4bf8925f50f85694fcd9cc45ae55172
MD5 6c83c96679765275a3cef1803bc51a46
BLAKE2b-256 1158206acdd3e1e3200cf2f47001f173627da3d0c085c833d02a1216c4b92056

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsilva_notebook_utils-0.0.119-py3-none-any.whl:

Publisher: release.yml on tsilva/tsilva-notebook-utils

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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