8000 feat: implement Phase 2 - additional parsers, solvers, analyzers, and utilities by dominicusin · Pull Request #19 · dominicusin/package-maximizer · GitHub
[go: up one dir, main page]

Skip to content

feat: implement Phase 2 - additional parsers, solvers, analyzers, and utilities - #19

Merged
dominicusin merged 1 commit into
mainfrom
vibe/implement-phase2-6d39eb
Aug 30, 2026
Merged

dominicusin merged 1 commit into
mainfrom
vibe/implement-phase2-6d39eb

Conversation

@dominicusin
Copy link
Copy Markdown
Owner

Summary

Implements Phase 2 of the development plan with extended functionality:

New Parsers (3 implemented)

  • PacmanParser: Parser for Pacman (Arch Linux) packages
    • Supports pacman -Q (installed packages)
    • Supports pacman -Ss (search results)
    • Supports pacman -Si (package info)
  • DNFParser: Parser for DNF (Fedora/RHEL/CentOS) packages
    • Supports dnf list installed
    • Supports dnf info
    • Supports dnf search
  • BrewParser: Parser for Homebrew (macOS) packages
    • Supports brew list
    • Supports brew info
    • Supports brew search

New Solvers (2 implemented)

  • MaxSatSolver: SAT-based solver using MaxSAT via PySAT
    • Maximizes number of selected packages
    • Handles conflicts through CNF constraints
    • Supports weighted optimization
    • Automatic fallback to GreedySolver
  • MiniSatSolver: SAT-based solver using MiniSat via PySAT
    • Similar functionality to MaxSatSolver
    • Configurable solver backend (m22, g3, etc.)
    • Supports weighted optimization
    • Automatic fallback to GreedySolver

New Analyzers (1 implemented)

  • ResultAnalyzer: Comprehensive analysis of maximization results
    • Compares installed vs proposed packages
    • Calculates statistics (to install, to remove, unchanged)
    • Categorizes changes (no_changes, minor, moderate, significant, major)
    • Generates compatibility matrices
    • Provides dependency analysis
    • Supports multi-solver comparison with reference

New Utilities

  • CacheManager: Two-level caching system
    • In-memory cache with TTL
    • File-based persistent cache
    • Cache decorator for functions
    • Automatic cleanup of expired entries
  • BenchmarkRunner: Performance testing framework
    • Generates test packages with configurable conflict probability
    • Runs benchmarks across multiple solvers
    • Supports different package counts
    • Exports reports in JSON and CSV formats

Core Updates

  • Updated PackageMaximizer to support new components
  • Updated solver registry with MaxSAT and MiniSat
  • Updated parser registry with Pacman, DNF, Brew
  • Added analyzer registry
  • Version bump: 0.2.0 → 0.3.0

Tests

  • Added 60+ new comprehensive tests
  • Total tests: 114 (100% pass rate)
  • Coverage includes all new parsers, solvers, analyzers, and utilities

Usage Examples

New Parsers

from package_maximizer.parsers import PacmanParser, DNFParser, BrewParser

# Parse Pacman output
parser = PacmanParser()
packages = parser.parse("core/linux 6.6.10.arch1-1\ncore/python 3.11.5-1")

# Parse DNF output  
parser = DNFParser()
packages = parser.parse("kernel-core.x86_64 6.6.10-100.fc39 @updates")

# Parse Brew output
parser = BrewParser()
packages = parser.parse("vim\nwget\npython@3.11")

New Solvers

from package_maximizer.solvers import MaxSatSolver, MiniSatSolver

solver = MaxSatSolver()
result = solver.solve([pkg1, pkg2, pkg3])

solver = MiniSatSolver(solver_name='g3')
result = solver.solve_with_weights([pkg1, pkg2], weights={'pkg1': 10, 'pkg2': 5})

New Analyzer

from package_maximizer.analyzers import ResultAnalyzer

analyzer = ResultAnalyzer()
result = analyzer.analyze(
    installed=['pkg1', 'pkg2', 'pkg3'],
    proposed=['pkg1', 'pkg4', 'pkg5']
)
# Returns: {summary, changes, statistics}

New Utilities

from package_maximizer.utils import CacheManager, BenchmarkRunner

# Caching
cache = CacheManager()
result = cache.cached()(expensive_function, arg1, arg2)

# Benchmarking
runner = BenchmarkRunner(runs=5)
reports = runner.run_all_benchmarks(
    package_counts=[10, 50, 100],
    solver_names=['greedy', 'z3', 'maxsat']
)

Closes #2

… utilities

Phase 2 implementation includes:

## New Parsers (3 added)
- **PacmanParser**: Parser for Pacman (Arch Linux) packages
  - Supports pacman -Q, pacman -Ss, pacman -Si formats
- **DNFParser**: Parser for DNF (Fedora/RHEL) packages
  - Supports dnf list, dnf info, dnf search formats
- **BrewParser**: Parser for Homebrew (macOS) packages
  - Supports brew list, brew info, brew search formats

## New Solvers (2 added)
- **MaxSatSolver**: SAT-based solver using MaxSAT
  - Uses python-sat library
  - Supports weighted optimization
- **MiniSatSolver**: SAT-based solver using MiniSat
  - Uses python-sat library
  - Supports weighted optimization

## New Analyzers (1 added)
- **ResultAnalyzer**: Analyzes maximization results
  - Compares installed vs proposed packages
  - Generates compatibility matrices
  - Provides dependency analysis
  - Supports solver comparison

## New Utilities
- **CacheManager**: Caching system for results
  - File-based and in-memory caching
  - TTL support
  - Cache decorator
- **BenchmarkRunner**: Performance testing framework
  - Generates test packages
  - Runs benchmarks across solvers
  - Exports reports (JSON, CSV)

## Updates
- Updated PackageMaximizer to support new components
- Updated solver registry with MaxSAT and MiniSat
- Updated parser registry with Pacman, DNF, Brew
- Added analyzer registry
- Version bump: 0.2.0 -> 0.3.0

## Tests
- Added 60+ new tests for all new components
- Total tests: 114 (all passing)

Closes #2

Co-authored-by: dominicusin <dominicusin@users.noreply.github.com>
@qodo-code-review
Copy link
Copy Mar 8000 kdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai
coderabbitai Bot commented Aug 30, 2026
Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 39 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4a4011c1-066f-46ed-8cc4-46f6ef4d5a1b

📥 Commits

Reviewing files that changed from the base of the PR and between 44877df and 63f1003.

📒 Files selected for processing (21)
  • package_maximizer/__init__.py
  • package_maximizer/analyzers/__init__.py
  • package_maximizer/analyzers/result_analyzer.py
  • package_maximizer/core/__init__.py
  • package_maximizer/core/maximizer.py
  • package_maximizer/parsers/__init__.py
  • package_maximizer/parsers/brew_parser.py
  • package_maximizer/parsers/dnf_parser.py
  • package_maximizer/parsers/pacman_parser.py
  • package_maximizer/solvers/__init__.py
  • package_maximizer/solvers/greedy.py
  • package_maximizer/solvers/maxsat_solver.py
  • package_maximizer/solvers/minisat_solver.py
  • package_maximizer/utils/__init__.py
  • package_maximizer/utils/benchmark.py
  • package_maximizer/utils/cache.py
  • tests/test_analyzers.py
  • tests/test_basic.py
  • tests/test_parsers_extended.py
  • tests/test_solvers_extended.py
  • tests/test_utils.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dominicusin
dominicusin merged commit 01b195a into main Aug 30, 2026
2 of 12 checks passed
@dominicusin
dominicusin deleted the vibe/implement-phase2-6d39eb branch August 30, 2026 02:04
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

0