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
Metadata
Release files for cocopack 0.1.1
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 |
|---|---|---|---|---|
| cocopack-0.1.1.tar.gz | 45.1 kB | Without provenance | Details for cocopack-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cocopack-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for cocopack-0.1.1-py3-none-any.whl |
Total release size: 96.3 kB
Release files / cocopack-0.1.1.tar.gz
| Download URL | cocopack-0.1.1.tar.gz |
|---|---|
| Size | 45.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b38af62a2e66795d8e988437a217be2127f9b0feff4d370cbfba5103b00a18e0
|
|
BLAKE2b-256 checksum How to use checksums |
e017287e31bb6b9e52ff1ee47734b8f9fe828e4eafdfa532c755fe5e607be0cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / cocopack-0.1.1-py3-none-any.whl
| Download URL | cocopack-0.1.1-py3-none-any.whl |
|---|---|
| Size | 51.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6b53c38281605c464b188da47e4c1578edadc17532bdcb046e4c30c4698a21fa
|
|
BLAKE2b-256 checksum How to use checksums |
73f5e60b654c1bbc5655b04dbaac318163a7d6f66f79960592c39f997e0ee2af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Security for cocopack 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.