🧰 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
- Go to the GitHub Actions tab
- Select "Release and Publish" workflow
- Click "Run workflow"
- 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)
- Click "Run workflow"
What happens automatically:
- ✅ Version bumped in
pyproject.tomland__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
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests (
./run_tests.shormake test) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
🧪 Testing
Running Tests Locally
# Install test dependencies
pip install -e .[test]
# Run all tests with coverage
./run_tests.sh
# Or use pytest directly
pytest tests/ --cov=tsilva_notebook_utils --cov-report=term-missing -v
# Run specific test file
pytest tests/test_gymnasium.py -v
# Run tests for specific class
pytest tests/test_gymnasium.py::TestSyncRolloutCollector -v
Test Structure
The test suite includes:
- Unit tests for individual functions and classes
- Integration tests for complex workflows
- Coverage reporting to ensure code quality
- Linting checks with flake8, black, and isort
Tests are automatically run on:
- Every push to
mainanddevelopbranches - Every pull request
- Multiple Python versions (3.9, 3.10, 3.11, 3.12)
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.
Metadata
Release files for tsilva-notebook-utils 0.0.124
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tsilva_notebook_utils-0.0.124.tar.gz | 48.1 kB | With provenance | Details for tsilva_notebook_utils-0.0.124.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tsilva_notebook_utils-0.0.124-py3-none-any.whl | Python 3 | none | any | Details for tsilva_notebook_utils-0.0.124-py3-none-any.whl |
Total release size: 85.1 kB
Release files / tsilva_notebook_utils-0.0.124.tar.gz
| Download URL | tsilva_notebook_utils-0.0.124.tar.gz |
|---|---|
| Size | 48.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
57a21b4ca15a08d557a4c2dca63cefa8f24a564b9604c07f22aedb7e3bf78b28
|
|
BLAKE2b-256 checksum How to use checksums |
a6fc71eefd1842e5ad22d314c0208a246d769234e12c4626fe18a589767407f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 16, 2025.
Transparency logRelease files / tsilva_notebook_utils-0.0.124-py3-none-any.whl
| Download URL | tsilva_notebook_utils-0.0.124-py3-none-any.whl |
|---|---|
| Size | 37.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e2c2abe2e605cf62075d4bcf07b8cdae61aa5cbc293da48a40ccf91336d47354
|
|
BLAKE2b-256 checksum How to use checksums |
ef1e8249fc366de83637d336964a08ef312ead460173eccb9ae2bb6444697af0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 16, 2025.
Transparency logSecurity for tsilva-notebook-utils 0.0.124
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for tsilva_notebook_utils-0.0.124.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 16, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.