Programmatic toolkits for Python and shell scripting
Project description
CocoPack 
Programmatic toolkits for Python, R, and shell scripting. CocoPack (inspired by R's Hmisc package) provides a somewhat random collection of utilities to streamline development workflows that I (a computational cognitive scientist) tend to use in many of my projects.
Caveat Emptor: The core functionality of this codebase is (largely) human-built and (entirely) human-tested. However, much of the documentation and supporting infrastructure (e.g. installation instructions) has been generated with ample help from Claude AI. Please use with caution.
Functionality Status:
- Python
- Shell
- R Pack
Documentation and source code for the R package may be found at colinconwell.github.io/Coco-Pack-R
Quick-Start
Python Package
pip install cocopack
R Package
if (!require(pacman)) {install.packages("pacman")}
pacman::p_load_gh("colinconwell/Coco-Pack-R")
Shell Commands
pip install "cocopack[shell]"
Shell scripts are installed automatically, but if needed, you can reinstall the shell script wrappers with:
cocopack-install
Python + Shell
Install everything:
pip install "cocopack[shell]"
After installation, shell commands are available in two formats:
# Use shell commands directly
path-cleanup --remove-duplicates --apply
color-wrap RED "This text will be red!"
# Or use through the cocopack namespace
cocopack ezshell path_cleanup --remove-duplicates --apply
cocopack colorcode
Python Package Only
Install just the Python utilities:
pip install cocopack
This also installs both direct and namespaced shell commands, but doesn't emphasize the shell functionality.
Uninstallation
Remove everything:
# First, clean up shell script wrappers
cocopack uninstall-scripts
# Then uninstall the Python package
pip uninstall cocopack
This will remove both Python and shell components. You should also remove any references to cocopack commands from your .bashrc or .zshrc.
Note: When you run pip uninstall cocopack, the package will attempt to automatically clean up shell script wrappers, but it's recommended to run the explicit uninstall command first to ensure all wrappers are properly removed.
R Package (CocoPack-R)
Standalone Package:
The cocopack R package is available at CocoPack-R.
You can install this package by running the following command:
if (!require(pacman)) {install.packages("pacman")}
pacman::p_load_gh("colinconwell/CocoPack-R")
Common Workflows
Dev Environment Setup
- Set up your shell environment:
# Add to .bashrc or .zshrc
eval "$(cocopack prompt)" # Load prompt utilities
eval "$(cocopack ezshell)" # Load shell utilities
# Configure custom prompt
PS1='$(conda_prompt green) %F{cyan}%n@%m%f $(custom_path) %# '
- Configure Jupyter environment:
from cocopack.notebook import stylizer, magics
# Apply IDE-specific styling
stylizer.auto_style()
# Enable auto-reload for development
magics.set_autoreload('complete')
Path Management
# Clean up PATH environment variable
path_cleanup --remove-duplicates --remove-empties --apply
Other Notes & Details
Installation Options Explained
-
Standard Installation (
pip install cocopack):- Installs the Python package with all commands available
- Both namespaced commands (e.g.,
cocopack colorcode RED "text") and direct commands (e.g.,color-wrap RED "text") are available
-
Shell Installation (
pip install "cocopack[shell]"):- Same as standard installation but emphasizes shell functionality
- All commands are available in both namespaced and direct forms
Presentation & Figure Support
The Python package includes presentation to image/PDF conversion functionality via the figure_ops module:
-
Unified interface for both PowerPoint and Keynote presentations:
- Automatically detects file type (.key, .ppt, .pptx)
- Platform-specific implementations for optimal results
-
Platform-specific exports:
- macOS: Uses AppleScript for both Keynote and PowerPoint
- Windows: Uses COM interface (via pywin32) for PowerPoint
- Linux/Other: Uses LibreOffice CLI with python-pptx as fallback
-
Image processing tools:
- Cropping whitespace around images
- Adding customizable margins
- Converting to high-quality PDFs
Example usage:
from cocopack.figure_ops import slides_to_images, convert_images_to_pdf
# Convert any presentation to PNGs and crop whitespace
slides_to_images('presentation.pptx', 'output_folder', crop_images=True)
# Convert to PDFs
convert_images_to_pdf('output_folder')
Note: Keynote is available exclusively on macOS. Windows users will need to install pywin32 separately if they want to use the Windows-specific COM automation:
pip install pywin32
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 cocopack-0.1.1.tar.gz.
File metadata
- Download URL: cocopack-0.1.1.tar.gz
- Upload date:
- Size: 45.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b38af62a2e66795d8e988437a217be2127f9b0feff4d370cbfba5103b00a18e0
|
|
| MD5 |
c7c76ea5ce7ac60394c38146dd777ff3
|
|
| BLAKE2b-256 |
e017287e31bb6b9e52ff1ee47734b8f9fe828e4eafdfa532c755fe5e607be0cf
|
File details
Details for the file cocopack-0.1.1-py3-none-any.whl.
File metadata
- Download URL: cocopack-0.1.1-py3-none-any.whl
- Upload date:
- Size: 51.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b53c38281605c464b188da47e4c1578edadc17532bdcb046e4c30c4698a21fa
|
|
| MD5 |
2833cc35cf4ae9537160bca3e413cf0c
|
|
| BLAKE2b-256 |
73f5e60b654c1bbc5655b04dbaac318163a7d6f66f79960592c39f997e0ee2af
|