Skip to content

Conversation

@PengPengPeng717
Copy link

Summary

This PR extends llpkgstore to support Python packages in addition to the existing C/C++ package functionality. The implementation adds a new pip installer and Python package generator while maintaining full backward compatibility with existing C/C++ packages. Command-level separation between Python and C++ implementations for better maintainability and clear separation of concerns.

Changes Made

New Features

  • pip installer: Added complete pip package manager support (upstream/installer/pip/pip.go)
    • Package installation via pip3 install --target
    • Package search functionality
    • Python-specific configuration handling
  • Python package generator: Added llpyg generator (internal/actions/generator/llpyg/)
    • Python package configuration file processing
    • Symbol file handling for Python packages
    • Go version locking and Python environment setup

Command-Level Architecture

  • Automatic package type detection: Main entry point automatically detects package type from llpkg.cfg
  • Separate command implementations:
    • cmd/llpkgstore/internal_python/ - Python-specific commands
    • cmd/llpkgstore/internal_cpp/ - C++-specific commands
  • Type-based routing: Main function routes to appropriate implementation based on detected package type

Configuration Enhancements

  • Extended LLPkgConfig struct with optional Type field to distinguish Python packages from C/C++ packages
  • Added "pip" to ValidInstallers list alongside existing "conan"
  • Enhanced NewUpstreamFromConfig function to handle pip installer creation
  • Added WithPipSerializer() function to cmdbuilder for pip command serialization

Command Differences

Command Python Implementation C++ Implementation
generate Uses llpyg generator, no conan profile detection Uses llcppg generator, requires conan profile
install Python-specific messaging, pip-focused help Generic package installation
test Python package verification C++ package verification
release Python-specific release process C++-specific release process

Backward Compatibility

  • All existing C/C++ package functionality remains unchanged
  • Existing configuration files continue to work without modification
  • No breaking changes to existing APIs or interfaces
  • Default behavior: C++ packages when no type specified

Technical Details

  • Package type detection: Reads llpkg.cfg and checks Type field
    • "type": "python" → Python implementation
    • "type": "cpp" or empty → C++ implementation
  • Command routing: Main function calls appropriate Execute() method
  • Environment setup: Python version sets PYTHONPATH, C++ version sets conan profile
  • Error handling: Clear error messages for unsupported package types

Example Usage

# Python package (detected automatically)
$ llpkgstore generate  # Uses Python implementation
$ llpkgstore install llpkg.cfg  # Python-specific install

# C++ package (detected automatically)  
$ llpkgstore generate  # Uses C++ implementation
$ llpkgstore install llpkg.cfg  # C++-specific install

Example Configuration

{
  "type": "python",
  "upstream": {
    "installer": {
      "name": "pip",
      "config": {
        "options": "--no-deps"
      }
    },
    "package": {
      "name": "numpy",
      "version": "1.24.0"
    }
  }
}

This enhancement makes llpkgstore a more comprehensive package management solution, supporting both C/C++ and Python ecosystems while maintaining clean architecture and full backward compatibility.

@PengPengPeng717
Copy link
Author

Version Management TODO

Current Issue

The version management system currently uses hardcoded versions (e.g., v0.0.1) which is not ideal for production use. This needs to be improved to support proper semantic versioning and dynamic version management.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant