$ show pdm-project/pdm
PDM is a modern Python package and dependency manager that implements the latest PEP standards (517, 518, 621, 582, 735, 751). It provides a comprehensive CLI tool for managing project dependencies, virtual environments, Python interpreters, and publishing packages. The architecture is modular: a core `Project` class orchestrates configuration, lockfile management, environment abstraction, and workspace (monorepo) support. Dependency resolution is handled by either a built-in resolvelib-based resolver or an optional uv backend, with a pluggable installer/synchronizer layer. The tool supports multiple lockfile formats (pdm.lock, pylock.toml), export/import to various formats (requirements.txt, Pipfile, Poetry, Flit, setup.py), and a rich plugin system via entry points and signals. It also includes build backend integration, PEP 582 local package directories, and shell completions. The codebase is well-structured with clear separation of concerns, extensive test coverage, and active maintenance.
The LLM identified 6 files worth highlighting for reuse:
Implements PySpecSet, a subclass of packaging.specifiers.SpecifierSet with union, intersection, subset checks, and conversion to environment markers. This is a self-contained, reusable component for any Python tool that needs to manipulate version specifiers beyond simple parsing, demonstrating non-obvious version algebra.
Wraps dep_logic.markers with methods to split markers by python version, platform, implementation, and extras. Provides evaluation against environment specs. This is a clean abstraction for filtering packages based on environment markers, reusable in any dependency resolver or package installer.
Defines Option and ArgumentGroup classes that allow declarative definition of CLI arguments with deferred registration to argparse. This pattern reduces boilerplate and improves consistency across subcommands. It is self-contained and can be extracted for any Python CLI application.
Provides a UI class with verbosity levels, spinner, progress bar, logging, and theme support using the rich library. It abstracts terminal output formatting and can be reused in any CLI tool that needs consistent, colorful output with progress indication.
Implements a lightweight signal system using blinker, with connected_to context manager and try_emit helper. This allows plugins and hooks to react to lifecycle events (pre/post lock, install, build, publish). The pattern is generic and reusable for any application needing an event bus.
Defines the MetaConverter base class and related utilities for converting between different metadata representations (Poetry, Flit, requirements.txt, etc.). The pattern is cleanly abstracted with check_fingerprint and convert methods, making it easy to add new format converters. Reusable for any tool that needs to translate package metadata formats.