Skip to content

Conversation

@robtaylor
Copy link
Contributor

Summary

This PR renames the main package from chipflow_lib to chipflow, maintaining full backward compatibility through a compatibility shim.

Changes Made

Package Structure

  • Renamed chipflow_lib/ directory to chipflow/
  • Created chipflow_lib/ backward compatibility package that:
    • Shows deprecation warning on import
    • Re-exports all symbols from chipflow via __path__ manipulation
    • Allows existing code using chipflow_lib to continue working without modifications

Code Updates

  • Updated all internal imports from chipflow_lib to chipflow
  • Updated pyproject.toml:
    • Package name: chipflow-libchipflow
    • Script entry point: chipflow_lib.cli:runchipflow.cli:run
    • Coverage and lint references updated
  • Updated domain identifier in simulatable_interface():
    • com.chipflow.chipflow_libcom.chipflow.chipflow

Documentation

  • Updated all documentation references from chipflow_lib to chipflow
  • Updated docs/conf.py to import from chipflow
  • Updated all .rst files with new package name

Tests

  • Updated all test imports to use chipflow
  • Updated mock patches from chipflow_lib.* to chipflow.*
  • All 37 tests pass ✅

Backward Compatibility

The chipflow_lib compatibility shim ensures existing code continues to work:

import chipflow_lib  # Shows deprecation warning but works
from chipflow_lib.platforms import UARTSignature  # Works transparently

The deprecation warning encourages users to update:

DeprecationWarning: The 'chipflow_lib' package has been renamed to 'chipflow'. 
Please update your imports to use 'chipflow' instead of 'chipflow_lib'. 
This compatibility shim will be removed in a future version.

Testing

✅ All 37 tests pass
✅ Backward compatibility verified - import chipflow_lib works with deprecation warning
✅ Submodule imports work: from chipflow_lib.platforms import UARTSignature
✅ New imports work: from chipflow.platforms import UARTSignature

Migration Path

Users can migrate gradually:

  1. Immediate: All existing chipflow_lib code continues to work (with warnings)
  2. Short term: Users update their imports from chipflow_lib to chipflow
  3. Future release: Remove the chipflow_lib compatibility shim

🤖 Generated with Claude Code

Co-Authored-By: Claude [email protected]

@github-actions
Copy link

github-actions bot commented Oct 28, 2025

Tests Skipped Failures Errors Time
44 4 💤 0 ❌ 0 🔥 20.947s ⏱️

@github-actions
Copy link

github-actions bot commented Oct 28, 2025

PR Preview Action v1.6.2
Preview removed because the pull request was closed.
2025-11-11 22:43 UTC

Base automatically changed from refactor/restructure-codebase to main November 11, 2025 19:51
robtaylor and others added 6 commits November 11, 2025 20:07
Rename the main package from chipflow_lib to chipflow, maintaining
full backward compatibility through a compatibility shim.

Changes:
- Renamed chipflow_lib/ directory to chipflow/
- Updated all internal imports from chipflow_lib to chipflow
- Created chipflow_lib/ backward compatibility package that re-exports
  from chipflow with deprecation warnings
- Updated pyproject.toml package name and references
- Updated all documentation references from chipflow_lib to chipflow
- Updated test imports and mock patches
- Changed simulatable_interface default base from
  "com.chipflow.chipflow_lib" to "com.chipflow.chipflow"

The chipflow_lib backward compatibility shim:
- Shows deprecation warning on import
- Re-exports all symbols from chipflow via __path__ manipulation
- Allows existing code using chipflow_lib to continue working
- Will be maintained temporarily before removal in future version

All tests pass with the new package structure.

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

Co-Authored-By: Claude <[email protected]>
Replace wildcard import in chipflow_lib with explicit minimal API based on
actual usage in chipflow-digital-ip and chipflow-examples repositories.

Changes:
- chipflow_lib/__init__.py: Only export ChipFlowError, __version__, and
  internal API functions (_parse_config, etc.)
- chipflow_lib/platforms/__init__.py: Stub module exporting pin signatures
  and software build utilities used by dependent packages
- chipflow_lib/steps/{board,sim,software}.py: Stub modules exporting step
  classes used by chipflow-examples
- chipflow_lib/config.py: Stub module proxying to chipflow.config
- tests/fixtures/mock.toml: Updated step references to use new module names

All backward compatibility stubs now show deprecation warnings encouraging
users to migrate to the new 'chipflow' package name.

Tests: 37 passed, 4 skipped. All backward compatibility imports verified.

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

Co-Authored-By: Claude <[email protected]>
Add noqa: E402 annotations to imports that intentionally come after
deprecation warnings. The imports need to be after warnings.warn() so
users see the deprecation message when they import these modules.

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

Co-Authored-By: Claude <[email protected]>
JTAGSignature is used by chipflow-examples mcu_soc project but was
missing from the backward compatibility stub exports.

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

Co-Authored-By: Claude <[email protected]>
Add three new tests to verify pinlock file loading behavior:
- test_load_pinlock_file: validates successful loading of valid lockfile
- test_load_pinlock_missing_file: ensures proper error when file missing
- test_load_pinlock_malformed_file: ensures proper error for invalid data

Fix bug in load_pinlock() where only pydantic.ValidationError was caught,
but Pydantic 2.x also raises PydanticUserError for incomplete models.
Now catches both exception types.

Fix test isolation by clearing ensure_chipflow_root() cache between tests
to prevent environment pollution across test runs.

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

Co-Authored-By: Claude <[email protected]>
Fix issue where real-world pins.lock files were incorrectly reported as
malformed due to unresolved forward references in Pydantic models.

Changes:
- Call model_rebuild() on Package and LockFile after importing all
  package types to resolve forward references
- Chain validation errors using 'from e' to preserve detailed error
  information for debugging while showing user-friendly message

The model_rebuild() calls are necessary because the lockfile models use
forward references to package types (GAPackageDef, QuadPackageDef, etc.)
that are only imported later in the __init__.py file.

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

Co-Authored-By: Claude <[email protected]>
@robtaylor robtaylor merged commit 7920700 into main Nov 11, 2025
5 of 6 checks passed
@robtaylor robtaylor deleted the rename-chipflow branch November 11, 2025 22:41
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