Skip to content

chore(release): bump version to 0.2.0 and refactor to a new architecture#4

Merged
KercyDing merged 9 commits intomainfrom
kercy/020
Nov 17, 2025
Merged

chore(release): bump version to 0.2.0 and refactor to a new architecture#4
KercyDing merged 9 commits intomainfrom
kercy/020

Conversation

@KercyDing
Copy link
Owner

Description

This PR introduces v0.2.0, a major refactoring that establishes a clear four-method command architecture for uvup. The release replaces the old copy command with three new commands (clone, new, sync) that provide clear separation of responsibilities, and migrates from pip freeze to modern pyproject.toml-based dependency management.

This is a breaking change release that sets the foundation for uvup's template-driven workflow system.

Changes

New Commands

  • uvup clone <source> <target>: Create exact 1:1 copy of an environment (no modifications)
  • uvup new <name> --template <template>: Create new projects from templates with modification support
    • Python version override: --python <version>
    • Package filtering: --exclude <packages> and --include <packages>
    • Custom path: --path <directory>
    • Dry-run preview: --dry-run
  • uvup sync --template <template>: Sync current project with template
    • Automatic backup and rollback on failure
    • Same modification options as new command

Breaking Changes

  • Replaced uvup copy with uvup clone for clearer semantics
  • Migrated from pip freeze to pyproject.toml:
    • Environment structure now uses pyproject.toml instead of requirements.txt
    • Added uv.lock support for reproducible builds
    • Full support for [project.optional-dependencies]

Template System Features

  • Python version override support
  • Advanced dependency filtering (PEP 508 specifier support)
  • Dry-run preview mode for all template operations
  • Automatic backup creation in sync operations
  • Automatic rollback on uv lock or uv sync failures

Documentation

  • Created docs/COMMANDS.md (570 lines) - Complete command reference
  • Created docs/USE_CASES.md (489 lines) - Real-world usage scenarios
  • Updated README.md:
    • Simplified Core Philosophy to concise bullet points
    • Added comprehensive v0.2.0 feature listing
    • Added "Documentation" section with quick help references
  • Updated TARGET.md with v0.2.0 completion status and v0.3.0 planning
  • Created comprehensive CHANGELOG.md following Keep a Changelog format (all versions from 0.1.0 to 0.2.0)
  • Updated RELEASE.md with detailed v0.2.0 release notes

Technical Implementation

  • Enhanced commands/new.rs with full template modification support
  • Enhanced commands/sync.rs with backup and rollback mechanism
  • Refactored commands/copy.rs to commands/clone.rs
  • Added comprehensive dry-run implementation across all template commands
  • Improved dependency filtering logic with PEP 508 specifier support
  • Updated CLI argument parsing in src/cli.rs for new commands
  • Updated command routing in src/main.rs

Architecture Philosophy

The four-method architecture provides clear separation:

  • create: Empty environment from scratch
  • clone: Exact 1:1 copy (no modifications)
  • new: Create project from template (with modifications)
  • sync: Update existing project from template (with modifications)

Checklist

  • I have performed a self-review of my own code.
  • I have added tests that prove my feature works or my fix is effective.
  • I have updated the documentation accordingly.
  • All new and existing tests passed.

Add support for specifying a custom Python version when copying environments
via the new `--python` flag. If not provided, the command will continue to
use the source environment's Python version as before.
Add new options to the `copy` command for more flexible environment copying:

- Add `--local` flag to copy environment to `.venv` in current directory
- Add `--exclude` option to filter out specific packages (comma-separated)
- Add `--include` option to copy only specified packages (comma-separated)
- Make `--name` optional and conflict with `--local` flag
- Add user confirmation prompt when creating local `.venv`

These changes enable more granular control over environment copying,
allowing users to create project-local virtual environments and
selectively copy packages based on their needs.
Switch from `uv pip sync` to `uv pip install` when copying environments
with different Python versions to allow automatic dependency resolution.
- Bump version from 0.1.4 to 0.2.0 in Cargo.toml and Cargo.lock
- Refactor copy command to distinguish between local and project environments
- Rename `create_environment` to `create_project_environment` and add `create_local_environment`
- Use `get_venv_path` helper to correctly locate virtual environment directories
- Fix path handling to properly target `.venv` subdirectory for project environments
- Improve clarity by tracking environment type with `is_local` flag

This refactoring improves the separation of concerns between local (.venv in current directory) and project (managed in envs directory) environments, ensuring correct path resolution for package operations.
Replace pip freeze/sync approach with direct pyproject.toml manipulation:
- Read and modify source pyproject.toml instead of using pip freeze
- Filter dependencies directly in TOML (including optional dependencies)
- Use uv lock + uv sync for dependency resolution
- Add --override flag to handle existing pyproject.toml in local mode
- Create automatic backups when overriding existing configs
- Add toml_edit dependency for TOML manipulation
- Remove unused get_venv_path function
Add a `--dry-run` flag to the copy command that allows users to preview
changes before applying them.
The copy command had multiple responsibilities and complex flags.
Split into two focused commands:

- clone: Creates exact 1:1 environment copy (source -> target)
- new: Creates project from template with customization options
  (python version override, package filtering, custom path)
Introduces a new 'sync' command that allows syncing the current project
with a template environment. The command supports:
- Template environment selection
- Python version override
- Package exclusion/inclusion filters (comma-separated)
- Dry-run mode to preview changes
- Add v0.2.0 release notes to CHANGELOG with complete feature list
- Document four-method command architecture (create/clone/new/sync)
- Add 570-line COMMANDS.md with complete command reference
- Add 489-line USE_CASES.md with real-world usage scenarios
- Update README to reflect template-driven workflow
- Simplify Core Philosophy to concise bullet points
- Add Documentation section with quick help and docs links
- Update code examples to use modern `uv add` syntax
- Clean up test project files
@KercyDing KercyDing merged commit c89efaf into main Nov 17, 2025
5 checks passed
@KercyDing KercyDing deleted the kercy/020 branch November 17, 2025 01:11
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