Comprehensive Python package utilities for creation, snapshotting, and lifecycle management
Project description
๐ฆ pkgmngr
A powerful CLI utility that streamlines the entire Python package lifecycle - from creation to publication. Built for modern Python development workflows, pkgmngr helps you create, document, manage, and share Python packages efficiently.
Why pkgmngr?
Python package management involves repetitive and often tedious steps: setting up project structure, maintaining documentation, syncing with GitHub, handling version changes, publishing to PyPI, and more.
pkgmngr addresses these challenges with a streamlined workflow:
- Save Time: Automate repetitive setup and maintenance tasks
- Standardize Structure: Ensure consistent package layout across projects
- Document Easily: Create comprehensive markdown snapshots for documentation and context sharing
- Collaborate Better: Perfect for sharing code context with AI assistants and collaborators
- Manage Lifecycle: Seamlessly handle package renaming, version updates, and publication
๐ ๏ธ Installation
# Install from PyPI
pip install pkgmngr
# Or install from source
git clone https://github.com/B4PT0R/pkgmngr.git
cd pkgmngr
pip install -e .
๐ Quick Start
# Install from PyPI
pip install pkgmngr
# Create a new package
pkgmngr new my-package
cd my-package
# Generate the package files
pkgmngr create
# Initialize Git and GitHub repositories (requires GITHUB_TOKEN)
pkgmngr init-repo
# Make some changes to your code...
# Take a snapshot of your project
pkgmngr snapshot -m "Initial implementation"
# Push changes to GitHub
pkgmngr push
# Publish to PyPI when ready
pkgmngr publish
โจ Features
๐ Package Creation
With a single command, pkgmngr creates a standardized Python package structure:
# Create a new package directory with config file
pkgmngr new my-package
# Edit the generated config file (optional)
cd my-package
nano pkgmngr.toml
# Generate the package structure
pkgmngr create
This creates a complete package structure with:
- Python module files with proper imports
- tests directory with pytest setup
- setup.py and pyproject.toml with appropriate metadata
- README.md, LICENSE, and other standard files
- .gitignore with sensible defaults
๐ธ Package Snapshots
Create comprehensive code documentation snapshots with a single command:
# Create a snapshot with an optional comment
pkgmngr snapshot -m "Implemented core features"
# List all available snapshots
pkgmngr snapshot -l
Snapshots include:
- Visual directory structure with file type icons
- Navigable table of contents
- All file contents with proper syntax highlighting
- Metadata and comments
These snapshots are perfect for:
- Sharing code context with AI assistants
- Documenting code for team members
- Creating restoration points
- Providing self-contained project documentation
๐ Package Lifecycle Management
Rename Packages
Easily rename your package and automatically update all references:
# Rename a package (updates all references and directory structure)
pkgmngr rename new-package-name
This updates the package directory name, all references in your code, and even renames the GitHub repository if available.
Global Search & Replace
Safely perform search and replace operations across your entire codebase:
# Replace text across all files
pkgmngr replace "old_text" "new_text"
# Use regular expressions
pkgmngr replace --regex "function\s+old_name" "function new_name"
Includes preview mode, automatic backups, and selective file targeting for safety.
GitHub Integration
Seamlessly integrate with GitHub:
# Initialize Git and create GitHub repository
pkgmngr init-repo
# Push changes with an interactive commit message
pkgmngr push
PyPI Publishing
Publish your package with automatic version increments:
# Publish to TestPyPI for testing
pkgmngr publish --test
# Publish to PyPI with automatic version increment
pkgmngr publish
# Publish with specific version increment
pkgmngr publish --bump minor
๐ Detailed Usage Guide
Creating a New Package
# Create a new package
pkgmngr new my-package
cd my-package
This creates a directory with a pkgmngr.toml configuration file that lets you customize:
- Package metadata (name, version, author, etc.)
- GitHub integration settings
- Python version requirements
- Dependencies and development dependencies
After editing the config (if desired), generate the package structure:
pkgmngr create
This creates a complete package structure:
./
โโโ my_package/
โ โโโ __init__.py
โ โโโ __main__.py
โโโ tests/
โ โโโ test_my_package.py
โ โโโ run_tests.py
โโโ setup.py
โโโ README.md
โโโ MANIFEST.in
โโโ pyproject.toml
โโโ LICENSE
โโโ .gitignore
Taking and Restoring Snapshots
Creating Snapshots
# Create a snapshot with a comment
pkgmngr snapshot -m "Implemented core features"
Snapshots are saved as markdown files in a snapshots directory, containing:
- Pretty-printed directory tree
- Table of contents with links to each file
- Full file contents with syntax highlighting
- Metadata about the snapshot
Restoring from Snapshots
# Restore from a specific snapshot (by number)
pkgmngr restore 1
# Interactively select files to restore
pkgmngr restore -i
# Restore only Python files
pkgmngr restore -p "*.py"
# Exclude certain files
pkgmngr restore -e "temp_*.py"
Restoration modes:
safe: Skips existing filesoverwrite: Replaces existing files (default)force: Replaces all files, including read-only
GitHub Integration
To use GitHub integration, set up a GitHub Personal Access Token:
- Go to GitHub โ Settings โ Developer settings โ Personal access tokens โ Tokens (classic)
- Generate a new token with the
reposcope - Set it as an environment variable:
export GITHUB_TOKEN=your_token_here
Initialize Git and create a GitHub repository:
pkgmngr init-repo
Push changes to GitHub:
pkgmngr push
PyPI Publishing
Before publishing, ensure you have configured your PyPI credentials using one of these methods:
- A
.pypircfile in your home directory - Environment variables:
TWINE_USERNAMEandTWINE_PASSWORD - API tokens (recommended for security)
Publishing commands:
# Publish to TestPyPI
pkgmngr publish --test
# Publish to PyPI with automatic patch version increment
pkgmngr publish
# Publish with a specific version increment type
pkgmngr publish --bump minor
Package-wide Text Replacement
The replace command provides a safe way to perform global find/replace operations:
# Basic replacement
pkgmngr replace "old_text" "new_text"
# Advanced options
pkgmngr replace "old_api" "new_api" --pattern "*.py" --regex --case-insensitive
Safety features:
- Automatic backup snapshot before changes
- Preview of changes with file diffs
- Confirmation prompt before applying changes
- Filtering by file patterns and exclusions
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgements
This project is almost entirely coded by Claude 3.7 following my general outlines. As it began to be functional, pkgmngr was itself used to facilitate the process: take a snapshot, give it to Claude, suggest changes, Claude does the changes and updates tests, copy/paste to the actual codebase, run tests, push to github, publish once in a while, repeat...
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 pkgmngr-0.1.7.tar.gz.
File metadata
- Download URL: pkgmngr-0.1.7.tar.gz
- Upload date:
- Size: 59.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31e2984a1aa9985033e8755e780910498a5e108155ebd74881d73aab4b75dbc6
|
|
| MD5 |
a66720d2bb0662d6b5f0787b1455d25c
|
|
| BLAKE2b-256 |
f9a19a0b83c1607b73ac5261a05254e053083797c5def1f1b8e0f8a129dd9d63
|
File details
Details for the file pkgmngr-0.1.7-py3-none-any.whl.
File metadata
- Download URL: pkgmngr-0.1.7-py3-none-any.whl
- Upload date:
- Size: 70.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d674987b396d4a7d0ef6088bfeb33794f62f65de47ecef016b40676dbc0ad146
|
|
| MD5 |
f0c7487bf07d68bd5c5161fc7cabd52b
|
|
| BLAKE2b-256 |
a1da8f1ca3379e69784360f88aa7a0a96c21cf9b0f615334123d3d7f79d9e116
|