Cross-platform, modular, quality-of-life tool kit for working with Jupyter notebooks
Project description
NB-QOL
Cross-platform, modular, quality-of-life tool kit for working with Jupyter notebooks wherever you work with them.
Features
- CUDA Device Management: Easily configure, monitor, and select CUDA devices for your notebook
- Output Capture: Capture stdout, stderr, and logging in a clean, organized way
- Path Operations: Utilities for working with notebook paths and Git repositories
- IPython Configuration: Quickly configure IPython settings like autoreload
- Notebook Styling: Auto-detect environment and apply appropriate CSS styling (VS Code, Jupyter Lab, etc.)
- Notebook Processing: Convert, clean, analyze, and execute notebooks programmatically
- Environment Detection: Detect notebook execution environment (VS Code, Jupyter, etc.)
Installation
From PyPI:
pip install nbqol
Latest development version:
pip install git+https://github.com/ColinConwell/NB-QOL.git
Quick Start
Here are some examples of what you can do with NB-QOL:
# Import the library
import nbqol
# Configure IPython
nbqol.set_autoreload('complete') # Auto-reload modules
nbqol.hide_warnings() # Hide warning messages
# Get environment settings
env_info = nbqol.get_main_env_settings()
# Manage CUDA devices
nbqol.count_cuda_devices() # Count available CUDA devices
nbqol.cuda_device_report() # Get detailed info about CUDA devices
nbqol.set_cuda_visibles(0) # Make only device 0 visible
# Path operations
notebook_dir = nbqol.notebook_path()
git_root = nbqol.path_to_git_root()
# Capture output
with nbqol.capture_output() as captured:
print("This will be captured")
import logging
logging.warning("This warning will be captured")
print(captured)
# Apply styling
nbqol.auto_style() # Apply appropriate styling based on environment
Command Line Interface
NB-QOL also provides a command-line interface for common tasks:
# Show version
nbqol --version
# Show help
nbqol --help
# Get CUDA device information
nbqol device-info
# Apply styling to current environment
nbqol style
Documentation
For full documentation, visit docs/build/html/index.html after building the documentation:
# Recommended approach (includes tests)
./scripts/build_docs.sh
# Alternative approaches
cd docs && hatch run docs:build
cd docs && make html
cd docs && sphinx-build -b html source build/html
The build_docs.sh script runs tests to verify the package installation and documentation build before generating the HTML docs.
Development
# Clone the repository
git clone https://github.com/ColinConwell/NB-QOL.git
cd NB-QOL
# Install in development mode
pip install -e .
# Install development dependencies
pip install -e .[dev]
# Run tests
pytest tests/
# Install documentation dependencies
pip install -e .[docs]
# Build documentation
cd docs && sphinx-build -b html source build/html
Other Resources
Related Tools
- nbdime - A tool from the Jupyter team for comparing and diffing Jupyter notebooks.
- nb-clean - A tool for cleaning and compression Jupyter notebooks in GitHub and other version control systems.
- nbstripout - A tool for stripping output from Jupyter notebooks for compression or presentation purposes.
Dependency Source Repos
License
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nbqol-0.1.1.tar.gz.
File metadata
- Download URL: nbqol-0.1.1.tar.gz
- Upload date:
- Size: 70.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d37e3e13a3860aac34ff763adcda44a300a9bfc2f695f9faa32d3803d110bda7
|
|
| MD5 |
5027f1bf23828e7b75f141cac2639fd5
|
|
| BLAKE2b-256 |
6ec9bd1c40f6bfa9b6883f87a450831923f2a8de0ce15313e5fb939295a4e426
|
File details
Details for the file nbqol-0.1.1-py3-none-any.whl.
File metadata
- Download URL: nbqol-0.1.1-py3-none-any.whl
- Upload date:
- Size: 40.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d1e2176c86dc05d7f2aa79d06baba953f2fe009cc7b0f74227bfd3af076e7be
|
|
| MD5 |
458f8454aa49f74f2c48ad271307fb0a
|
|
| BLAKE2b-256 |
dfa40970dc323e46c3763889ab9250dbd45a042e9d2e05e7a970177f9ac3b9e4
|