Skip to content

✨ Implement __dir__ to surface dynamic properties in dir() and - #419

Merged
clorton merged 2 commits into
mainfrom
laserframe-dir
Jun 27, 2026
Merged

✨ Implement __dir__ to surface dynamic properties in dir() and#419
clorton merged 2 commits into
mainfrom
laserframe-dir

Conversation

@clorton

@clorton clorton commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

tab-completion

The new __dir__ method merges standard class attributes with dynamically-added
property names from self._properties, returning a sorted, deduplicated list.
This enables IDE/REPL tab-completion to discover scalar, vector, and array
properties that are added at runtime.

tab-completion

The new `__dir__` method merges standard class attributes with
dynamically-added
property names from `self._properties`, returning a sorted, deduplicated
list.
This enables IDE/REPL tab-completion to discover scalar, vector, and
array
properties that are added at runtime.
@clorton clorton added this to the M3: LASER 1.1 milestone Jun 22, 2026
@clorton
clorton requested review from Copilot and jonathanhhb June 22, 2026 19:00
@clorton clorton self-assigned this Jun 22, 2026
@clorton clorton added the enhancement New feature or request label Jun 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds LaserFrame.__dir__ so Python dir() (and IDE/REPL tab-completion) surfaces dynamically-added scalar/vector property names stored in self._properties, and introduces tests that pin the expected dir() behavior.

Changes:

  • Implement LaserFrame.__dir__ to merge default attribute names with dynamic property names from self._properties.
  • Add comprehensive tests covering inclusion/exclusion, sorting/uniqueness, kwargs attributes, and growth behavior when properties are added.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/laser/core/laserframe.py Adds __dir__ to include dynamically-added property names in dir() output.
tests/test_laserframe.py Adds tests validating dir(LaserFrame) behavior for dynamic and standard attributes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

jonathanhhb
jonathanhhb previously approved these changes Jun 27, 2026

@jonathanhhb jonathanhhb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 lines of code. 150 lines of tests. :) Seriously though, looks good. Part of me wants a doc string even though it's a completely private function.

@clorton
clorton merged commit 08fc96c into main Jun 27, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants