Skip to content

Fix versioning, CLI naming, config validation, and dependency consistency#27

Merged
daedalus merged 2 commits intomasterfrom
copilot/fix-versioning-and-name-mismatch
Feb 24, 2026
Merged

Fix versioning, CLI naming, config validation, and dependency consistency#27
daedalus merged 2 commits intomasterfrom
copilot/fix-versioning-and-name-mismatch

Conversation

Copy link
Contributor

Copilot AI commented Feb 24, 2026

Multiple small but compounding issues: hardcoded __version__ drifting from the distribution, importlib.metadata querying the wrong package name (agp vs agp_tool), missing agp_tool CLI entry point, pinned numpy==1.22 in requirements.txt conflicting with pyproject.toml, and silent clamping of invalid config values instead of failing loudly.

Versioning

  • agp/__init__.py and agp/cli.py now both derive __version__ via importlib.metadata.version("agp_tool") — single source of truth from the distribution metadata
  • Fallback is "unknown" instead of a stale hardcoded string

CLI entry point

  • Added agp_tool = "agp.main:main" to [project.scripts] — aligns with README examples; agp kept as alias

Dependencies

  • requirements.txt: numpy==1.22numpy>=1.21.0 to match pyproject.toml

Config validation (agp/config.py)

Replaced silent clamping with explicit ValueError:

# Previously silently clamped bad values; now raises immediately:
build_config(args_with(bin_minutes=0))
# ValueError: bin_minutes must be positive, got 0

build_config(args_with(low_threshold=200, high_threshold=100))
# ValueError: Thresholds must satisfy very_low <= low <= high <= very_high, got ...

build_config(args_with(tight_low=140, tight_high=140))
# ValueError: tight_low must be less than tight_high, got 140 >= 140

Tests

  • Updated existing test_config.py tests that asserted the old clamping behavior; added 8 new validation tests

CI

  • Added python -m pip install --upgrade pip and cache: pip to both tests.yml and lint.yml
Original prompt

Create a pull request against the master branch of daedalus/agp_tool that fixes the issues identified in the review:

Goals

  1. Unify versioning so there is a single source of truth for the package version.

    • Remove hardcoded __version__ drift.
    • Ensure CLI --version reports the installed distribution version.
    • Ensure agp.__version__ matches the distribution version.
  2. Fix distribution/package name mismatch

    • The distribution name is agp_tool (per pyproject.toml).
    • The import package is agp.
    • Make sure any importlib.metadata.version(...) call uses the correct distribution name.
  3. Align CLI command name with README

    • README usage examples use agp_tool ....
    • Update [project.scripts] so the installed command is agp_tool (keep agp as an alias if you think it’s beneficial, but prioritize agp_tool).
    • Ensure tests (if any) are updated accordingly.
  4. Resolve duplicate/stale root entrypoint

    • There is a repo-root main.py that appears stale/confusing.
    • Replace it with a minimal shim that calls agp.main:main (or remove it if safe), and update README usage/help text accordingly.
  5. Dependency definition consistency

    • requirements.txt conflicts with pyproject.toml (e.g., pins numpy==1.22 while pyproject uses numpy>=1.21.0).
    • Decide a consistent approach:
      • Prefer pyproject.toml as the authoritative dependency list.
      • Update requirements.txt to match (or replace it with a requirements-dev.txt and/or clearly document its purpose).
  6. Add basic config validation

    • Add validation for key invariants (e.g., tight_low < tight_high, very_low <= low <= high <= very_high, positive bin_minutes/sensor_interval/min_samples).
    • Ensure invalid configs raise clear ValueError with actionable messages.
    • Add/extend unit tests for these validations.
  7. Optional (nice-to-have) CI improvements

    • Add python -m pip install --upgrade pip in workflows.
    • Add basic pip caching if straightforward.

Constraints

  • Keep backwards compatibility where reasonable.
  • Ensure pytest passes.
  • Ensure black and ruff pass.
  • Update documentation (README) so it matches the actual installed CLI.

Files likely involved

  • pyproject.toml
  • requirements.txt
  • README.md
  • agp/__init__.py
  • agp/cli.py
  • agp/main.py
  • .github/workflows/*.yml
  • tests/*
  • repo root main.py

Repository

  • Repo: daedalus/agp_tool
  • Target branch: master

This pull request was created from Copilot chat.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…consistency

Co-authored-by: daedalus <115175+daedalus@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix versioning and package name issues in agp_tool Fix versioning, CLI naming, config validation, and dependency consistency Feb 24, 2026
Copilot AI requested a review from daedalus February 24, 2026 15:45
@daedalus daedalus marked this pull request as ready for review February 24, 2026 15:45
@daedalus daedalus merged commit 9babeb2 into master Feb 24, 2026
9 of 10 checks passed
@daedalus daedalus deleted the copilot/fix-versioning-and-name-mismatch branch February 24, 2026 15:46
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