Skip to content

fix(release): support pyproject.toml for version management (#360)#365

Merged
itdove merged 3 commits intomainfrom
360
Apr 6, 2026
Merged

fix(release): support pyproject.toml for version management (#360)#365
itdove merged 3 commits intomainfrom
360

Conversation

@itdove
Copy link
Copy Markdown
Owner

@itdove itdove commented Apr 6, 2026

Description

Fixes #360: The daf release command was failing because it expected the version to be in setup.py, but the project migrated to pyproject.toml (PEP 517/518/621) format.

Changes Made

1. Updated ReleaseManager class (devflow/release/manager.py):

  • Added pyproject_file attribute to track pyproject.toml location
  • Modified read_current_version() to check pyproject.toml first, then fall back to setup.py
  • Updated update_version_files() to update pyproject.toml when it exists
  • Skip empty setup.py files (modern format after migration)
  • Show correct file names in error messages and commit messages

2. Updated release_command.py (devflow/cli/commands/release_command.py):

  • Modified display messages to show correct package file (pyproject.toml vs setup.py)
  • Updated commit messages to reference the correct file being updated

3. Added comprehensive test coverage (tests/test_release_manager_pyproject.py):

  • 8 new tests covering all scenarios:
    • Reading version from pyproject.toml
    • Fallback to setup.py for backward compatibility
    • Updating version in pyproject.toml
    • Skipping empty setup.py files
    • Error handling for missing/invalid configurations

How It Works

The fix implements smart detection:

  1. If pyproject.toml exists with a version field → read/write there
  2. If only setup.py exists with version field → use it (backward compatibility)
  3. If neither has version info → raise helpful error

This ensures the release command works for:

  • Modern Python projects using pyproject.toml (like DevAIFlow)
  • Legacy projects still using setup.py
  • Mixed configurations during migration periods

Testing

Steps to test

  1. Pull down the PR
    gh pr checkout 360
  2. Run the new test suite
    pytest tests/test_release_manager_pyproject.py -v
  3. Test the release command with pyproject.toml
    daf release 2.2.0 --dry-run
  4. Verify it shows "Updated devflow/init.py and pyproject.toml"
  5. Run full test suite to ensure backward compatibility
    pytest

Scenarios tested

  • Reading version from pyproject.toml (modern format)
  • Reading version from setup.py (legacy format)
  • Fallback from pyproject.toml to setup.py
  • Updating version in pyproject.toml
  • Updating version in setup.py when pyproject.toml has no version
  • Skipping empty setup.py files
  • Error handling when version is missing from both files
  • Correct file names in error messages and commits
  • All 3654 existing tests pass (backward compatibility)
  • Manual verification: daf release 2.2.0 --dry-run works correctly

Deployment considerations

  • This code change is ready for deployment on its own
  • This code change requires the following considerations before being deployed:

Notes:

  • Fully backward compatible with projects still using setup.py
  • No breaking changes to existing functionality
  • No configuration changes required

Test Results

✅ All 8 new pyproject.toml tests pass
✅ All 3654 existing tests pass
✅ Manual verification successful
✅ Zero regressions detected

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com

itdove and others added 3 commits April 6, 2026 09:02
The daf release command was failing because it expected version to be in
setup.py, but the project migrated to pyproject.toml (PEP 517/518/621).

Changes:
- ReleaseManager now checks pyproject.toml first, falls back to setup.py
- Update version in pyproject.toml when it exists
- Skip empty setup.py files (modern format after migration)
- Show correct file names in error messages and commits
- Added 8 comprehensive tests for pyproject.toml support
- Maintains full backward compatibility with setup.py-only projects

The fix ensures daf release works for both modern (pyproject.toml) and
legacy (setup.py) Python projects.

Test Results:
- All 8 new tests pass
- All 3654 existing tests pass
- Manual verification: daf release 2.2.0 --dry-run works correctly

Fixes: #360

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Update session ID and start timestamp in _session.json
- Add new session section to memory.md
- Increment total sessions counter to 6

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@itdove itdove marked this pull request as ready for review April 6, 2026 13:39
@itdove itdove merged commit d2a1e99 into main Apr 6, 2026
7 checks passed
@itdove itdove deleted the 360 branch April 6, 2026 13:39
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.

daf release command fails with pyproject.toml - expects setup.py version field

1 participant