Skip to main content

Python package for garbage collection utilities and memory management

Project description

glon

Git Clone utility - Clone repositories to organized directory structure.

Overview

The glon package provides a convenient CLI tool for cloning git repositories to an organized directory structure, as well as listing and managing your cloned projects.

Features

  • Easy Cloning: Clone git repositories with a single command
  • Clipboard Integration: Clone directly from clipboard URLs
  • Grab from Clipboard: Grab paths from clipboard (git URLs or local paths)
  • List Projects: List all cloned projects with time-based filtering
  • Organized Structure: Projects organized by owner/repo structure

Installation

pip install glon

Development Installation

git clone https://github.com/tom-sapletta/glon.git
cd glon
pip install -e ".[dev]"

Quick Start

Clone a Repository

# Clone using git URL
glon https://github.com/owner/repo.git

# Or clone from clipboard (copies URL to clipboard first)
glon

Grab from Clipboard

The grab command reads a path from clipboard and processes it:

# Grab from clipboard - detects if it's a git URL or local path
glon grab

# With options
glon grab --base-path ~/projects
glon grab --dry-run
glon grab --verbose

List Projects

List all cloned projects in your base directory:

# List all projects
glon list
glon ls

# Filter by time
glon list "last week"
glon list "last month"
glon list "last year"
glon list 30  # last 30 days

# Verbose output with full paths
glon list --verbose
glon ls -v

CLI Commands

Clone

Clone a git repository to the organized directory structure (default: ~/github):

glon <git-url>              # Clone from URL
glon clone <git-url>        # Same as above (explicit)
glon --dry-run <url>        # Show what would be done
glon --base-path ~/my-projects <url>  # Custom base path

Grab

Grab a path from clipboard:

glon grab                   # Read from clipboard and process
glon grab --verbose         # Show detailed output
glon grab --dry-run         # Preview without executing
glon grab --base-path ~/my-projects  # Custom output path

List (or LS)

List all cloned projects:

glon list                   # List all projects
glon ls                     # Short alias
glon list "last week"       # Projects modified last week
glon list "last month"      # Projects modified last month
glon list "last year"       # Projects modified last year
glon list 30                # Projects modified last 30 days
glon list --verbose         # Show full paths and details
glon ls -v                  # Verbose output
glon list --base-path ~/my-projects  # Custom base path

API Reference

GarbageCollector

Main class for garbage collection control and monitoring.

Methods

  • enable() - Enable garbage collection
  • disable() - Disable garbage collection
  • collect(generation=2) - Force garbage collection
  • get_stats() - Get garbage collection statistics
  • get_memory_summary() - Get comprehensive memory summary

MemoryProfiler

Class for memory profiling and object tracking.

Methods

  • take_snapshot(label="") - Take a memory snapshot
  • track_object(obj, label="") - Track an object with weak reference
  • compare_snapshots(index1, index2) - Compare two memory snapshots
  • get_tracked_objects() - Get information about tracked objects

Utility Functions

  • cleanup_temp_files(pattern="*") - Clean up temporary files
  • monitor_memory_usage(duration=60, interval=1.0) - Monitor memory usage
  • force_garbage_collection(verbose=False) - Force garbage collection on all generations
  • find_object_cycles(obj, max_depth=10) - Find reference cycles
  • analyze_memory_usage() - Comprehensive memory analysis

Requirements

  • Python 3.8+
  • psutil>=5.8.0

Development

Running Tests

pytest

Code Formatting

black glon/

Type Checking

mypy glon/

License

Apache License 2.0 - see LICENSE for details.

Contributing

Contributions are welcome! Please read the CONTRIBUTING.md file for details on our code of conduct and the process for submitting pull requests.

Changelog

0.1.0

  • Initial release
  • Basic garbage collection control
  • Memory profiling capabilities
  • Utility functions for memory management

License

Apache License 2.0 - see LICENSE for details.

Author

Created by Tom Sapletta - tom@sapletta.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

glon-0.1.15.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

glon-0.1.15-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file glon-0.1.15.tar.gz.

File metadata

  • Download URL: glon-0.1.15.tar.gz
  • Upload date:
  • Size: 22.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for glon-0.1.15.tar.gz
Algorithm Hash digest
SHA256 fb3e36eec284fe5fd35a93f10c2f5de0dff4c70922e14cb3353d240686f460a3
MD5 a7077eddb91c01c3241c2de9504d1d41
BLAKE2b-256 2307d28b1aec95192fec96ec9e11aa6ef8b21c9eadc436cce7d3f95e9f6909e4

See more details on using hashes here.

File details

Details for the file glon-0.1.15-py3-none-any.whl.

File metadata

  • Download URL: glon-0.1.15-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for glon-0.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 58f3c1927bf61a7e8167c391ad89266febc94bf736723c9d1b0367d41aaa40be
MD5 c8ae728a0b12ec56bcf26eb74f901ac9
BLAKE2b-256 820e681f3dfa5e50f342294a80bba043dd4a9a8c0f12e64e3e9ec2dad49b2f08

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page