Skip to content

Conversation

@AmeenP
Copy link
Contributor

@AmeenP AmeenP commented Sep 30, 2025

Summary

This PR adds automatic entry point management to the prime env push command, enabling proper namespace-aware environment loading via Python entry points.

Changes

Prime CLI

  • New flags:

    • --add-entry-point: Automatically add missing [project.entry-points.verifiers] entry
    • --entry-point-target MODULE[:ATTR]: Specify custom target (default: load_environment)
  • Entry point enforcement:

    • Resolves environment early to determine owner/name for entry point key
    • Enforces exactly ONE entry point matching "owner/name" = "module:load_environment"
    • Auto-guesses target from project structure (checks for matching package dir or module file)
    • Provides clear error messages for multiple/mismatched entry points

Testing

  • ✓ Correct single entry point validation
  • ✓ Multiple entry points rejected with clear error
  • ✓ Wrong entry point rejected with clear error
  • ✓ Auto-add works when entry point missing
  • ✓ Error shown when entry point missing and no auto-add
  • ✓ Explicit targets work (with and without colon)
  • ✓ Entry point guessing logic works correctly

Example Usage

# Auto-add entry point and push
cd /path/to/my-env
prime env push --add-entry-point

# Specify custom target
prime env push --add-entry-point --entry-point-target my_module:custom_loader

# Without auto-add (will error if missing)
prime env push  # Error with helpful message

Related

Companion PR for verifiers repo with entry point loading support coming next.

- Add --add-entry-point flag to automatically add missing entry points
- Add --entry-point-target to specify custom MODULE[:ATTR] targets
- Enforce exactly one entry point matching owner/name format
- Resolve environment early to determine owner for entry point key
- Auto-guess entry point target from project structure
- Provide clear error messages for multiple/mismatched entry points
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.

2 participants