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 noreply@anthropic.com

robtaylor and others added 4 commits October 28, 2025 13:56
Phase 1 & 2 of doctest improvements:
- Fix import path in chipflow-toml-guide.rst doctest (_parse_config_file from config.parser)
- Add doctest_global_setup in conf.py with common imports for test examples
- Existing doctest now passes

The global setup imports common modules (Amaranth, ChipFlow signatures) so
that doctests can focus on demonstrating API usage without repetitive imports.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Phase 3 of doctest improvements:
- Convert complete MySoC examples to testcode blocks with assertions
- Two examples converted: using-pin-signatures.rst and architecture.rst
- Examples now validate that classes can be instantiated correctly
- All doctests pass (3 tests total)

Strategy: Convert only complete, self-contained examples that use documented
public APIs. Keep illustrative fragments as code-block for readability.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Phase 4 of doctest improvements:
- Add detailed comments in conf.py explaining testing philosophy
- Clarify when to use testcode vs code-block
- Document the selective testing approach for maintainability
- Provide guidance for future contributors

The strategy balances automatic validation with documentation readability,
testing complete examples while keeping fragments illustrative.

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

Co-Authored-By: Claude <noreply@anthropic.com>
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 <noreply@anthropic.com>
@github-actions
Copy link

github-actions bot commented Oct 28, 2025

Tests Skipped Failures Errors Time
41 4 💤 0 ❌ 0 🔥 21.378s ⏱️

@github-actions
Copy link

github-actions bot commented Oct 28, 2025

PR Preview Action v1.6.2

🚀 View preview at
https://chipflow-lib.docs.chipflow-infra.com/pr-preview/pr-146/

Built to branch gh-pages at 2025-10-28 18:15 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

robtaylor and others added 3 commits October 28, 2025 15:24
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
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