Skip to main content

Shared utilities and tooling for the HomericIntelligence ecosystem

Project description

ProjectHephaestus

Shared utilities and tooling for the HomericIntelligence ecosystem, powered by Pixi for environment management.

Overview

ProjectHephaestus provides standardized utility functions and tools that can be shared across all HomericIntelligence repositories. Following the principles in CLAUDE.md, this project emphasizes:

  • Modularity: Well-defined, reusable components
  • Simplicity: KISS (Keep It Simple, Stupid) principle
  • Consistency: Standardized interfaces and patterns
  • Reliability: Comprehensive testing and error handling

Directory Structure

ProjectHephaestus/
├── pixi.toml          # Pixi configuration
├── pyproject.toml     # Python package configuration
├── hephaestus/        # Main package
│   ├── __init__.py
│   ├── utils/         # General utility functions (slugify, retry, subprocess)
│   ├── config/        # Configuration utilities (YAML, JSON, env vars)
│   ├── io/            # I/O utilities (read, write, safe_write, load/save data)
│   ├── cli/           # CLI helpers (argument parsing, output formatting)
│   ├── logging/       # Logging utilities (ContextLogger, setup_logging)
│   ├── system/        # System information collection
│   ├── git/           # Git utilities (changelog generation)
│   ├── github/        # GitHub automation (PR merging)
│   ├── datasets/      # Dataset downloading utilities
│   ├── markdown/      # Markdown linting and link fixing
│   ├── benchmarks/    # Benchmark comparison utilities
│   ├── version/       # Version management
│   └── validation/    # README and config validation
├── tests/             # Unit tests
├── docs/              # Documentation
├── scripts/           # Utility scripts
└── README.md          # This file

Getting Started with Pixi

This project uses Pixi for environment management, which automatically handles dependencies and creates isolated environments.

Prerequisites

Install Pixi by following the official installation guide.

Setup Development Environment

# Install dependencies and create environment
pixi install

# Activate the environment (optional, as pixi runs commands in the environment automatically)
pixi shell

Running Tests

# Run tests using the test feature
pixi run test

# Or run tests directly with pytest
pixi run pytest

Development Commands

# Format code with ruff
pixi run format

# Lint code with ruff
pixi run lint

Usage

As a Package

After installing with Pixi:

from hephaestus import slugify, human_readable_size, retry_with_backoff

# Convert text to URL-friendly slug
project_slug = slugify("My Project Name")
print(project_slug)  # Output: my-project-name

# Convert bytes to human readable size
size_str = human_readable_size(1048576)
print(size_str)  # Output: 1.0 MB

Installing in Another Project

To use ProjectHephaestus in another project with Pixi:

  1. Add it as a dependency in your pixi.toml:

    [pypi-dependencies]
    hephaestus = { path = "../ProjectHephaestus", editable = true }
    
  2. Run pixi install to install the dependency

Or install directly with pip:

pip install -e /path/to/ProjectHephaestus

Key Features

General Utilities (hephaestus.utils)

  • slugify(text): Convert text to URL-friendly slug
  • retry_with_backoff(func): Decorator for exponential backoff retries
  • human_readable_size(bytes): Convert bytes to human readable format
  • flatten_dict(dict): Flatten nested dictionaries
  • run_subprocess(cmd): Execute shell commands with error handling
  • get_setting(config, key_path): Get nested dict values with dot notation

Configuration (hephaestus.config)

  • load_config(path): Load YAML or JSON configuration files
  • get_setting(config, key_path): Dot-notation config access
  • merge_configs(*configs): Deep-merge multiple configuration dicts
  • merge_with_env(config, prefix): Overlay environment variables onto config

I/O Utilities (hephaestus.io)

  • read_file(path) / write_file(path, content): Simple file I/O
  • load_data(path) / save_data(path, data): Structured data (JSON/YAML)

CLI Commands

Four command-line tools are installed as console scripts when you install the package:

Command Description
hephaestus-changelog Generate a changelog from Git history
hephaestus-merge-prs Automate merging of GitHub pull requests
hephaestus-system-info Collect and display system/environment information
hephaestus-download-dataset Download datasets with retry and progress reporting

Examples

# Generate changelog
hephaestus-changelog --help

# Collect system info (JSON output)
hephaestus-system-info --json

# Collect system info without tool version checks
hephaestus-system-info --no-tools

# Download a dataset
hephaestus-download-dataset --help

# Merge open PRs
hephaestus-merge-prs --help

Development Guidelines

  1. Follow the principles in CLAUDE.md
  2. Write comprehensive unit tests for all new functionality
  3. Document all public functions with Google-style docstrings
  4. Use type hints for all function parameters and return values
  5. Keep functions small and focused (single responsibility principle)

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Pixi Environments

This project defines multiple environments in pixi.toml:

  • default: Basic runtime environment
  • dev: Development environment with linting and formatting tools
  • lint: Linting-only environment

Switch environments with:

pixi shell -e dev
pixi shell -e lint

Adding New Dependencies

Add new dependencies to pixi.toml:

For conda packages:

[dependencies]
numpy = "*"

For PyPI packages:

[pypi-dependencies]
requests = "*"

Then run:

pixi install

License

BSD 3-Clause License - see LICENSE file for details.

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

homericintelligence_hephaestus-0.4.0.tar.gz (157.8 kB view details)

Uploaded Source

Built Distribution

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

homericintelligence_hephaestus-0.4.0-py3-none-any.whl (59.9 kB view details)

Uploaded Python 3

File details

Details for the file homericintelligence_hephaestus-0.4.0.tar.gz.

File metadata

File hashes

Hashes for homericintelligence_hephaestus-0.4.0.tar.gz
Algorithm Hash digest
SHA256 9e7d8e0ff8201d2e32aa40d69e827fd3f86b206189bb32c11f59fa3d980e6997
MD5 74ceed48d6c5015c95be39be8a166b44
BLAKE2b-256 b1f473e16f8767bb68a3a10ad6e65c4f65261afe9ad44a250979acaf3e6517c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for homericintelligence_hephaestus-0.4.0.tar.gz:

Publisher: release.yml on HomericIntelligence/ProjectHephaestus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file homericintelligence_hephaestus-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for homericintelligence_hephaestus-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 85eb021f783b998275ca5c913ab9597cae767071676e16dc9d6fc74340cf5747
MD5 856f979f8339be8a35a6a7ae00d728db
BLAKE2b-256 3262e3a819dce447a762d580f38cfad8aa917a321695c3c49afc2c15e474298a

See more details on using hashes here.

Provenance

The following attestation bundles were made for homericintelligence_hephaestus-0.4.0-py3-none-any.whl:

Publisher: release.yml on HomericIntelligence/ProjectHephaestus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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